[MM-53156] Remove Multi-Product architecture (#25669)
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
d3b799eaa5
Коммит
de3e5aab25
@@ -19,7 +19,6 @@ import (
|
||||
"github.com/mattermost/mattermost/server/public/shared/mlog"
|
||||
"github.com/mattermost/mattermost/server/public/shared/request"
|
||||
pUtils "github.com/mattermost/mattermost/server/public/utils"
|
||||
"github.com/mattermost/mattermost/server/v8/channels/product"
|
||||
"github.com/mattermost/mattermost/server/v8/channels/store"
|
||||
"github.com/mattermost/mattermost/server/v8/channels/store/sqlstore"
|
||||
)
|
||||
@@ -28,89 +27,6 @@ const (
|
||||
UpdateMultipleMaximum = 200
|
||||
)
|
||||
|
||||
// channelsWrapper provides an implementation of `product.ChannelService` to be used by products.
|
||||
type channelsWrapper struct {
|
||||
app *App
|
||||
}
|
||||
|
||||
func (s *channelsWrapper) GetDirectChannel(userID1, userID2 string) (*model.Channel, *model.AppError) {
|
||||
return s.app.getDirectChannel(request.EmptyContext(s.app.Log()), userID1, userID2)
|
||||
}
|
||||
|
||||
// GetChannelByID gets a Channel by its ID.
|
||||
func (s *channelsWrapper) GetChannelByID(channelID string) (*model.Channel, *model.AppError) {
|
||||
return s.app.GetChannel(request.EmptyContext(s.app.Log()), channelID)
|
||||
}
|
||||
|
||||
// GetChannelMember gets a channel member by userID.
|
||||
func (s *channelsWrapper) GetChannelMember(channelID string, userID string) (*model.ChannelMember, *model.AppError) {
|
||||
return s.app.GetChannelMember(request.EmptyContext(s.app.Log()), channelID, userID)
|
||||
}
|
||||
|
||||
func (s *channelsWrapper) GetChannelsForTeamForUser(teamID string, userID string, opts *model.ChannelSearchOpts) (model.ChannelList, *model.AppError) {
|
||||
return s.app.GetChannelsForTeamForUser(request.EmptyContext(s.app.Log()), teamID, userID, opts)
|
||||
}
|
||||
|
||||
func (s *channelsWrapper) GetChannelSidebarCategories(userID, teamID string) (*model.OrderedSidebarCategories, *model.AppError) {
|
||||
return s.app.GetSidebarCategoriesForTeamForUser(request.EmptyContext(s.app.Log()), userID, teamID)
|
||||
}
|
||||
|
||||
func (s *channelsWrapper) GetChannelMembers(channelID string, page, perPage int) (model.ChannelMembers, *model.AppError) {
|
||||
return s.app.GetChannelMembersPage(request.EmptyContext(s.app.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.app.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.app.Log()), userID, teamID, categories)
|
||||
}
|
||||
|
||||
func (s *channelsWrapper) CreateChannel(channel *model.Channel) (*model.Channel, *model.AppError) {
|
||||
return s.app.CreateChannel(request.EmptyContext(s.app.Log()), channel, false)
|
||||
}
|
||||
|
||||
func (s *channelsWrapper) AddUserToChannel(channelID, userID, asUserID string) (*model.ChannelMember, *model.AppError) {
|
||||
ctx := request.EmptyContext(s.app.Log())
|
||||
channel, err := s.app.GetChannel(ctx, channelID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return s.app.AddChannelMember(ctx, userID, channel, ChannelMemberOpts{
|
||||
UserRequestorID: asUserID,
|
||||
})
|
||||
}
|
||||
|
||||
func (s *channelsWrapper) UpdateChannelMemberRoles(channelID, userID, newRoles string) (*model.ChannelMember, *model.AppError) {
|
||||
return s.app.UpdateChannelMemberRoles(request.EmptyContext(s.app.Log()), channelID, userID, newRoles)
|
||||
}
|
||||
|
||||
func (s *channelsWrapper) DeleteChannelMember(channelID, userID string) *model.AppError {
|
||||
return s.app.LeaveChannel(request.EmptyContext(s.app.Log()), channelID, userID)
|
||||
}
|
||||
|
||||
func (s *channelsWrapper) AddChannelMember(channelID, userID string) (*model.ChannelMember, *model.AppError) {
|
||||
channel, err := s.GetChannelByID(channelID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return s.app.AddChannelMember(request.EmptyContext(s.app.Log()), userID, channel, ChannelMemberOpts{
|
||||
// For now, don't allow overriding these via the plugin API.
|
||||
UserRequestorID: "",
|
||||
PostRootID: "",
|
||||
})
|
||||
}
|
||||
|
||||
func (s *channelsWrapper) GetDirectChannelOrCreate(userID1, userID2 string) (*model.Channel, *model.AppError) {
|
||||
return s.app.GetOrCreateDirectChannel(request.EmptyContext(s.app.Log()), userID1, userID2)
|
||||
}
|
||||
|
||||
// Ensure the wrapper implements the product service.
|
||||
var _ product.ChannelService = (*channelsWrapper)(nil)
|
||||
|
||||
// DefaultChannelNames returns the list of system-wide default channel names.
|
||||
//
|
||||
// By default the list will be (not necessarily in this order):
|
||||
|
||||
Ссылка в новой задаче
Block a user