GraphQL: Create dedicated top-level filter for sidebar categories (#20353)
We add the excludeTeam switch to allow user to get all sidebar categories from other teams excluding a given team. ```release-note NONE ```
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
ade2271442
Коммит
bd6acf04a9
@@ -33,14 +33,19 @@ func testCreateInitialSidebarCategories(t *testing.T, ss store.Store) {
|
||||
userId := model.NewId()
|
||||
teamId := model.NewId()
|
||||
|
||||
res, nErr := ss.Channel().CreateInitialSidebarCategories(userId, teamId)
|
||||
opts := &store.SidebarCategorySearchOpts{
|
||||
TeamID: teamId,
|
||||
ExcludeTeam: false,
|
||||
}
|
||||
|
||||
res, nErr := ss.Channel().CreateInitialSidebarCategories(userId, opts)
|
||||
assert.NoError(t, nErr)
|
||||
assert.Len(t, res.Categories, 3)
|
||||
require.Len(t, res.Categories, 3)
|
||||
assert.Equal(t, model.SidebarCategoryFavorites, res.Categories[0].Type)
|
||||
assert.Equal(t, model.SidebarCategoryChannels, res.Categories[1].Type)
|
||||
assert.Equal(t, model.SidebarCategoryDirectMessages, res.Categories[2].Type)
|
||||
|
||||
res2, err := ss.Channel().GetSidebarCategories(userId, teamId)
|
||||
res2, err := ss.Channel().GetSidebarCategoriesForTeamForUser(userId, teamId)
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, res, res2)
|
||||
})
|
||||
@@ -49,20 +54,24 @@ func testCreateInitialSidebarCategories(t *testing.T, ss store.Store) {
|
||||
userId := model.NewId()
|
||||
teamId := model.NewId()
|
||||
|
||||
res, nErr := ss.Channel().CreateInitialSidebarCategories(userId, teamId)
|
||||
opts := &store.SidebarCategorySearchOpts{
|
||||
TeamID: teamId,
|
||||
ExcludeTeam: false,
|
||||
}
|
||||
res, nErr := ss.Channel().CreateInitialSidebarCategories(userId, opts)
|
||||
require.NoError(t, nErr)
|
||||
require.NotEmpty(t, res)
|
||||
|
||||
userId2 := model.NewId()
|
||||
|
||||
res, nErr = ss.Channel().CreateInitialSidebarCategories(userId2, teamId)
|
||||
res, nErr = ss.Channel().CreateInitialSidebarCategories(userId2, opts)
|
||||
assert.NoError(t, nErr)
|
||||
assert.Len(t, res.Categories, 3)
|
||||
assert.Equal(t, model.SidebarCategoryFavorites, res.Categories[0].Type)
|
||||
assert.Equal(t, model.SidebarCategoryChannels, res.Categories[1].Type)
|
||||
assert.Equal(t, model.SidebarCategoryDirectMessages, res.Categories[2].Type)
|
||||
|
||||
res2, err := ss.Channel().GetSidebarCategories(userId2, teamId)
|
||||
res2, err := ss.Channel().GetSidebarCategoriesForTeamForUser(userId2, teamId)
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, res, res2)
|
||||
})
|
||||
@@ -71,20 +80,27 @@ func testCreateInitialSidebarCategories(t *testing.T, ss store.Store) {
|
||||
userId := model.NewId()
|
||||
teamId := model.NewId()
|
||||
|
||||
res, nErr := ss.Channel().CreateInitialSidebarCategories(userId, teamId)
|
||||
opts := &store.SidebarCategorySearchOpts{
|
||||
TeamID: teamId,
|
||||
ExcludeTeam: false,
|
||||
}
|
||||
res, nErr := ss.Channel().CreateInitialSidebarCategories(userId, opts)
|
||||
require.NoError(t, nErr)
|
||||
require.NotEmpty(t, res)
|
||||
|
||||
teamId2 := model.NewId()
|
||||
|
||||
res, nErr = ss.Channel().CreateInitialSidebarCategories(userId, teamId2)
|
||||
opts = &store.SidebarCategorySearchOpts{
|
||||
TeamID: teamId2,
|
||||
ExcludeTeam: false,
|
||||
}
|
||||
res, nErr = ss.Channel().CreateInitialSidebarCategories(userId, opts)
|
||||
assert.NoError(t, nErr)
|
||||
assert.Len(t, res.Categories, 3)
|
||||
assert.Equal(t, model.SidebarCategoryFavorites, res.Categories[0].Type)
|
||||
assert.Equal(t, model.SidebarCategoryChannels, res.Categories[1].Type)
|
||||
assert.Equal(t, model.SidebarCategoryDirectMessages, res.Categories[2].Type)
|
||||
|
||||
res2, err := ss.Channel().GetSidebarCategories(userId, teamId2)
|
||||
res2, err := ss.Channel().GetSidebarCategoriesForTeamForUser(userId, teamId2)
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, res, res2)
|
||||
})
|
||||
@@ -93,20 +109,24 @@ func testCreateInitialSidebarCategories(t *testing.T, ss store.Store) {
|
||||
userId := model.NewId()
|
||||
teamId := model.NewId()
|
||||
|
||||
res, nErr := ss.Channel().CreateInitialSidebarCategories(userId, teamId)
|
||||
opts := &store.SidebarCategorySearchOpts{
|
||||
TeamID: teamId,
|
||||
ExcludeTeam: false,
|
||||
}
|
||||
res, nErr := ss.Channel().CreateInitialSidebarCategories(userId, opts)
|
||||
require.NoError(t, nErr)
|
||||
require.NotEmpty(t, res)
|
||||
|
||||
initialCategories, err := ss.Channel().GetSidebarCategories(userId, teamId)
|
||||
initialCategories, err := ss.Channel().GetSidebarCategoriesForTeamForUser(userId, teamId)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, res, initialCategories)
|
||||
|
||||
// Calling CreateInitialSidebarCategories a second time shouldn't create any new categories
|
||||
res, nErr = ss.Channel().CreateInitialSidebarCategories(userId, teamId)
|
||||
res, nErr = ss.Channel().CreateInitialSidebarCategories(userId, opts)
|
||||
assert.NoError(t, nErr)
|
||||
assert.NotEmpty(t, res)
|
||||
|
||||
res, err = ss.Channel().GetSidebarCategories(userId, teamId)
|
||||
res, err = ss.Channel().GetSidebarCategoriesForTeamForUser(userId, teamId)
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, initialCategories.Categories, res.Categories)
|
||||
})
|
||||
@@ -123,13 +143,17 @@ func testCreateInitialSidebarCategories(t *testing.T, ss store.Store) {
|
||||
go func() {
|
||||
defer wg.Done()
|
||||
|
||||
_, _ = ss.Channel().CreateInitialSidebarCategories(userId, teamId)
|
||||
opts := &store.SidebarCategorySearchOpts{
|
||||
TeamID: teamId,
|
||||
ExcludeTeam: false,
|
||||
}
|
||||
_, _ = ss.Channel().CreateInitialSidebarCategories(userId, opts)
|
||||
}()
|
||||
}
|
||||
|
||||
wg.Wait()
|
||||
|
||||
res, err := ss.Channel().GetSidebarCategories(userId, teamId)
|
||||
res, err := ss.Channel().GetSidebarCategoriesForTeamForUser(userId, teamId)
|
||||
assert.NoError(t, err)
|
||||
assert.Len(t, res.Categories, 3)
|
||||
})
|
||||
@@ -176,7 +200,11 @@ func testCreateInitialSidebarCategories(t *testing.T, ss store.Store) {
|
||||
require.NoError(t, nErr)
|
||||
|
||||
// Create the categories
|
||||
categories, nErr := ss.Channel().CreateInitialSidebarCategories(userId, teamId)
|
||||
opts := &store.SidebarCategorySearchOpts{
|
||||
TeamID: teamId,
|
||||
ExcludeTeam: false,
|
||||
}
|
||||
categories, nErr := ss.Channel().CreateInitialSidebarCategories(userId, opts)
|
||||
require.NoError(t, nErr)
|
||||
require.Len(t, categories.Categories, 3)
|
||||
assert.Equal(t, model.SidebarCategoryFavorites, categories.Categories[0].Type)
|
||||
@@ -185,7 +213,7 @@ func testCreateInitialSidebarCategories(t *testing.T, ss store.Store) {
|
||||
assert.Equal(t, []string{channel2.Id}, categories.Categories[1].Channels)
|
||||
|
||||
// Get and check the categories for channels
|
||||
categories2, nErr := ss.Channel().GetSidebarCategories(userId, teamId)
|
||||
categories2, nErr := ss.Channel().GetSidebarCategoriesForTeamForUser(userId, teamId)
|
||||
require.NoError(t, nErr)
|
||||
require.Equal(t, categories, categories2)
|
||||
})
|
||||
@@ -240,14 +268,18 @@ func testCreateInitialSidebarCategories(t *testing.T, ss store.Store) {
|
||||
require.NoError(t, nErr)
|
||||
|
||||
// Create the categories
|
||||
categories, nErr := ss.Channel().CreateInitialSidebarCategories(userId, teamId)
|
||||
opts := &store.SidebarCategorySearchOpts{
|
||||
TeamID: teamId,
|
||||
ExcludeTeam: false,
|
||||
}
|
||||
categories, nErr := ss.Channel().CreateInitialSidebarCategories(userId, opts)
|
||||
require.NoError(t, nErr)
|
||||
require.Len(t, categories.Categories, 3)
|
||||
assert.Equal(t, model.SidebarCategoryFavorites, categories.Categories[0].Type)
|
||||
assert.Equal(t, []string{channel2.Id, channel1.Id}, categories.Categories[0].Channels)
|
||||
|
||||
// Get and check the categories for channels
|
||||
categories2, nErr := ss.Channel().GetSidebarCategories(userId, teamId)
|
||||
categories2, nErr := ss.Channel().GetSidebarCategoriesForTeamForUser(userId, teamId)
|
||||
require.NoError(t, nErr)
|
||||
require.Equal(t, categories, categories2)
|
||||
})
|
||||
@@ -303,7 +335,11 @@ func testCreateInitialSidebarCategories(t *testing.T, ss store.Store) {
|
||||
require.NoError(t, err)
|
||||
|
||||
// Create the categories
|
||||
categories, nErr := ss.Channel().CreateInitialSidebarCategories(userId, teamId)
|
||||
opts := &store.SidebarCategorySearchOpts{
|
||||
TeamID: teamId,
|
||||
ExcludeTeam: false,
|
||||
}
|
||||
categories, nErr := ss.Channel().CreateInitialSidebarCategories(userId, opts)
|
||||
require.NoError(t, nErr)
|
||||
require.Len(t, categories.Categories, 3)
|
||||
assert.Equal(t, model.SidebarCategoryFavorites, categories.Categories[0].Type)
|
||||
@@ -312,7 +348,7 @@ func testCreateInitialSidebarCategories(t *testing.T, ss store.Store) {
|
||||
assert.Equal(t, []string{dmChannel2.Id}, categories.Categories[2].Channels)
|
||||
|
||||
// Get and check the categories for channels
|
||||
categories2, err := ss.Channel().GetSidebarCategories(userId, teamId)
|
||||
categories2, err := ss.Channel().GetSidebarCategoriesForTeamForUser(userId, teamId)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, categories, categories2)
|
||||
})
|
||||
@@ -347,7 +383,11 @@ func testCreateInitialSidebarCategories(t *testing.T, ss store.Store) {
|
||||
require.NoError(t, nErr)
|
||||
|
||||
// Create the categories
|
||||
categories, nErr := ss.Channel().CreateInitialSidebarCategories(userId, teamId)
|
||||
opts := &store.SidebarCategorySearchOpts{
|
||||
TeamID: teamId,
|
||||
ExcludeTeam: false,
|
||||
}
|
||||
categories, nErr := ss.Channel().CreateInitialSidebarCategories(userId, opts)
|
||||
require.NoError(t, nErr)
|
||||
require.Len(t, categories.Categories, 3)
|
||||
assert.Equal(t, model.SidebarCategoryFavorites, categories.Categories[0].Type)
|
||||
@@ -356,10 +396,54 @@ func testCreateInitialSidebarCategories(t *testing.T, ss store.Store) {
|
||||
assert.Equal(t, []string{}, categories.Categories[1].Channels)
|
||||
|
||||
// Get and check the categories for channels
|
||||
categories2, nErr := ss.Channel().GetSidebarCategories(userId, teamId)
|
||||
categories2, nErr := ss.Channel().GetSidebarCategoriesForTeamForUser(userId, teamId)
|
||||
require.NoError(t, nErr)
|
||||
require.Equal(t, categories, categories2)
|
||||
})
|
||||
|
||||
t.Run("graphQL path to create initial favorites/channels/DMs categories on different teams", func(t *testing.T) {
|
||||
userId := model.NewId()
|
||||
|
||||
t1 := &model.Team{
|
||||
DisplayName: "DisplayName",
|
||||
Name: NewTestId(),
|
||||
Email: MakeEmail(),
|
||||
Type: model.TeamOpen,
|
||||
InviteId: model.NewId(),
|
||||
}
|
||||
t1, err := ss.Team().Save(t1)
|
||||
require.NoError(t, err)
|
||||
|
||||
m1 := &model.TeamMember{TeamId: t1.Id, UserId: userId}
|
||||
_, nErr := ss.Team().SaveMember(m1, -1)
|
||||
require.NoError(t, nErr)
|
||||
|
||||
t2 := &model.Team{
|
||||
DisplayName: "DisplayName2",
|
||||
Name: NewTestId(),
|
||||
Email: MakeEmail(),
|
||||
Type: model.TeamOpen,
|
||||
InviteId: model.NewId(),
|
||||
}
|
||||
t2, err = ss.Team().Save(t2)
|
||||
require.NoError(t, err)
|
||||
|
||||
m2 := &model.TeamMember{TeamId: t2.Id, UserId: userId}
|
||||
_, nErr = ss.Team().SaveMember(m2, -1)
|
||||
require.NoError(t, nErr)
|
||||
|
||||
opts := &store.SidebarCategorySearchOpts{
|
||||
TeamID: t1.Id,
|
||||
ExcludeTeam: true,
|
||||
}
|
||||
res, nErr := ss.Channel().CreateInitialSidebarCategories(userId, opts)
|
||||
require.NoError(t, nErr)
|
||||
require.NotEmpty(t, res)
|
||||
|
||||
for _, cat := range res.Categories {
|
||||
assert.Equal(t, t2.Id, cat.TeamId)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
func testCreateSidebarCategory(t *testing.T, ss store.Store) {
|
||||
@@ -383,7 +467,11 @@ func testCreateSidebarCategory(t *testing.T, ss store.Store) {
|
||||
userId := model.NewId()
|
||||
teamId := model.NewId()
|
||||
|
||||
res, nErr := ss.Channel().CreateInitialSidebarCategories(userId, teamId)
|
||||
opts := &store.SidebarCategorySearchOpts{
|
||||
TeamID: teamId,
|
||||
ExcludeTeam: false,
|
||||
}
|
||||
res, nErr := ss.Channel().CreateInitialSidebarCategories(userId, opts)
|
||||
require.NoError(t, nErr)
|
||||
require.NotEmpty(t, res)
|
||||
|
||||
@@ -396,7 +484,7 @@ func testCreateSidebarCategory(t *testing.T, ss store.Store) {
|
||||
require.NoError(t, err)
|
||||
|
||||
// Confirm that it comes second
|
||||
res, err = ss.Channel().GetSidebarCategories(userId, teamId)
|
||||
res, err = ss.Channel().GetSidebarCategoriesForTeamForUser(userId, teamId)
|
||||
require.NoError(t, err)
|
||||
require.Len(t, res.Categories, 4)
|
||||
assert.Equal(t, model.SidebarCategoryFavorites, res.Categories[0].Type)
|
||||
@@ -408,12 +496,16 @@ func testCreateSidebarCategory(t *testing.T, ss store.Store) {
|
||||
userId := model.NewId()
|
||||
teamId := model.NewId()
|
||||
|
||||
res, nErr := ss.Channel().CreateInitialSidebarCategories(userId, teamId)
|
||||
opts := &store.SidebarCategorySearchOpts{
|
||||
TeamID: teamId,
|
||||
ExcludeTeam: false,
|
||||
}
|
||||
res, nErr := ss.Channel().CreateInitialSidebarCategories(userId, opts)
|
||||
require.NoError(t, nErr)
|
||||
require.NotEmpty(t, res)
|
||||
|
||||
// Re-arrange the categories so that Favorites comes last
|
||||
categories, err := ss.Channel().GetSidebarCategories(userId, teamId)
|
||||
categories, err := ss.Channel().GetSidebarCategoriesForTeamForUser(userId, teamId)
|
||||
require.NoError(t, err)
|
||||
require.Len(t, categories.Categories, 3)
|
||||
require.Equal(t, model.SidebarCategoryFavorites, categories.Categories[0].Type)
|
||||
@@ -434,7 +526,7 @@ func testCreateSidebarCategory(t *testing.T, ss store.Store) {
|
||||
require.NoError(t, err)
|
||||
|
||||
// Confirm that it comes first
|
||||
res, err = ss.Channel().GetSidebarCategories(userId, teamId)
|
||||
res, err = ss.Channel().GetSidebarCategoriesForTeamForUser(userId, teamId)
|
||||
require.NoError(t, err)
|
||||
require.Len(t, res.Categories, 4)
|
||||
assert.Equal(t, model.SidebarCategoryCustom, res.Categories[0].Type)
|
||||
@@ -445,7 +537,11 @@ func testCreateSidebarCategory(t *testing.T, ss store.Store) {
|
||||
userId := model.NewId()
|
||||
teamId := model.NewId()
|
||||
|
||||
res, nErr := ss.Channel().CreateInitialSidebarCategories(userId, teamId)
|
||||
opts := &store.SidebarCategorySearchOpts{
|
||||
TeamID: teamId,
|
||||
ExcludeTeam: false,
|
||||
}
|
||||
res, nErr := ss.Channel().CreateInitialSidebarCategories(userId, opts)
|
||||
require.NoError(t, nErr)
|
||||
require.NotEmpty(t, res)
|
||||
|
||||
@@ -483,11 +579,15 @@ func testCreateSidebarCategory(t *testing.T, ss store.Store) {
|
||||
userId := model.NewId()
|
||||
teamId := model.NewId()
|
||||
|
||||
res, nErr := ss.Channel().CreateInitialSidebarCategories(userId, teamId)
|
||||
opts := &store.SidebarCategorySearchOpts{
|
||||
TeamID: teamId,
|
||||
ExcludeTeam: false,
|
||||
}
|
||||
res, nErr := ss.Channel().CreateInitialSidebarCategories(userId, opts)
|
||||
require.NoError(t, nErr)
|
||||
require.NotEmpty(t, res)
|
||||
|
||||
categories, err := ss.Channel().GetSidebarCategories(userId, teamId)
|
||||
categories, err := ss.Channel().GetSidebarCategoriesForTeamForUser(userId, teamId)
|
||||
require.NoError(t, err)
|
||||
require.Len(t, categories.Categories, 3)
|
||||
|
||||
@@ -549,7 +649,11 @@ func testGetSidebarCategory(t *testing.T, ss store.Store, s SqlStore) {
|
||||
channelId2 := model.NewId()
|
||||
channelId3 := model.NewId()
|
||||
|
||||
res, nErr := ss.Channel().CreateInitialSidebarCategories(userId, teamId)
|
||||
opts := &store.SidebarCategorySearchOpts{
|
||||
TeamID: teamId,
|
||||
ExcludeTeam: false,
|
||||
}
|
||||
res, nErr := ss.Channel().CreateInitialSidebarCategories(userId, opts)
|
||||
require.NoError(t, nErr)
|
||||
require.NotEmpty(t, res)
|
||||
|
||||
@@ -579,11 +683,15 @@ func testGetSidebarCategory(t *testing.T, ss store.Store, s SqlStore) {
|
||||
teamId := model.NewId()
|
||||
|
||||
// Create the initial categories and find the channels category
|
||||
res, nErr := ss.Channel().CreateInitialSidebarCategories(userId, teamId)
|
||||
opts := &store.SidebarCategorySearchOpts{
|
||||
TeamID: teamId,
|
||||
ExcludeTeam: false,
|
||||
}
|
||||
res, nErr := ss.Channel().CreateInitialSidebarCategories(userId, opts)
|
||||
require.NoError(t, nErr)
|
||||
require.NotEmpty(t, res)
|
||||
|
||||
categories, err := ss.Channel().GetSidebarCategories(userId, teamId)
|
||||
categories, err := ss.Channel().GetSidebarCategoriesForTeamForUser(userId, teamId)
|
||||
require.NoError(t, err)
|
||||
|
||||
channelsCategory := categories.Categories[1]
|
||||
@@ -643,11 +751,15 @@ func testGetSidebarCategory(t *testing.T, ss store.Store, s SqlStore) {
|
||||
teamId := model.NewId()
|
||||
|
||||
// Create the initial categories and find the channels category
|
||||
res, nErr := ss.Channel().CreateInitialSidebarCategories(userId, teamId)
|
||||
opts := &store.SidebarCategorySearchOpts{
|
||||
TeamID: teamId,
|
||||
ExcludeTeam: false,
|
||||
}
|
||||
res, nErr := ss.Channel().CreateInitialSidebarCategories(userId, opts)
|
||||
require.NoError(t, nErr)
|
||||
require.NotEmpty(t, res)
|
||||
|
||||
categories, err := ss.Channel().GetSidebarCategories(userId, teamId)
|
||||
categories, err := ss.Channel().GetSidebarCategoriesForTeamForUser(userId, teamId)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, model.SidebarCategoryChannels, categories.Categories[1].Type)
|
||||
|
||||
@@ -681,12 +793,16 @@ func testGetSidebarCategory(t *testing.T, ss store.Store, s SqlStore) {
|
||||
userId := model.NewId()
|
||||
teamId := model.NewId()
|
||||
|
||||
opts := &store.SidebarCategorySearchOpts{
|
||||
TeamID: teamId,
|
||||
ExcludeTeam: false,
|
||||
}
|
||||
// Create the initial categories and find the channels category
|
||||
res, nErr := ss.Channel().CreateInitialSidebarCategories(userId, teamId)
|
||||
res, nErr := ss.Channel().CreateInitialSidebarCategories(userId, opts)
|
||||
require.NoError(t, nErr)
|
||||
require.NotEmpty(t, res)
|
||||
|
||||
categories, err := ss.Channel().GetSidebarCategories(userId, teamId)
|
||||
categories, err := ss.Channel().GetSidebarCategoriesForTeamForUser(userId, teamId)
|
||||
require.NoError(t, err)
|
||||
|
||||
favoritesCategory := categories.Categories[0]
|
||||
@@ -745,11 +861,15 @@ func testGetSidebarCategory(t *testing.T, ss store.Store, s SqlStore) {
|
||||
teamId := model.NewId()
|
||||
|
||||
// Create the initial categories and find the DMs category
|
||||
res, nErr := ss.Channel().CreateInitialSidebarCategories(userId, teamId)
|
||||
opts := &store.SidebarCategorySearchOpts{
|
||||
TeamID: teamId,
|
||||
ExcludeTeam: false,
|
||||
}
|
||||
res, nErr := ss.Channel().CreateInitialSidebarCategories(userId, opts)
|
||||
require.NoError(t, nErr)
|
||||
require.NotEmpty(t, res)
|
||||
|
||||
categories, err := ss.Channel().GetSidebarCategories(userId, teamId)
|
||||
categories, err := ss.Channel().GetSidebarCategoriesForTeamForUser(userId, teamId)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, model.SidebarCategoryDirectMessages, categories.Categories[2].Type)
|
||||
|
||||
@@ -786,11 +906,15 @@ func testGetSidebarCategory(t *testing.T, ss store.Store, s SqlStore) {
|
||||
teamId := model.NewId()
|
||||
|
||||
// Create the initial categories and find the DMs category
|
||||
res, nErr := ss.Channel().CreateInitialSidebarCategories(userId, teamId)
|
||||
opts := &store.SidebarCategorySearchOpts{
|
||||
TeamID: teamId,
|
||||
ExcludeTeam: false,
|
||||
}
|
||||
res, nErr := ss.Channel().CreateInitialSidebarCategories(userId, opts)
|
||||
require.NoError(t, nErr)
|
||||
require.NotEmpty(t, res)
|
||||
|
||||
categories, err := ss.Channel().GetSidebarCategories(userId, teamId)
|
||||
categories, err := ss.Channel().GetSidebarCategoriesForTeamForUser(userId, teamId)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, model.SidebarCategoryDirectMessages, categories.Categories[2].Type)
|
||||
|
||||
@@ -824,11 +948,15 @@ func testGetSidebarCategory(t *testing.T, ss store.Store, s SqlStore) {
|
||||
teamId := model.NewId()
|
||||
|
||||
// Create the initial categories and find the DMs category
|
||||
res, nErr := ss.Channel().CreateInitialSidebarCategories(userId, teamId)
|
||||
opts := &store.SidebarCategorySearchOpts{
|
||||
TeamID: teamId,
|
||||
ExcludeTeam: false,
|
||||
}
|
||||
res, nErr := ss.Channel().CreateInitialSidebarCategories(userId, opts)
|
||||
require.NoError(t, nErr)
|
||||
require.NotEmpty(t, res)
|
||||
|
||||
categories, err := ss.Channel().GetSidebarCategories(userId, teamId)
|
||||
categories, err := ss.Channel().GetSidebarCategoriesForTeamForUser(userId, teamId)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, model.SidebarCategoryDirectMessages, categories.Categories[2].Type)
|
||||
|
||||
@@ -854,8 +982,11 @@ func testGetSidebarCategory(t *testing.T, ss store.Store, s SqlStore) {
|
||||
|
||||
// Create another team and assign the DM to a custom category on that team
|
||||
otherTeamId := model.NewId()
|
||||
|
||||
res, nErr = ss.Channel().CreateInitialSidebarCategories(userId, otherTeamId)
|
||||
opts = &store.SidebarCategorySearchOpts{
|
||||
TeamID: otherTeamId,
|
||||
ExcludeTeam: false,
|
||||
}
|
||||
res, nErr = ss.Channel().CreateInitialSidebarCategories(userId, opts)
|
||||
require.NoError(t, nErr)
|
||||
require.NotEmpty(t, res)
|
||||
|
||||
@@ -882,7 +1013,11 @@ func testGetSidebarCategories(t *testing.T, ss store.Store) {
|
||||
userId := model.NewId()
|
||||
teamId := model.NewId()
|
||||
|
||||
res, nErr := ss.Channel().CreateInitialSidebarCategories(userId, teamId)
|
||||
opts := &store.SidebarCategorySearchOpts{
|
||||
TeamID: teamId,
|
||||
ExcludeTeam: false,
|
||||
}
|
||||
res, nErr := ss.Channel().CreateInitialSidebarCategories(userId, opts)
|
||||
require.NoError(t, nErr)
|
||||
require.NotEmpty(t, res)
|
||||
|
||||
@@ -901,7 +1036,7 @@ func testGetSidebarCategories(t *testing.T, ss store.Store) {
|
||||
gotCategory, err := ss.Channel().GetSidebarCategory(newCategory.Id)
|
||||
require.NoError(t, err)
|
||||
|
||||
res, err = ss.Channel().GetSidebarCategories(userId, teamId)
|
||||
res, err = ss.Channel().GetSidebarCategoriesForTeamForUser(userId, teamId)
|
||||
require.NoError(t, err)
|
||||
require.Len(t, res.Categories, 4)
|
||||
|
||||
@@ -920,11 +1055,15 @@ func testUpdateSidebarCategories(t *testing.T, ss store.Store) {
|
||||
teamId := model.NewId()
|
||||
|
||||
// Create the initial categories
|
||||
res, err := ss.Channel().CreateInitialSidebarCategories(userId, teamId)
|
||||
opts := &store.SidebarCategorySearchOpts{
|
||||
TeamID: teamId,
|
||||
ExcludeTeam: false,
|
||||
}
|
||||
res, err := ss.Channel().CreateInitialSidebarCategories(userId, opts)
|
||||
require.NoError(t, err)
|
||||
require.NotEmpty(t, res)
|
||||
|
||||
initialCategories, err := ss.Channel().GetSidebarCategories(userId, teamId)
|
||||
initialCategories, err := ss.Channel().GetSidebarCategoriesForTeamForUser(userId, teamId)
|
||||
require.NoError(t, err)
|
||||
|
||||
favoritesCategory := initialCategories.Categories[0]
|
||||
@@ -954,11 +1093,15 @@ func testUpdateSidebarCategories(t *testing.T, ss store.Store) {
|
||||
teamId := model.NewId()
|
||||
|
||||
// Create the initial categories
|
||||
res, err := ss.Channel().CreateInitialSidebarCategories(userId, teamId)
|
||||
opts := &store.SidebarCategorySearchOpts{
|
||||
TeamID: teamId,
|
||||
ExcludeTeam: false,
|
||||
}
|
||||
res, err := ss.Channel().CreateInitialSidebarCategories(userId, opts)
|
||||
require.NoError(t, err)
|
||||
require.NotEmpty(t, res)
|
||||
|
||||
initialCategories, err := ss.Channel().GetSidebarCategories(userId, teamId)
|
||||
initialCategories, err := ss.Channel().GetSidebarCategoriesForTeamForUser(userId, teamId)
|
||||
require.NoError(t, err)
|
||||
|
||||
favoritesCategory := initialCategories.Categories[0]
|
||||
@@ -981,11 +1124,15 @@ func testUpdateSidebarCategories(t *testing.T, ss store.Store) {
|
||||
userId := model.NewId()
|
||||
teamId := model.NewId()
|
||||
|
||||
res, nErr := ss.Channel().CreateInitialSidebarCategories(userId, teamId)
|
||||
opts := &store.SidebarCategorySearchOpts{
|
||||
TeamID: teamId,
|
||||
ExcludeTeam: false,
|
||||
}
|
||||
res, nErr := ss.Channel().CreateInitialSidebarCategories(userId, opts)
|
||||
require.NoError(t, nErr)
|
||||
require.NotEmpty(t, res)
|
||||
|
||||
initialCategories, err := ss.Channel().GetSidebarCategories(userId, teamId)
|
||||
initialCategories, err := ss.Channel().GetSidebarCategoriesForTeamForUser(userId, teamId)
|
||||
require.NoError(t, err)
|
||||
|
||||
favoritesCategory := initialCategories.Categories[0]
|
||||
@@ -1048,11 +1195,15 @@ func testUpdateSidebarCategories(t *testing.T, ss store.Store) {
|
||||
teamId := model.NewId()
|
||||
|
||||
// Create the initial categories and find the favorites category
|
||||
res, nErr := ss.Channel().CreateInitialSidebarCategories(userId, teamId)
|
||||
opts := &store.SidebarCategorySearchOpts{
|
||||
TeamID: teamId,
|
||||
ExcludeTeam: false,
|
||||
}
|
||||
res, nErr := ss.Channel().CreateInitialSidebarCategories(userId, opts)
|
||||
require.NoError(t, nErr)
|
||||
require.NotEmpty(t, res)
|
||||
|
||||
categories, err := ss.Channel().GetSidebarCategories(userId, teamId)
|
||||
categories, err := ss.Channel().GetSidebarCategoriesForTeamForUser(userId, teamId)
|
||||
require.NoError(t, err)
|
||||
|
||||
favoritesCategory := categories.Categories[0]
|
||||
@@ -1109,11 +1260,15 @@ func testUpdateSidebarCategories(t *testing.T, ss store.Store) {
|
||||
teamId := model.NewId()
|
||||
|
||||
// Create the initial categories and find the favorites category
|
||||
res, nErr := ss.Channel().CreateInitialSidebarCategories(userId, teamId)
|
||||
opts := &store.SidebarCategorySearchOpts{
|
||||
TeamID: teamId,
|
||||
ExcludeTeam: false,
|
||||
}
|
||||
res, nErr := ss.Channel().CreateInitialSidebarCategories(userId, opts)
|
||||
require.NoError(t, nErr)
|
||||
require.NotEmpty(t, res)
|
||||
|
||||
categories, err := ss.Channel().GetSidebarCategories(userId, teamId)
|
||||
categories, err := ss.Channel().GetSidebarCategoriesForTeamForUser(userId, teamId)
|
||||
require.NoError(t, err)
|
||||
|
||||
favoritesCategory := categories.Categories[0]
|
||||
@@ -1176,21 +1331,29 @@ func testUpdateSidebarCategories(t *testing.T, ss store.Store) {
|
||||
teamId2 := model.NewId()
|
||||
|
||||
// Create the initial categories and find the favorites categories in each team
|
||||
res, nErr := ss.Channel().CreateInitialSidebarCategories(userId, teamId)
|
||||
opts := &store.SidebarCategorySearchOpts{
|
||||
TeamID: teamId,
|
||||
ExcludeTeam: false,
|
||||
}
|
||||
res, nErr := ss.Channel().CreateInitialSidebarCategories(userId, opts)
|
||||
require.NoError(t, nErr)
|
||||
require.NotEmpty(t, res)
|
||||
|
||||
categories, err := ss.Channel().GetSidebarCategories(userId, teamId)
|
||||
categories, err := ss.Channel().GetSidebarCategoriesForTeamForUser(userId, teamId)
|
||||
require.NoError(t, err)
|
||||
|
||||
favoritesCategory := categories.Categories[0]
|
||||
require.Equal(t, model.SidebarCategoryFavorites, favoritesCategory.Type)
|
||||
|
||||
res, nErr = ss.Channel().CreateInitialSidebarCategories(userId, teamId2)
|
||||
opts = &store.SidebarCategorySearchOpts{
|
||||
TeamID: teamId2,
|
||||
ExcludeTeam: false,
|
||||
}
|
||||
res, nErr = ss.Channel().CreateInitialSidebarCategories(userId, opts)
|
||||
require.NoError(t, nErr)
|
||||
require.NotEmpty(t, res)
|
||||
|
||||
categories2, err := ss.Channel().GetSidebarCategories(userId, teamId2)
|
||||
categories2, err := ss.Channel().GetSidebarCategoriesForTeamForUser(userId, teamId2)
|
||||
require.NoError(t, err)
|
||||
|
||||
favoritesCategory2 := categories2.Categories[0]
|
||||
@@ -1276,11 +1439,15 @@ func testUpdateSidebarCategories(t *testing.T, ss store.Store) {
|
||||
teamId := model.NewId()
|
||||
|
||||
// Create the initial categories and find the favorites category
|
||||
res, nErr := ss.Channel().CreateInitialSidebarCategories(userId, teamId)
|
||||
opts := &store.SidebarCategorySearchOpts{
|
||||
TeamID: teamId,
|
||||
ExcludeTeam: false,
|
||||
}
|
||||
res, nErr := ss.Channel().CreateInitialSidebarCategories(userId, opts)
|
||||
require.NoError(t, nErr)
|
||||
require.NotEmpty(t, res)
|
||||
|
||||
categories, err := ss.Channel().GetSidebarCategories(userId, teamId)
|
||||
categories, err := ss.Channel().GetSidebarCategoriesForTeamForUser(userId, teamId)
|
||||
require.NoError(t, err)
|
||||
|
||||
favoritesCategory := categories.Categories[0]
|
||||
@@ -1291,11 +1458,11 @@ func testUpdateSidebarCategories(t *testing.T, ss store.Store) {
|
||||
// Create the other users' categories
|
||||
userId2 := model.NewId()
|
||||
|
||||
res, nErr = ss.Channel().CreateInitialSidebarCategories(userId2, teamId)
|
||||
res, nErr = ss.Channel().CreateInitialSidebarCategories(userId2, opts)
|
||||
require.NoError(t, nErr)
|
||||
require.NotEmpty(t, res)
|
||||
|
||||
categories2, err := ss.Channel().GetSidebarCategories(userId2, teamId)
|
||||
categories2, err := ss.Channel().GetSidebarCategoriesForTeamForUser(userId2, teamId)
|
||||
require.NoError(t, err)
|
||||
|
||||
favoritesCategory2 := categories2.Categories[0]
|
||||
@@ -1447,12 +1614,16 @@ func testUpdateSidebarCategories(t *testing.T, ss store.Store) {
|
||||
)
|
||||
require.NoError(t, nErr)
|
||||
|
||||
res, nErr := ss.Channel().CreateInitialSidebarCategories(userId, teamId)
|
||||
opts := &store.SidebarCategorySearchOpts{
|
||||
TeamID: teamId,
|
||||
ExcludeTeam: false,
|
||||
}
|
||||
res, nErr := ss.Channel().CreateInitialSidebarCategories(userId, opts)
|
||||
require.NoError(t, nErr)
|
||||
require.NotEmpty(t, res)
|
||||
|
||||
// And some categories
|
||||
initialCategories, nErr := ss.Channel().GetSidebarCategories(userId, teamId)
|
||||
initialCategories, nErr := ss.Channel().GetSidebarCategoriesForTeamForUser(userId, teamId)
|
||||
require.NoError(t, nErr)
|
||||
|
||||
channelsCategory := initialCategories.Categories[1]
|
||||
@@ -1502,12 +1673,16 @@ func testUpdateSidebarCategories(t *testing.T, ss store.Store) {
|
||||
)
|
||||
require.NoError(t, nErr)
|
||||
|
||||
res, nErr := ss.Channel().CreateInitialSidebarCategories(userId, teamId)
|
||||
opts := &store.SidebarCategorySearchOpts{
|
||||
TeamID: teamId,
|
||||
ExcludeTeam: false,
|
||||
}
|
||||
res, nErr := ss.Channel().CreateInitialSidebarCategories(userId, opts)
|
||||
require.NoError(t, nErr)
|
||||
require.NotEmpty(t, res)
|
||||
|
||||
// The DM should start in the DMs category
|
||||
initialCategories, err := ss.Channel().GetSidebarCategories(userId, teamId)
|
||||
initialCategories, err := ss.Channel().GetSidebarCategoriesForTeamForUser(userId, teamId)
|
||||
require.NoError(t, err)
|
||||
|
||||
dmsCategory := initialCategories.Categories[2]
|
||||
@@ -1590,11 +1765,15 @@ func testUpdateSidebarCategories(t *testing.T, ss store.Store) {
|
||||
require.NoError(t, err)
|
||||
|
||||
// And then create the initial categories so that it includes the channel
|
||||
res, nErr := ss.Channel().CreateInitialSidebarCategories(userId, teamId)
|
||||
opts := &store.SidebarCategorySearchOpts{
|
||||
TeamID: teamId,
|
||||
ExcludeTeam: false,
|
||||
}
|
||||
res, nErr := ss.Channel().CreateInitialSidebarCategories(userId, opts)
|
||||
require.NoError(t, nErr)
|
||||
require.NotEmpty(t, res)
|
||||
|
||||
initialCategories, nErr := ss.Channel().GetSidebarCategories(userId, teamId)
|
||||
initialCategories, nErr := ss.Channel().GetSidebarCategoriesForTeamForUser(userId, teamId)
|
||||
require.NoError(t, nErr)
|
||||
|
||||
channelsCategory := initialCategories.Categories[1]
|
||||
@@ -1654,11 +1833,15 @@ func testUpdateSidebarCategories(t *testing.T, ss store.Store) {
|
||||
require.NoError(t, err)
|
||||
|
||||
// And then create the initial categories so that Channels includes the channel
|
||||
res, nErr := ss.Channel().CreateInitialSidebarCategories(userId, teamId)
|
||||
opts := &store.SidebarCategorySearchOpts{
|
||||
TeamID: teamId,
|
||||
ExcludeTeam: false,
|
||||
}
|
||||
res, nErr := ss.Channel().CreateInitialSidebarCategories(userId, opts)
|
||||
require.NoError(t, nErr)
|
||||
require.NotEmpty(t, res)
|
||||
|
||||
initialCategories, nErr := ss.Channel().GetSidebarCategories(userId, teamId)
|
||||
initialCategories, nErr := ss.Channel().GetSidebarCategoriesForTeamForUser(userId, teamId)
|
||||
require.NoError(t, nErr)
|
||||
|
||||
channelsCategory := initialCategories.Categories[1]
|
||||
@@ -1712,11 +1895,15 @@ func setupInitialSidebarCategories(t *testing.T, ss store.Store) (string, string
|
||||
userId := model.NewId()
|
||||
teamId := model.NewId()
|
||||
|
||||
res, nErr := ss.Channel().CreateInitialSidebarCategories(userId, teamId)
|
||||
opts := &store.SidebarCategorySearchOpts{
|
||||
TeamID: teamId,
|
||||
ExcludeTeam: false,
|
||||
}
|
||||
res, nErr := ss.Channel().CreateInitialSidebarCategories(userId, opts)
|
||||
require.NoError(t, nErr)
|
||||
require.NotEmpty(t, res)
|
||||
|
||||
res, err := ss.Channel().GetSidebarCategories(userId, teamId)
|
||||
res, err := ss.Channel().GetSidebarCategoriesForTeamForUser(userId, teamId)
|
||||
require.NoError(t, err)
|
||||
require.Len(t, res.Categories, 3)
|
||||
|
||||
@@ -1835,11 +2022,15 @@ func testClearSidebarOnTeamLeave(t *testing.T, ss store.Store, s SqlStore) {
|
||||
// Create a second team and set up the sidebar categories for it
|
||||
teamId2 := model.NewId()
|
||||
|
||||
res, err := ss.Channel().CreateInitialSidebarCategories(userId, teamId2)
|
||||
opts := &store.SidebarCategorySearchOpts{
|
||||
TeamID: teamId2,
|
||||
ExcludeTeam: false,
|
||||
}
|
||||
res, err := ss.Channel().CreateInitialSidebarCategories(userId, opts)
|
||||
require.NoError(t, err)
|
||||
require.NotEmpty(t, res)
|
||||
|
||||
res, err = ss.Channel().GetSidebarCategories(userId, teamId2)
|
||||
res, err = ss.Channel().GetSidebarCategoriesForTeamForUser(userId, teamId2)
|
||||
require.NoError(t, err)
|
||||
require.Len(t, res.Categories, 3)
|
||||
|
||||
@@ -1896,7 +2087,7 @@ func testClearSidebarOnTeamLeave(t *testing.T, ss store.Store, s SqlStore) {
|
||||
assert.Equal(t, int64(2), count)
|
||||
|
||||
// Confirm that the categories on the second team are unchanged
|
||||
res, err = ss.Channel().GetSidebarCategories(userId, teamId2)
|
||||
res, err = ss.Channel().GetSidebarCategoriesForTeamForUser(userId, teamId2)
|
||||
require.NoError(t, err)
|
||||
assert.Len(t, res.Categories, 4)
|
||||
|
||||
@@ -1915,7 +2106,7 @@ func testDeleteSidebarCategory(t *testing.T, ss store.Store, s SqlStore) {
|
||||
require.NotNil(t, newCategory)
|
||||
|
||||
// Ensure that the category was created properly
|
||||
res, err := ss.Channel().GetSidebarCategories(userId, teamId)
|
||||
res, err := ss.Channel().GetSidebarCategoriesForTeamForUser(userId, teamId)
|
||||
require.NoError(t, err)
|
||||
require.Len(t, res.Categories, 4)
|
||||
|
||||
@@ -1923,7 +2114,7 @@ func testDeleteSidebarCategory(t *testing.T, ss store.Store, s SqlStore) {
|
||||
err = ss.Channel().DeleteSidebarCategory(newCategory.Id)
|
||||
assert.NoError(t, err)
|
||||
|
||||
res, err = ss.Channel().GetSidebarCategories(userId, teamId)
|
||||
res, err = ss.Channel().GetSidebarCategoriesForTeamForUser(userId, teamId)
|
||||
require.NoError(t, err)
|
||||
require.Len(t, res.Categories, 3)
|
||||
})
|
||||
@@ -1967,7 +2158,7 @@ func testDeleteSidebarCategory(t *testing.T, ss store.Store, s SqlStore) {
|
||||
require.NotNil(t, newCategory)
|
||||
|
||||
// Ensure that the categories are set up correctly
|
||||
res, err := ss.Channel().GetSidebarCategories(userId, teamId)
|
||||
res, err := ss.Channel().GetSidebarCategoriesForTeamForUser(userId, teamId)
|
||||
require.NoError(t, err)
|
||||
require.Len(t, res.Categories, 4)
|
||||
|
||||
@@ -1979,7 +2170,7 @@ func testDeleteSidebarCategory(t *testing.T, ss store.Store, s SqlStore) {
|
||||
assert.NoError(t, err)
|
||||
|
||||
// Confirm that the category was deleted...
|
||||
res, err = ss.Channel().GetSidebarCategories(userId, teamId)
|
||||
res, err = ss.Channel().GetSidebarCategoriesForTeamForUser(userId, teamId)
|
||||
assert.NoError(t, err)
|
||||
assert.Len(t, res.Categories, 3)
|
||||
|
||||
@@ -1999,7 +2190,7 @@ func testDeleteSidebarCategory(t *testing.T, ss store.Store, s SqlStore) {
|
||||
t.Run("should not allow you to remove non-custom categories", func(t *testing.T) {
|
||||
userId, teamId := setupInitialSidebarCategories(t, ss)
|
||||
defer ss.User().PermanentDelete(userId)
|
||||
res, err := ss.Channel().GetSidebarCategories(userId, teamId)
|
||||
res, err := ss.Channel().GetSidebarCategoriesForTeamForUser(userId, teamId)
|
||||
require.NoError(t, err)
|
||||
require.Len(t, res.Categories, 3)
|
||||
require.Equal(t, model.SidebarCategoryFavorites, res.Categories[0].Type)
|
||||
@@ -2022,7 +2213,11 @@ func testUpdateSidebarChannelsByPreferences(t *testing.T, ss store.Store) {
|
||||
userId := model.NewId()
|
||||
teamId := model.NewId()
|
||||
|
||||
res, nErr := ss.Channel().CreateInitialSidebarCategories(userId, teamId)
|
||||
opts := &store.SidebarCategorySearchOpts{
|
||||
TeamID: teamId,
|
||||
ExcludeTeam: false,
|
||||
}
|
||||
res, nErr := ss.Channel().CreateInitialSidebarCategories(userId, opts)
|
||||
require.NoError(t, nErr)
|
||||
require.NotEmpty(t, res)
|
||||
|
||||
@@ -2047,7 +2242,11 @@ func testUpdateSidebarChannelsByPreferences(t *testing.T, ss store.Store) {
|
||||
userId := model.NewId()
|
||||
teamId := model.NewId()
|
||||
|
||||
res, nErr := ss.Channel().CreateInitialSidebarCategories(userId, teamId)
|
||||
opts := &store.SidebarCategorySearchOpts{
|
||||
TeamID: teamId,
|
||||
ExcludeTeam: false,
|
||||
}
|
||||
res, nErr := ss.Channel().CreateInitialSidebarCategories(userId, opts)
|
||||
assert.NoError(t, nErr)
|
||||
require.NotEmpty(t, res)
|
||||
|
||||
@@ -2085,11 +2284,15 @@ func testSidebarCategoryDeadlock(t *testing.T, ss store.Store) {
|
||||
require.NoError(t, err)
|
||||
|
||||
// And then create the initial categories so that it includes the channel
|
||||
res, err := ss.Channel().CreateInitialSidebarCategories(userID, teamID)
|
||||
opts := &store.SidebarCategorySearchOpts{
|
||||
TeamID: teamID,
|
||||
ExcludeTeam: false,
|
||||
}
|
||||
res, err := ss.Channel().CreateInitialSidebarCategories(userID, opts)
|
||||
require.NoError(t, err)
|
||||
require.NotEmpty(t, res)
|
||||
|
||||
initialCategories, err := ss.Channel().GetSidebarCategories(userID, teamID)
|
||||
initialCategories, err := ss.Channel().GetSidebarCategoriesForTeamForUser(userID, teamID)
|
||||
require.NoError(t, err)
|
||||
|
||||
channelsCategory := initialCategories.Categories[1]
|
||||
|
||||
@@ -222,13 +222,13 @@ func (_m *ChannelStore) CreateDirectChannel(userID *model.User, otherUserID *mod
|
||||
return r0, r1
|
||||
}
|
||||
|
||||
// CreateInitialSidebarCategories provides a mock function with given fields: userID, teamID
|
||||
func (_m *ChannelStore) CreateInitialSidebarCategories(userID string, teamID string) (*model.OrderedSidebarCategories, error) {
|
||||
ret := _m.Called(userID, teamID)
|
||||
// CreateInitialSidebarCategories provides a mock function with given fields: userID, opts
|
||||
func (_m *ChannelStore) CreateInitialSidebarCategories(userID string, opts *store.SidebarCategorySearchOpts) (*model.OrderedSidebarCategories, error) {
|
||||
ret := _m.Called(userID, opts)
|
||||
|
||||
var r0 *model.OrderedSidebarCategories
|
||||
if rf, ok := ret.Get(0).(func(string, string) *model.OrderedSidebarCategories); ok {
|
||||
r0 = rf(userID, teamID)
|
||||
if rf, ok := ret.Get(0).(func(string, *store.SidebarCategorySearchOpts) *model.OrderedSidebarCategories); ok {
|
||||
r0 = rf(userID, opts)
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).(*model.OrderedSidebarCategories)
|
||||
@@ -236,8 +236,8 @@ func (_m *ChannelStore) CreateInitialSidebarCategories(userID string, teamID str
|
||||
}
|
||||
|
||||
var r1 error
|
||||
if rf, ok := ret.Get(1).(func(string, string) error); ok {
|
||||
r1 = rf(userID, teamID)
|
||||
if rf, ok := ret.Get(1).(func(string, *store.SidebarCategorySearchOpts) error); ok {
|
||||
r1 = rf(userID, opts)
|
||||
} else {
|
||||
r1 = ret.Error(1)
|
||||
}
|
||||
@@ -1372,8 +1372,31 @@ func (_m *ChannelStore) GetPublicChannelsForTeam(teamID string, offset int, limi
|
||||
return r0, r1
|
||||
}
|
||||
|
||||
// GetSidebarCategories provides a mock function with given fields: userID, teamID
|
||||
func (_m *ChannelStore) GetSidebarCategories(userID string, teamID string) (*model.OrderedSidebarCategories, error) {
|
||||
// GetSidebarCategories provides a mock function with given fields: userID, opts
|
||||
func (_m *ChannelStore) GetSidebarCategories(userID string, opts *store.SidebarCategorySearchOpts) (*model.OrderedSidebarCategories, error) {
|
||||
ret := _m.Called(userID, opts)
|
||||
|
||||
var r0 *model.OrderedSidebarCategories
|
||||
if rf, ok := ret.Get(0).(func(string, *store.SidebarCategorySearchOpts) *model.OrderedSidebarCategories); ok {
|
||||
r0 = rf(userID, opts)
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).(*model.OrderedSidebarCategories)
|
||||
}
|
||||
}
|
||||
|
||||
var r1 error
|
||||
if rf, ok := ret.Get(1).(func(string, *store.SidebarCategorySearchOpts) error); ok {
|
||||
r1 = rf(userID, opts)
|
||||
} else {
|
||||
r1 = ret.Error(1)
|
||||
}
|
||||
|
||||
return r0, r1
|
||||
}
|
||||
|
||||
// GetSidebarCategoriesForTeamForUser provides a mock function with given fields: userID, teamID
|
||||
func (_m *ChannelStore) GetSidebarCategoriesForTeamForUser(userID string, teamID string) (*model.OrderedSidebarCategories, error) {
|
||||
ret := _m.Called(userID, teamID)
|
||||
|
||||
var r0 *model.OrderedSidebarCategories
|
||||
|
||||
Ссылка в новой задаче
Block a user