Add new functions to channel service and kv store service interfaces
Этот коммит содержится в:
@@ -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)
|
||||
|
||||
|
||||
@@ -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(),
|
||||
|
||||
Ссылка в новой задаче
Block a user