From 56bf9cec50183a34321cac5b531aef0d1b85ccba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Espino=20Garc=C3=ADa?= Date: Thu, 8 Sep 2022 09:30:53 +0200 Subject: [PATCH] Add missing field "sortOrder" to graphQL schema (#20956) * Add missing field "sortOrder" to graphQL schema * Add test Co-authored-by: Mattermod --- api4/resolver_sidebar_categories_test.go | 5 +++++ api4/schema.graphqls | 1 + model/channel_sidebar.go | 4 ++++ 3 files changed, 10 insertions(+) diff --git a/api4/resolver_sidebar_categories_test.go b/api4/resolver_sidebar_categories_test.go index 2b8af0a7bc..e6ae61fd07 100644 --- a/api4/resolver_sidebar_categories_test.go +++ b/api4/resolver_sidebar_categories_test.go @@ -27,6 +27,7 @@ func TestGraphQLSidebarCategories(t *testing.T) { Sorting model.SidebarCategorySorting `json:"sorting"` ChannelIDs []string `json:"channelIds"` TeamID string `json:"teamId"` + SortOrder int64 `json:"sortOrder"` } `json:"sidebarCategories"` } @@ -39,6 +40,7 @@ func TestGraphQLSidebarCategories(t *testing.T) { displayName sorting channelIds + sortOrder } } `, @@ -69,6 +71,7 @@ func TestGraphQLSidebarCategories(t *testing.T) { assert.Equal(t, categories.Categories[i].DisplayName, q.SidebarCategories[i].DisplayName) assert.Equal(t, categories.Categories[i].Sorting, q.SidebarCategories[i].Sorting) assert.Equal(t, categories.Categories[i].ChannelIds(), q.SidebarCategories[i].ChannelIDs) + assert.Equal(t, categories.Categories[i].SortOrder, q.SidebarCategories[i].SortOrder) } input = graphQLInput{ @@ -80,6 +83,7 @@ func TestGraphQLSidebarCategories(t *testing.T) { displayName sorting channelIds + sortOrder } } `, @@ -114,6 +118,7 @@ func TestGraphQLSidebarCategories(t *testing.T) { sorting channelIds teamId + sortOrder } } `, diff --git a/api4/schema.graphqls b/api4/schema.graphqls index 71b222ee62..a976ead790 100644 --- a/api4/schema.graphqls +++ b/api4/schema.graphqls @@ -203,6 +203,7 @@ type SidebarCategory { collapsed: Boolean! teamId: String! channelIds: [String!]! + sortOrder: Float! } # Deliberately leaving out teamMembers. diff --git a/model/channel_sidebar.go b/model/channel_sidebar.go index e37f5601e5..e8b5a6a215 100644 --- a/model/channel_sidebar.go +++ b/model/channel_sidebar.go @@ -124,3 +124,7 @@ func (t *SidebarCategorySorting) UnmarshalGraphQL(input any) error { *t = SidebarCategorySorting(chType) return nil } + +func (t *SidebarCategory) SortOrder_() float64 { + return float64(t.SortOrder) +}