MM-63728: simplify category store with graphql gone (#30848)
* move category permissions to api In https://github.com/mattermost/mattermost/pull/21038, we changed the behaviour of the channel category store to filter out deleted teams and teams for which the user was not a member. This was necessary in part due to querying multiple teams via GraphQL. With GraphQL no longer supported, let's move the permissions to the API instead and remove the `JOIN` to filter out teams in the store. Note that we /don't/ prevent access to deleted teams. For better or worse, deleted teams remain largely accessible via other API endpoints anyway. * remove ExcludeTeam / GraphQL support As part of https://github.com/mattermost/mattermost/pull/20353, we added `ExcludeTeam` and the associated logic to support a GraphQL API. With GraphQL no longer supported, let's simplify this logic and remove the filtering and associated complexity. * Fix shadow variable declaration in channel_store_categories.go Fixed golangci-lint error by reusing existing err variable rather than shadowing it. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * fix build issue * Remove SidebarCategorySearchOpts and simplify API to use teamID string Per code review feedback, this change removes the SidebarCategorySearchOpts struct entirely since the Type field was never used in the store implementation. All methods now accept a simple teamID string parameter instead of the struct, which simplifies the API and makes the code clearer. Changes: - Remove SidebarCategorySearchOpts struct from store.go - Update CreateInitialSidebarCategories and GetSidebarCategories signatures - Update all implementations (sqlstore, retrylayer, timerlayer, mocks) - Update all callers to pass teamID string directly - Clean up unused imports 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> --------- Co-authored-by: Claude <noreply@anthropic.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
b69412d23f
Коммит
dcc72c4c61
@@ -1041,10 +1041,10 @@ func (s *TimerLayerChannelStore) CreateDirectChannel(ctx request.CTX, userID *mo
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *TimerLayerChannelStore) CreateInitialSidebarCategories(c request.CTX, userID string, opts *store.SidebarCategorySearchOpts) (*model.OrderedSidebarCategories, error) {
|
||||
func (s *TimerLayerChannelStore) CreateInitialSidebarCategories(c request.CTX, userID string, teamID string) (*model.OrderedSidebarCategories, error) {
|
||||
start := time.Now()
|
||||
|
||||
result, err := s.ChannelStore.CreateInitialSidebarCategories(c, userID, opts)
|
||||
result, err := s.ChannelStore.CreateInitialSidebarCategories(c, userID, teamID)
|
||||
|
||||
elapsed := float64(time.Since(start)) / float64(time.Second)
|
||||
if s.Root.Metrics != nil {
|
||||
@@ -1937,10 +1937,10 @@ func (s *TimerLayerChannelStore) GetPublicChannelsForTeam(teamID string, offset
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *TimerLayerChannelStore) GetSidebarCategories(userID string, opts *store.SidebarCategorySearchOpts) (*model.OrderedSidebarCategories, error) {
|
||||
func (s *TimerLayerChannelStore) GetSidebarCategories(userID string, teamID string) (*model.OrderedSidebarCategories, error) {
|
||||
start := time.Now()
|
||||
|
||||
result, err := s.ChannelStore.GetSidebarCategories(userID, opts)
|
||||
result, err := s.ChannelStore.GetSidebarCategories(userID, teamID)
|
||||
|
||||
elapsed := float64(time.Since(start)) / float64(time.Second)
|
||||
if s.Root.Metrics != nil {
|
||||
|
||||
Ссылка в новой задаче
Block a user