diff --git a/Makefile b/Makefile index e305cf3a5c..d317df5b9b 100644 --- a/Makefile +++ b/Makefile @@ -200,7 +200,7 @@ endif # Playbooks BUILD_PLAYBOOKS_DIR ?= ../mattermost-plugin-playbooks -BUILD_PLAYBOOKS ?= false +BUILD_PLAYBOOKS ?= true ifeq ($(BUILD_PLAYBOOKS),true) IGNORE:=$(shell cp $(BUILD_PLAYBOOKS_DIR)/product/imports/playbooks_imports.go imports/) diff --git a/app/channel.go b/app/channel.go index fdc8d17da3..64d322af59 100644 --- a/app/channel.go +++ b/app/channel.go @@ -27,6 +27,7 @@ import ( // channelsWrapper provides an implementation of `product.ChannelService` to be used by products. type channelsWrapper struct { srv *Server + app *App } func (s *channelsWrapper) GetDirectChannel(userID1, userID2 string) (*model.Channel, *model.AppError) { @@ -47,6 +48,22 @@ func (s *channelsWrapper) GetChannelsForTeamForUser(teamID string, userID string return s.srv.getChannelsForTeamForUser(request.EmptyContext(s.srv.Log()), teamID, userID, opts) } +func (s *channelsWrapper) GetChannelSidebarCategories(userID, teamID string) (*model.OrderedSidebarCategories, *model.AppError) { + return s.app.GetSidebarCategoriesForTeamForUser(request.EmptyContext(s.srv.Log()), userID, teamID) +} + +func (s *channelsWrapper) GetChannelMembers(channelID string, page, perPage int) (model.ChannelMembers, *model.AppError) { + return s.app.GetChannelMembersPage(request.EmptyContext(s.srv.Log()), channelID, page, perPage) +} + +func (s *channelsWrapper) CreateChannelSidebarCategory(userID, teamID string, newCategory *model.SidebarCategoryWithChannels) (*model.SidebarCategoryWithChannels, *model.AppError) { + return s.app.CreateSidebarCategory(request.EmptyContext(s.srv.Log()), userID, teamID, newCategory) +} + +func (s *channelsWrapper) UpdateChannelSidebarCategories(userID, teamID string, categories []*model.SidebarCategoryWithChannels) ([]*model.SidebarCategoryWithChannels, *model.AppError) { + return s.app.UpdateSidebarCategories(request.EmptyContext(s.srv.Log()), userID, teamID, categories) +} + // Ensure the wrapper implements the product service. var _ product.ChannelService = (*channelsWrapper)(nil) diff --git a/app/server.go b/app/server.go index d39e66705c..11e4329a4e 100644 --- a/app/server.go +++ b/app/server.go @@ -262,8 +262,9 @@ func NewServer(options ...Option) (*Server, error) { // ensure app implements `product.UserService` var _ product.UserService = (*App)(nil) + app := New(ServerConnector(s.Channels())) serviceMap := map[ServiceKey]any{ - ChannelKey: &channelsWrapper{srv: s}, + ChannelKey: &channelsWrapper{srv: s, app: app}, ConfigKey: s.platform, LicenseKey: s.licenseWrapper, FilestoreKey: s.platform.FileBackend(), diff --git a/product/api.go b/product/api.go index b77ba0d4f8..3012608bcb 100644 --- a/product/api.go +++ b/product/api.go @@ -65,6 +65,10 @@ type ChannelService interface { GetChannelByID(channelID string) (*model.Channel, *model.AppError) GetChannelMember(channelID string, userID string) (*model.ChannelMember, *model.AppError) GetChannelsForTeamForUser(teamID string, userID string, opts *model.ChannelSearchOpts) (model.ChannelList, *model.AppError) + GetChannelSidebarCategories(userID, teamID string) (*model.OrderedSidebarCategories, *model.AppError) + GetChannelMembers(channelID string, page, perPage int) (model.ChannelMembers, *model.AppError) + CreateChannelSidebarCategory(userID, teamID string, newCategory *model.SidebarCategoryWithChannels) (*model.SidebarCategoryWithChannels, *model.AppError) + UpdateChannelSidebarCategories(userID, teamID string, categories []*model.SidebarCategoryWithChannels) ([]*model.SidebarCategoryWithChannels, *model.AppError) } // LicenseService provides license related utilities. @@ -161,6 +165,8 @@ type CloudService interface { type KVStoreService interface { SetPluginKeyWithOptions(pluginID string, key string, value []byte, options model.PluginKVSetOptions) (bool, *model.AppError) KVGet(productID, key string) ([]byte, *model.AppError) + KVDelete(productID, key string) *model.AppError + KVList(productID string, page, perPage int) ([]string, *model.AppError) } // LogService is the API for accessing the log service APIs.