[MM-28985] Remove pointers to slice (part 1) (#18034)
* Remove pointers to slice (part 1) * Remove use of pointers to slice from model package (#18045) * Fix after merge
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
132f114793
Коммит
04b27ce93c
@@ -570,7 +570,7 @@ func (s *OpenTracingLayerChannelStore) AnalyticsTypeCount(teamID string, channel
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *OpenTracingLayerChannelStore) AutocompleteInTeam(teamID string, term string, includeDeleted bool) (*model.ChannelList, error) {
|
||||
func (s *OpenTracingLayerChannelStore) AutocompleteInTeam(teamID string, term string, includeDeleted bool) (model.ChannelList, error) {
|
||||
origCtx := s.Root.Store.Context()
|
||||
span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "ChannelStore.AutocompleteInTeam")
|
||||
s.Root.Store.SetContext(newCtx)
|
||||
@@ -588,7 +588,7 @@ func (s *OpenTracingLayerChannelStore) AutocompleteInTeam(teamID string, term st
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *OpenTracingLayerChannelStore) AutocompleteInTeamForSearch(teamID string, userID string, term string, includeDeleted bool) (*model.ChannelList, error) {
|
||||
func (s *OpenTracingLayerChannelStore) AutocompleteInTeamForSearch(teamID string, userID string, term string, includeDeleted bool) (model.ChannelList, error) {
|
||||
origCtx := s.Root.Store.Context()
|
||||
span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "ChannelStore.AutocompleteInTeamForSearch")
|
||||
s.Root.Store.SetContext(newCtx)
|
||||
@@ -763,7 +763,7 @@ func (s *OpenTracingLayerChannelStore) DeleteSidebarCategory(categoryID string)
|
||||
return err
|
||||
}
|
||||
|
||||
func (s *OpenTracingLayerChannelStore) DeleteSidebarChannelsByPreferences(preferences *model.Preferences) error {
|
||||
func (s *OpenTracingLayerChannelStore) DeleteSidebarChannelsByPreferences(preferences model.Preferences) error {
|
||||
origCtx := s.Root.Store.Context()
|
||||
span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "ChannelStore.DeleteSidebarChannelsByPreferences")
|
||||
s.Root.Store.SetContext(newCtx)
|
||||
@@ -853,7 +853,7 @@ func (s *OpenTracingLayerChannelStore) GetAllChannelMembersNotifyPropsForChannel
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *OpenTracingLayerChannelStore) GetAllChannels(page int, perPage int, opts store.ChannelSearchOpts) (*model.ChannelListWithTeamData, error) {
|
||||
func (s *OpenTracingLayerChannelStore) GetAllChannels(page int, perPage int, opts store.ChannelSearchOpts) (model.ChannelListWithTeamData, error) {
|
||||
origCtx := s.Root.Store.Context()
|
||||
span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "ChannelStore.GetAllChannels")
|
||||
s.Root.Store.SetContext(newCtx)
|
||||
@@ -1051,7 +1051,7 @@ func (s *OpenTracingLayerChannelStore) GetChannelUnread(channelID string, userID
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *OpenTracingLayerChannelStore) GetChannels(teamID string, userID string, includeDeleted bool, lastDeleteAt int) (*model.ChannelList, error) {
|
||||
func (s *OpenTracingLayerChannelStore) GetChannels(teamID string, userID string, includeDeleted bool, lastDeleteAt int) (model.ChannelList, error) {
|
||||
origCtx := s.Root.Store.Context()
|
||||
span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "ChannelStore.GetChannels")
|
||||
s.Root.Store.SetContext(newCtx)
|
||||
@@ -1123,7 +1123,7 @@ func (s *OpenTracingLayerChannelStore) GetChannelsByScheme(schemeID string, offs
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *OpenTracingLayerChannelStore) GetDeleted(team_id string, offset int, limit int, userID string) (*model.ChannelList, error) {
|
||||
func (s *OpenTracingLayerChannelStore) GetDeleted(team_id string, offset int, limit int, userID string) (model.ChannelList, error) {
|
||||
origCtx := s.Root.Store.Context()
|
||||
span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "ChannelStore.GetDeleted")
|
||||
s.Root.Store.SetContext(newCtx)
|
||||
@@ -1298,7 +1298,7 @@ func (s *OpenTracingLayerChannelStore) GetMemberForPost(postID string, userID st
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *OpenTracingLayerChannelStore) GetMembers(channelID string, offset int, limit int) (*model.ChannelMembers, error) {
|
||||
func (s *OpenTracingLayerChannelStore) GetMembers(channelID string, offset int, limit int) (model.ChannelMembers, error) {
|
||||
origCtx := s.Root.Store.Context()
|
||||
span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "ChannelStore.GetMembers")
|
||||
s.Root.Store.SetContext(newCtx)
|
||||
@@ -1316,7 +1316,7 @@ func (s *OpenTracingLayerChannelStore) GetMembers(channelID string, offset int,
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *OpenTracingLayerChannelStore) GetMembersByChannelIds(channelIds []string, userID string) (*model.ChannelMembers, error) {
|
||||
func (s *OpenTracingLayerChannelStore) GetMembersByChannelIds(channelIds []string, userID string) (model.ChannelMembers, error) {
|
||||
origCtx := s.Root.Store.Context()
|
||||
span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "ChannelStore.GetMembersByChannelIds")
|
||||
s.Root.Store.SetContext(newCtx)
|
||||
@@ -1334,7 +1334,7 @@ func (s *OpenTracingLayerChannelStore) GetMembersByChannelIds(channelIds []strin
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *OpenTracingLayerChannelStore) GetMembersByIds(channelID string, userIds []string) (*model.ChannelMembers, error) {
|
||||
func (s *OpenTracingLayerChannelStore) GetMembersByIds(channelID string, userIds []string) (model.ChannelMembers, error) {
|
||||
origCtx := s.Root.Store.Context()
|
||||
span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "ChannelStore.GetMembersByIds")
|
||||
s.Root.Store.SetContext(newCtx)
|
||||
@@ -1352,7 +1352,7 @@ func (s *OpenTracingLayerChannelStore) GetMembersByIds(channelID string, userIds
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *OpenTracingLayerChannelStore) GetMembersForUser(teamID string, userID string) (*model.ChannelMembers, error) {
|
||||
func (s *OpenTracingLayerChannelStore) GetMembersForUser(teamID string, userID string) (model.ChannelMembers, error) {
|
||||
origCtx := s.Root.Store.Context()
|
||||
span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "ChannelStore.GetMembersForUser")
|
||||
s.Root.Store.SetContext(newCtx)
|
||||
@@ -1370,7 +1370,7 @@ func (s *OpenTracingLayerChannelStore) GetMembersForUser(teamID string, userID s
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *OpenTracingLayerChannelStore) GetMembersForUserWithPagination(teamID string, userID string, page int, perPage int) (*model.ChannelMembers, error) {
|
||||
func (s *OpenTracingLayerChannelStore) GetMembersForUserWithPagination(teamID string, userID string, page int, perPage int) (model.ChannelMembers, error) {
|
||||
origCtx := s.Root.Store.Context()
|
||||
span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "ChannelStore.GetMembersForUserWithPagination")
|
||||
s.Root.Store.SetContext(newCtx)
|
||||
@@ -1388,7 +1388,7 @@ func (s *OpenTracingLayerChannelStore) GetMembersForUserWithPagination(teamID st
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *OpenTracingLayerChannelStore) GetMoreChannels(teamID string, userID string, offset int, limit int) (*model.ChannelList, error) {
|
||||
func (s *OpenTracingLayerChannelStore) GetMoreChannels(teamID string, userID string, offset int, limit int) (model.ChannelList, error) {
|
||||
origCtx := s.Root.Store.Context()
|
||||
span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "ChannelStore.GetMoreChannels")
|
||||
s.Root.Store.SetContext(newCtx)
|
||||
@@ -1442,7 +1442,7 @@ func (s *OpenTracingLayerChannelStore) GetPinnedPosts(channelID string) (*model.
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *OpenTracingLayerChannelStore) GetPrivateChannelsForTeam(teamID string, offset int, limit int) (*model.ChannelList, error) {
|
||||
func (s *OpenTracingLayerChannelStore) GetPrivateChannelsForTeam(teamID string, offset int, limit int) (model.ChannelList, error) {
|
||||
origCtx := s.Root.Store.Context()
|
||||
span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "ChannelStore.GetPrivateChannelsForTeam")
|
||||
s.Root.Store.SetContext(newCtx)
|
||||
@@ -1460,7 +1460,7 @@ func (s *OpenTracingLayerChannelStore) GetPrivateChannelsForTeam(teamID string,
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *OpenTracingLayerChannelStore) GetPublicChannelsByIdsForTeam(teamID string, channelIds []string) (*model.ChannelList, error) {
|
||||
func (s *OpenTracingLayerChannelStore) GetPublicChannelsByIdsForTeam(teamID string, channelIds []string) (model.ChannelList, error) {
|
||||
origCtx := s.Root.Store.Context()
|
||||
span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "ChannelStore.GetPublicChannelsByIdsForTeam")
|
||||
s.Root.Store.SetContext(newCtx)
|
||||
@@ -1478,7 +1478,7 @@ func (s *OpenTracingLayerChannelStore) GetPublicChannelsByIdsForTeam(teamID stri
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *OpenTracingLayerChannelStore) GetPublicChannelsForTeam(teamID string, offset int, limit int) (*model.ChannelList, error) {
|
||||
func (s *OpenTracingLayerChannelStore) GetPublicChannelsForTeam(teamID string, offset int, limit int) (model.ChannelList, error) {
|
||||
origCtx := s.Root.Store.Context()
|
||||
span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "ChannelStore.GetPublicChannelsForTeam")
|
||||
s.Root.Store.SetContext(newCtx)
|
||||
@@ -1550,7 +1550,7 @@ func (s *OpenTracingLayerChannelStore) GetSidebarCategoryOrder(userID string, te
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *OpenTracingLayerChannelStore) GetTeamChannels(teamID string) (*model.ChannelList, error) {
|
||||
func (s *OpenTracingLayerChannelStore) GetTeamChannels(teamID string) (model.ChannelList, error) {
|
||||
origCtx := s.Root.Store.Context()
|
||||
span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "ChannelStore.GetTeamChannels")
|
||||
s.Root.Store.SetContext(newCtx)
|
||||
@@ -1996,7 +1996,7 @@ func (s *OpenTracingLayerChannelStore) SaveMultipleMembers(members []*model.Chan
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *OpenTracingLayerChannelStore) SearchAllChannels(term string, opts store.ChannelSearchOpts) (*model.ChannelListWithTeamData, int64, error) {
|
||||
func (s *OpenTracingLayerChannelStore) SearchAllChannels(term string, opts store.ChannelSearchOpts) (model.ChannelListWithTeamData, int64, error) {
|
||||
origCtx := s.Root.Store.Context()
|
||||
span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "ChannelStore.SearchAllChannels")
|
||||
s.Root.Store.SetContext(newCtx)
|
||||
@@ -2014,7 +2014,7 @@ func (s *OpenTracingLayerChannelStore) SearchAllChannels(term string, opts store
|
||||
return result, resultVar1, err
|
||||
}
|
||||
|
||||
func (s *OpenTracingLayerChannelStore) SearchArchivedInTeam(teamID string, term string, userID string) (*model.ChannelList, error) {
|
||||
func (s *OpenTracingLayerChannelStore) SearchArchivedInTeam(teamID string, term string, userID string) (model.ChannelList, error) {
|
||||
origCtx := s.Root.Store.Context()
|
||||
span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "ChannelStore.SearchArchivedInTeam")
|
||||
s.Root.Store.SetContext(newCtx)
|
||||
@@ -2032,7 +2032,7 @@ func (s *OpenTracingLayerChannelStore) SearchArchivedInTeam(teamID string, term
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *OpenTracingLayerChannelStore) SearchForUserInTeam(userID string, teamID string, term string, includeDeleted bool) (*model.ChannelList, error) {
|
||||
func (s *OpenTracingLayerChannelStore) SearchForUserInTeam(userID string, teamID string, term string, includeDeleted bool) (model.ChannelList, error) {
|
||||
origCtx := s.Root.Store.Context()
|
||||
span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "ChannelStore.SearchForUserInTeam")
|
||||
s.Root.Store.SetContext(newCtx)
|
||||
@@ -2050,7 +2050,7 @@ func (s *OpenTracingLayerChannelStore) SearchForUserInTeam(userID string, teamID
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *OpenTracingLayerChannelStore) SearchGroupChannels(userID string, term string) (*model.ChannelList, error) {
|
||||
func (s *OpenTracingLayerChannelStore) SearchGroupChannels(userID string, term string) (model.ChannelList, error) {
|
||||
origCtx := s.Root.Store.Context()
|
||||
span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "ChannelStore.SearchGroupChannels")
|
||||
s.Root.Store.SetContext(newCtx)
|
||||
@@ -2068,7 +2068,7 @@ func (s *OpenTracingLayerChannelStore) SearchGroupChannels(userID string, term s
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *OpenTracingLayerChannelStore) SearchInTeam(teamID string, term string, includeDeleted bool) (*model.ChannelList, error) {
|
||||
func (s *OpenTracingLayerChannelStore) SearchInTeam(teamID string, term string, includeDeleted bool) (model.ChannelList, error) {
|
||||
origCtx := s.Root.Store.Context()
|
||||
span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "ChannelStore.SearchInTeam")
|
||||
s.Root.Store.SetContext(newCtx)
|
||||
@@ -2086,7 +2086,7 @@ func (s *OpenTracingLayerChannelStore) SearchInTeam(teamID string, term string,
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *OpenTracingLayerChannelStore) SearchMore(userID string, teamID string, term string) (*model.ChannelList, error) {
|
||||
func (s *OpenTracingLayerChannelStore) SearchMore(userID string, teamID string, term string) (model.ChannelList, error) {
|
||||
origCtx := s.Root.Store.Context()
|
||||
span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "ChannelStore.SearchMore")
|
||||
s.Root.Store.SetContext(newCtx)
|
||||
@@ -2302,7 +2302,7 @@ func (s *OpenTracingLayerChannelStore) UpdateSidebarChannelCategoryOnMove(channe
|
||||
return err
|
||||
}
|
||||
|
||||
func (s *OpenTracingLayerChannelStore) UpdateSidebarChannelsByPreferences(preferences *model.Preferences) error {
|
||||
func (s *OpenTracingLayerChannelStore) UpdateSidebarChannelsByPreferences(preferences model.Preferences) error {
|
||||
origCtx := s.Root.Store.Context()
|
||||
span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "ChannelStore.UpdateSidebarChannelsByPreferences")
|
||||
s.Root.Store.SetContext(newCtx)
|
||||
@@ -5911,7 +5911,7 @@ func (s *OpenTracingLayerPreferenceStore) PermanentDeleteByUser(userID string) e
|
||||
return err
|
||||
}
|
||||
|
||||
func (s *OpenTracingLayerPreferenceStore) Save(preferences *model.Preferences) error {
|
||||
func (s *OpenTracingLayerPreferenceStore) Save(preferences model.Preferences) error {
|
||||
origCtx := s.Root.Store.Context()
|
||||
span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "PreferenceStore.Save")
|
||||
s.Root.Store.SetContext(newCtx)
|
||||
@@ -5947,7 +5947,7 @@ func (s *OpenTracingLayerProductNoticesStore) Clear(notices []string) error {
|
||||
return err
|
||||
}
|
||||
|
||||
func (s *OpenTracingLayerProductNoticesStore) ClearOldNotices(currentNotices *model.ProductNotices) error {
|
||||
func (s *OpenTracingLayerProductNoticesStore) ClearOldNotices(currentNotices model.ProductNotices) error {
|
||||
origCtx := s.Root.Store.Context()
|
||||
span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "ProductNoticesStore.ClearOldNotices")
|
||||
s.Root.Store.SetContext(newCtx)
|
||||
|
||||
@@ -608,7 +608,7 @@ func (s *RetryLayerChannelStore) AnalyticsTypeCount(teamID string, channelType m
|
||||
|
||||
}
|
||||
|
||||
func (s *RetryLayerChannelStore) AutocompleteInTeam(teamID string, term string, includeDeleted bool) (*model.ChannelList, error) {
|
||||
func (s *RetryLayerChannelStore) AutocompleteInTeam(teamID string, term string, includeDeleted bool) (model.ChannelList, error) {
|
||||
|
||||
tries := 0
|
||||
for {
|
||||
@@ -628,7 +628,7 @@ func (s *RetryLayerChannelStore) AutocompleteInTeam(teamID string, term string,
|
||||
|
||||
}
|
||||
|
||||
func (s *RetryLayerChannelStore) AutocompleteInTeamForSearch(teamID string, userID string, term string, includeDeleted bool) (*model.ChannelList, error) {
|
||||
func (s *RetryLayerChannelStore) AutocompleteInTeamForSearch(teamID string, userID string, term string, includeDeleted bool) (model.ChannelList, error) {
|
||||
|
||||
tries := 0
|
||||
for {
|
||||
@@ -814,7 +814,7 @@ func (s *RetryLayerChannelStore) DeleteSidebarCategory(categoryID string) error
|
||||
|
||||
}
|
||||
|
||||
func (s *RetryLayerChannelStore) DeleteSidebarChannelsByPreferences(preferences *model.Preferences) error {
|
||||
func (s *RetryLayerChannelStore) DeleteSidebarChannelsByPreferences(preferences model.Preferences) error {
|
||||
|
||||
tries := 0
|
||||
for {
|
||||
@@ -914,7 +914,7 @@ func (s *RetryLayerChannelStore) GetAllChannelMembersNotifyPropsForChannel(chann
|
||||
|
||||
}
|
||||
|
||||
func (s *RetryLayerChannelStore) GetAllChannels(page int, perPage int, opts store.ChannelSearchOpts) (*model.ChannelListWithTeamData, error) {
|
||||
func (s *RetryLayerChannelStore) GetAllChannels(page int, perPage int, opts store.ChannelSearchOpts) (model.ChannelListWithTeamData, error) {
|
||||
|
||||
tries := 0
|
||||
for {
|
||||
@@ -1134,7 +1134,7 @@ func (s *RetryLayerChannelStore) GetChannelUnread(channelID string, userID strin
|
||||
|
||||
}
|
||||
|
||||
func (s *RetryLayerChannelStore) GetChannels(teamID string, userID string, includeDeleted bool, lastDeleteAt int) (*model.ChannelList, error) {
|
||||
func (s *RetryLayerChannelStore) GetChannels(teamID string, userID string, includeDeleted bool, lastDeleteAt int) (model.ChannelList, error) {
|
||||
|
||||
tries := 0
|
||||
for {
|
||||
@@ -1214,7 +1214,7 @@ func (s *RetryLayerChannelStore) GetChannelsByScheme(schemeID string, offset int
|
||||
|
||||
}
|
||||
|
||||
func (s *RetryLayerChannelStore) GetDeleted(team_id string, offset int, limit int, userID string) (*model.ChannelList, error) {
|
||||
func (s *RetryLayerChannelStore) GetDeleted(team_id string, offset int, limit int, userID string) (model.ChannelList, error) {
|
||||
|
||||
tries := 0
|
||||
for {
|
||||
@@ -1400,7 +1400,7 @@ func (s *RetryLayerChannelStore) GetMemberForPost(postID string, userID string)
|
||||
|
||||
}
|
||||
|
||||
func (s *RetryLayerChannelStore) GetMembers(channelID string, offset int, limit int) (*model.ChannelMembers, error) {
|
||||
func (s *RetryLayerChannelStore) GetMembers(channelID string, offset int, limit int) (model.ChannelMembers, error) {
|
||||
|
||||
tries := 0
|
||||
for {
|
||||
@@ -1420,7 +1420,7 @@ func (s *RetryLayerChannelStore) GetMembers(channelID string, offset int, limit
|
||||
|
||||
}
|
||||
|
||||
func (s *RetryLayerChannelStore) GetMembersByChannelIds(channelIds []string, userID string) (*model.ChannelMembers, error) {
|
||||
func (s *RetryLayerChannelStore) GetMembersByChannelIds(channelIds []string, userID string) (model.ChannelMembers, error) {
|
||||
|
||||
tries := 0
|
||||
for {
|
||||
@@ -1440,7 +1440,7 @@ func (s *RetryLayerChannelStore) GetMembersByChannelIds(channelIds []string, use
|
||||
|
||||
}
|
||||
|
||||
func (s *RetryLayerChannelStore) GetMembersByIds(channelID string, userIds []string) (*model.ChannelMembers, error) {
|
||||
func (s *RetryLayerChannelStore) GetMembersByIds(channelID string, userIds []string) (model.ChannelMembers, error) {
|
||||
|
||||
tries := 0
|
||||
for {
|
||||
@@ -1460,7 +1460,7 @@ func (s *RetryLayerChannelStore) GetMembersByIds(channelID string, userIds []str
|
||||
|
||||
}
|
||||
|
||||
func (s *RetryLayerChannelStore) GetMembersForUser(teamID string, userID string) (*model.ChannelMembers, error) {
|
||||
func (s *RetryLayerChannelStore) GetMembersForUser(teamID string, userID string) (model.ChannelMembers, error) {
|
||||
|
||||
tries := 0
|
||||
for {
|
||||
@@ -1480,7 +1480,7 @@ func (s *RetryLayerChannelStore) GetMembersForUser(teamID string, userID string)
|
||||
|
||||
}
|
||||
|
||||
func (s *RetryLayerChannelStore) GetMembersForUserWithPagination(teamID string, userID string, page int, perPage int) (*model.ChannelMembers, error) {
|
||||
func (s *RetryLayerChannelStore) GetMembersForUserWithPagination(teamID string, userID string, page int, perPage int) (model.ChannelMembers, error) {
|
||||
|
||||
tries := 0
|
||||
for {
|
||||
@@ -1500,7 +1500,7 @@ func (s *RetryLayerChannelStore) GetMembersForUserWithPagination(teamID string,
|
||||
|
||||
}
|
||||
|
||||
func (s *RetryLayerChannelStore) GetMoreChannels(teamID string, userID string, offset int, limit int) (*model.ChannelList, error) {
|
||||
func (s *RetryLayerChannelStore) GetMoreChannels(teamID string, userID string, offset int, limit int) (model.ChannelList, error) {
|
||||
|
||||
tries := 0
|
||||
for {
|
||||
@@ -1560,7 +1560,7 @@ func (s *RetryLayerChannelStore) GetPinnedPosts(channelID string) (*model.PostLi
|
||||
|
||||
}
|
||||
|
||||
func (s *RetryLayerChannelStore) GetPrivateChannelsForTeam(teamID string, offset int, limit int) (*model.ChannelList, error) {
|
||||
func (s *RetryLayerChannelStore) GetPrivateChannelsForTeam(teamID string, offset int, limit int) (model.ChannelList, error) {
|
||||
|
||||
tries := 0
|
||||
for {
|
||||
@@ -1580,7 +1580,7 @@ func (s *RetryLayerChannelStore) GetPrivateChannelsForTeam(teamID string, offset
|
||||
|
||||
}
|
||||
|
||||
func (s *RetryLayerChannelStore) GetPublicChannelsByIdsForTeam(teamID string, channelIds []string) (*model.ChannelList, error) {
|
||||
func (s *RetryLayerChannelStore) GetPublicChannelsByIdsForTeam(teamID string, channelIds []string) (model.ChannelList, error) {
|
||||
|
||||
tries := 0
|
||||
for {
|
||||
@@ -1600,7 +1600,7 @@ func (s *RetryLayerChannelStore) GetPublicChannelsByIdsForTeam(teamID string, ch
|
||||
|
||||
}
|
||||
|
||||
func (s *RetryLayerChannelStore) GetPublicChannelsForTeam(teamID string, offset int, limit int) (*model.ChannelList, error) {
|
||||
func (s *RetryLayerChannelStore) GetPublicChannelsForTeam(teamID string, offset int, limit int) (model.ChannelList, error) {
|
||||
|
||||
tries := 0
|
||||
for {
|
||||
@@ -1680,7 +1680,7 @@ func (s *RetryLayerChannelStore) GetSidebarCategoryOrder(userID string, teamID s
|
||||
|
||||
}
|
||||
|
||||
func (s *RetryLayerChannelStore) GetTeamChannels(teamID string) (*model.ChannelList, error) {
|
||||
func (s *RetryLayerChannelStore) GetTeamChannels(teamID string) (model.ChannelList, error) {
|
||||
|
||||
tries := 0
|
||||
for {
|
||||
@@ -2108,7 +2108,7 @@ func (s *RetryLayerChannelStore) SaveMultipleMembers(members []*model.ChannelMem
|
||||
|
||||
}
|
||||
|
||||
func (s *RetryLayerChannelStore) SearchAllChannels(term string, opts store.ChannelSearchOpts) (*model.ChannelListWithTeamData, int64, error) {
|
||||
func (s *RetryLayerChannelStore) SearchAllChannels(term string, opts store.ChannelSearchOpts) (model.ChannelListWithTeamData, int64, error) {
|
||||
|
||||
tries := 0
|
||||
for {
|
||||
@@ -2128,7 +2128,7 @@ func (s *RetryLayerChannelStore) SearchAllChannels(term string, opts store.Chann
|
||||
|
||||
}
|
||||
|
||||
func (s *RetryLayerChannelStore) SearchArchivedInTeam(teamID string, term string, userID string) (*model.ChannelList, error) {
|
||||
func (s *RetryLayerChannelStore) SearchArchivedInTeam(teamID string, term string, userID string) (model.ChannelList, error) {
|
||||
|
||||
tries := 0
|
||||
for {
|
||||
@@ -2148,7 +2148,7 @@ func (s *RetryLayerChannelStore) SearchArchivedInTeam(teamID string, term string
|
||||
|
||||
}
|
||||
|
||||
func (s *RetryLayerChannelStore) SearchForUserInTeam(userID string, teamID string, term string, includeDeleted bool) (*model.ChannelList, error) {
|
||||
func (s *RetryLayerChannelStore) SearchForUserInTeam(userID string, teamID string, term string, includeDeleted bool) (model.ChannelList, error) {
|
||||
|
||||
tries := 0
|
||||
for {
|
||||
@@ -2168,7 +2168,7 @@ func (s *RetryLayerChannelStore) SearchForUserInTeam(userID string, teamID strin
|
||||
|
||||
}
|
||||
|
||||
func (s *RetryLayerChannelStore) SearchGroupChannels(userID string, term string) (*model.ChannelList, error) {
|
||||
func (s *RetryLayerChannelStore) SearchGroupChannels(userID string, term string) (model.ChannelList, error) {
|
||||
|
||||
tries := 0
|
||||
for {
|
||||
@@ -2188,7 +2188,7 @@ func (s *RetryLayerChannelStore) SearchGroupChannels(userID string, term string)
|
||||
|
||||
}
|
||||
|
||||
func (s *RetryLayerChannelStore) SearchInTeam(teamID string, term string, includeDeleted bool) (*model.ChannelList, error) {
|
||||
func (s *RetryLayerChannelStore) SearchInTeam(teamID string, term string, includeDeleted bool) (model.ChannelList, error) {
|
||||
|
||||
tries := 0
|
||||
for {
|
||||
@@ -2208,7 +2208,7 @@ func (s *RetryLayerChannelStore) SearchInTeam(teamID string, term string, includ
|
||||
|
||||
}
|
||||
|
||||
func (s *RetryLayerChannelStore) SearchMore(userID string, teamID string, term string) (*model.ChannelList, error) {
|
||||
func (s *RetryLayerChannelStore) SearchMore(userID string, teamID string, term string) (model.ChannelList, error) {
|
||||
|
||||
tries := 0
|
||||
for {
|
||||
@@ -2448,7 +2448,7 @@ func (s *RetryLayerChannelStore) UpdateSidebarChannelCategoryOnMove(channel *mod
|
||||
|
||||
}
|
||||
|
||||
func (s *RetryLayerChannelStore) UpdateSidebarChannelsByPreferences(preferences *model.Preferences) error {
|
||||
func (s *RetryLayerChannelStore) UpdateSidebarChannelsByPreferences(preferences model.Preferences) error {
|
||||
|
||||
tries := 0
|
||||
for {
|
||||
@@ -6390,7 +6390,7 @@ func (s *RetryLayerPreferenceStore) PermanentDeleteByUser(userID string) error {
|
||||
|
||||
}
|
||||
|
||||
func (s *RetryLayerPreferenceStore) Save(preferences *model.Preferences) error {
|
||||
func (s *RetryLayerPreferenceStore) Save(preferences model.Preferences) error {
|
||||
|
||||
tries := 0
|
||||
for {
|
||||
@@ -6430,7 +6430,7 @@ func (s *RetryLayerProductNoticesStore) Clear(notices []string) error {
|
||||
|
||||
}
|
||||
|
||||
func (s *RetryLayerProductNoticesStore) ClearOldNotices(currentNotices *model.ProductNotices) error {
|
||||
func (s *RetryLayerProductNoticesStore) ClearOldNotices(currentNotices model.ProductNotices) error {
|
||||
|
||||
tries := 0
|
||||
for {
|
||||
|
||||
@@ -132,8 +132,8 @@ func (c *SearchChannelStore) SaveDirectChannel(directchannel *model.Channel, mem
|
||||
return channel, err
|
||||
}
|
||||
|
||||
func (c *SearchChannelStore) AutocompleteInTeam(teamId string, term string, includeDeleted bool) (*model.ChannelList, error) {
|
||||
var channelList *model.ChannelList
|
||||
func (c *SearchChannelStore) AutocompleteInTeam(teamId string, term string, includeDeleted bool) (model.ChannelList, error) {
|
||||
var channelList model.ChannelList
|
||||
var err error
|
||||
|
||||
allFailed := true
|
||||
@@ -165,7 +165,7 @@ func (c *SearchChannelStore) AutocompleteInTeam(teamId string, term string, incl
|
||||
return channelList, nil
|
||||
}
|
||||
|
||||
func (c *SearchChannelStore) searchAutocompleteChannels(engine searchengine.SearchEngineInterface, teamId, term string, includeDeleted bool) (*model.ChannelList, error) {
|
||||
func (c *SearchChannelStore) searchAutocompleteChannels(engine searchengine.SearchEngineInterface, teamId, term string, includeDeleted bool) (model.ChannelList, error) {
|
||||
channelIds, err := engine.SearchChannels(teamId, term)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -183,7 +183,7 @@ func (c *SearchChannelStore) searchAutocompleteChannels(engine searchengine.Sear
|
||||
}
|
||||
}
|
||||
|
||||
return &channelList, nil
|
||||
return channelList, nil
|
||||
}
|
||||
|
||||
func (c *SearchChannelStore) PermanentDeleteMembersByUser(userId string) error {
|
||||
|
||||
@@ -171,7 +171,7 @@ func (s *SearchUserStore) getListOfAllowedChannelsForTeam(teamId string, viewRes
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "failed to get team channels")
|
||||
}
|
||||
for _, channel := range *channels {
|
||||
for _, channel := range channels {
|
||||
listOfAllowedChannels = append(listOfAllowedChannels, channel.Id)
|
||||
}
|
||||
return listOfAllowedChannels, nil
|
||||
|
||||
@@ -465,10 +465,10 @@ func (th *SearchTestHelper) checkFileInfoInSearchResults(t *testing.T, fileID st
|
||||
assert.Contains(t, fileIDS, fileID, "Did not find expected file in search results.")
|
||||
}
|
||||
|
||||
func (th *SearchTestHelper) checkChannelIdsMatch(t *testing.T, expected []string, results *model.ChannelList) {
|
||||
func (th *SearchTestHelper) checkChannelIdsMatch(t *testing.T, expected []string, results model.ChannelList) {
|
||||
t.Helper()
|
||||
channelIds := make([]string, len(*results))
|
||||
for i, channel := range *results {
|
||||
channelIds := make([]string, len(results))
|
||||
for i, channel := range results {
|
||||
channelIds[i] = channel.Id
|
||||
}
|
||||
require.ElementsMatch(t, expected, channelIds)
|
||||
|
||||
@@ -250,14 +250,14 @@ func (db channelMemberWithSchemeRoles) ToModel() *model.ChannelMember {
|
||||
}
|
||||
}
|
||||
|
||||
func (db channelMemberWithSchemeRolesList) ToModel() *model.ChannelMembers {
|
||||
func (db channelMemberWithSchemeRolesList) ToModel() model.ChannelMembers {
|
||||
cms := model.ChannelMembers{}
|
||||
|
||||
for _, cm := range db {
|
||||
cms = append(cms, *cm.ToModel())
|
||||
}
|
||||
|
||||
return &cms
|
||||
return cms
|
||||
}
|
||||
|
||||
type allChannelMember struct {
|
||||
@@ -945,7 +945,7 @@ func (s SqlChannelStore) PermanentDeleteMembersByChannel(channelId string) error
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s SqlChannelStore) GetChannels(teamId string, userId string, includeDeleted bool, lastDeleteAt int) (*model.ChannelList, error) {
|
||||
func (s SqlChannelStore) GetChannels(teamId string, userId string, includeDeleted bool, lastDeleteAt int) (model.ChannelList, error) {
|
||||
query := s.getQueryBuilder().
|
||||
Select("Channels.*").
|
||||
From("Channels, ChannelMembers").
|
||||
@@ -975,25 +975,25 @@ func (s SqlChannelStore) GetChannels(teamId string, userId string, includeDelete
|
||||
query = query.Where(sq.Eq{"DeleteAt": 0})
|
||||
}
|
||||
|
||||
channels := &model.ChannelList{}
|
||||
var channels model.ChannelList
|
||||
sql, args, err := query.ToSql()
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "getchannels_tosql")
|
||||
}
|
||||
|
||||
_, err = s.GetReplica().Select(channels, sql, args...)
|
||||
_, err = s.GetReplica().Select(&channels, sql, args...)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "failed to get channels with TeamId=%s and UserId=%s", teamId, userId)
|
||||
}
|
||||
|
||||
if len(*channels) == 0 {
|
||||
if len(channels) == 0 {
|
||||
return nil, store.NewErrNotFound("Channel", "userId="+userId)
|
||||
}
|
||||
|
||||
return channels, nil
|
||||
}
|
||||
|
||||
func (s SqlChannelStore) GetAllChannels(offset, limit int, opts store.ChannelSearchOpts) (*model.ChannelListWithTeamData, error) {
|
||||
func (s SqlChannelStore) GetAllChannels(offset, limit int, opts store.ChannelSearchOpts) (model.ChannelListWithTeamData, error) {
|
||||
query := s.getAllChannelsQuery(opts, false)
|
||||
|
||||
query = query.OrderBy("c.DisplayName, Teams.DisplayName").Limit(uint64(limit)).Offset(uint64(offset))
|
||||
@@ -1003,8 +1003,8 @@ func (s SqlChannelStore) GetAllChannels(offset, limit int, opts store.ChannelSea
|
||||
return nil, errors.Wrap(err, "failed to create query")
|
||||
}
|
||||
|
||||
data := &model.ChannelListWithTeamData{}
|
||||
_, err = s.GetReplica().Select(data, queryString, args...)
|
||||
var data model.ChannelListWithTeamData
|
||||
_, err = s.GetReplica().Select(&data, queryString, args...)
|
||||
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "failed to get all channels")
|
||||
@@ -1071,9 +1071,9 @@ func (s SqlChannelStore) getAllChannelsQuery(opts store.ChannelSearchOpts, forCo
|
||||
return query
|
||||
}
|
||||
|
||||
func (s SqlChannelStore) GetMoreChannels(teamId string, userId string, offset int, limit int) (*model.ChannelList, error) {
|
||||
channels := &model.ChannelList{}
|
||||
_, err := s.GetReplica().Select(channels, `
|
||||
func (s SqlChannelStore) GetMoreChannels(teamId string, userId string, offset int, limit int) (model.ChannelList, error) {
|
||||
var channels model.ChannelList
|
||||
_, err := s.GetReplica().Select(&channels, `
|
||||
SELECT
|
||||
Channels.*
|
||||
FROM
|
||||
@@ -1113,8 +1113,8 @@ func (s SqlChannelStore) GetMoreChannels(teamId string, userId string, offset in
|
||||
return channels, nil
|
||||
}
|
||||
|
||||
func (s SqlChannelStore) GetPrivateChannelsForTeam(teamId string, offset int, limit int) (*model.ChannelList, error) {
|
||||
channels := &model.ChannelList{}
|
||||
func (s SqlChannelStore) GetPrivateChannelsForTeam(teamId string, offset int, limit int) (model.ChannelList, error) {
|
||||
var channels model.ChannelList
|
||||
|
||||
builder := s.getQueryBuilder().
|
||||
Select("*").
|
||||
@@ -1129,16 +1129,16 @@ func (s SqlChannelStore) GetPrivateChannelsForTeam(teamId string, offset int, li
|
||||
return nil, errors.Wrap(err, "channels_tosql")
|
||||
}
|
||||
|
||||
_, err = s.GetReplica().Select(channels, query, args...)
|
||||
_, err = s.GetReplica().Select(&channels, query, args...)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "failed to find chaneld with teamId=%s", teamId)
|
||||
}
|
||||
return channels, nil
|
||||
}
|
||||
|
||||
func (s SqlChannelStore) GetPublicChannelsForTeam(teamId string, offset int, limit int) (*model.ChannelList, error) {
|
||||
channels := &model.ChannelList{}
|
||||
_, err := s.GetReplica().Select(channels, `
|
||||
func (s SqlChannelStore) GetPublicChannelsForTeam(teamId string, offset int, limit int) (model.ChannelList, error) {
|
||||
var channels model.ChannelList
|
||||
_, err := s.GetReplica().Select(&channels, `
|
||||
SELECT
|
||||
Channels.*
|
||||
FROM
|
||||
@@ -1164,7 +1164,7 @@ func (s SqlChannelStore) GetPublicChannelsForTeam(teamId string, offset int, lim
|
||||
return channels, nil
|
||||
}
|
||||
|
||||
func (s SqlChannelStore) GetPublicChannelsByIdsForTeam(teamId string, channelIds []string) (*model.ChannelList, error) {
|
||||
func (s SqlChannelStore) GetPublicChannelsByIdsForTeam(teamId string, channelIds []string) (model.ChannelList, error) {
|
||||
props := make(map[string]interface{})
|
||||
props["teamId"] = teamId
|
||||
|
||||
@@ -1179,8 +1179,8 @@ func (s SqlChannelStore) GetPublicChannelsByIdsForTeam(teamId string, channelIds
|
||||
idQuery += ":channelId" + strconv.Itoa(index)
|
||||
}
|
||||
|
||||
data := &model.ChannelList{}
|
||||
_, err := s.GetReplica().Select(data, `
|
||||
var data model.ChannelList
|
||||
_, err := s.GetReplica().Select(&data, `
|
||||
SELECT
|
||||
Channels.*
|
||||
FROM
|
||||
@@ -1198,7 +1198,7 @@ func (s SqlChannelStore) GetPublicChannelsByIdsForTeam(teamId string, channelIds
|
||||
return nil, errors.Wrap(err, "failed to find Channels")
|
||||
}
|
||||
|
||||
if len(*data) == 0 {
|
||||
if len(data) == 0 {
|
||||
return nil, store.NewErrNotFound("Channel", fmt.Sprintf("teamId=%s, channelIds=%v", teamId, channelIds))
|
||||
}
|
||||
|
||||
@@ -1231,15 +1231,15 @@ func (s SqlChannelStore) GetChannelCounts(teamId string, userId string) (*model.
|
||||
return counts, nil
|
||||
}
|
||||
|
||||
func (s SqlChannelStore) GetTeamChannels(teamId string) (*model.ChannelList, error) {
|
||||
data := &model.ChannelList{}
|
||||
_, err := s.GetReplica().Select(data, "SELECT * FROM Channels WHERE TeamId = :TeamId And Type != 'D' ORDER BY DisplayName", map[string]interface{}{"TeamId": teamId})
|
||||
func (s SqlChannelStore) GetTeamChannels(teamId string) (model.ChannelList, error) {
|
||||
var data model.ChannelList
|
||||
_, err := s.GetReplica().Select(&data, "SELECT * FROM Channels WHERE TeamId = :TeamId And Type != 'D' ORDER BY DisplayName", map[string]interface{}{"TeamId": teamId})
|
||||
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "failed to find Channels with teamId=%s", teamId)
|
||||
}
|
||||
|
||||
if len(*data) == 0 {
|
||||
if len(data) == 0 {
|
||||
return nil, store.NewErrNotFound("Channel", fmt.Sprintf("teamId=%s", teamId))
|
||||
}
|
||||
|
||||
@@ -1364,8 +1364,8 @@ func (s SqlChannelStore) GetDeletedByName(teamId string, name string) (*model.Ch
|
||||
return &channel, nil
|
||||
}
|
||||
|
||||
func (s SqlChannelStore) GetDeleted(teamId string, offset int, limit int, userId string) (*model.ChannelList, error) {
|
||||
channels := &model.ChannelList{}
|
||||
func (s SqlChannelStore) GetDeleted(teamId string, offset int, limit int, userId string) (model.ChannelList, error) {
|
||||
var channels model.ChannelList
|
||||
|
||||
query := `
|
||||
SELECT * FROM Channels
|
||||
@@ -1381,7 +1381,7 @@ func (s SqlChannelStore) GetDeleted(teamId string, offset int, limit int, userId
|
||||
ORDER BY DisplayName LIMIT :Limit OFFSET :Offset
|
||||
`
|
||||
|
||||
if _, err := s.GetReplica().Select(channels, query, map[string]interface{}{"TeamId": teamId, "Limit": limit, "Offset": offset, "UserId": userId}); err != nil {
|
||||
if _, err := s.GetReplica().Select(&channels, query, map[string]interface{}{"TeamId": teamId, "Limit": limit, "Offset": offset, "UserId": userId}); err != nil {
|
||||
if err == sql.ErrNoRows {
|
||||
return nil, store.NewErrNotFound("Channel", fmt.Sprintf("TeamId=%s,UserId=%s", teamId, userId))
|
||||
}
|
||||
@@ -1630,7 +1630,7 @@ func (s SqlChannelStore) UpdateMember(member *model.ChannelMember) (*model.Chann
|
||||
return updatedMembers[0], nil
|
||||
}
|
||||
|
||||
func (s SqlChannelStore) GetMembers(channelId string, offset, limit int) (*model.ChannelMembers, error) {
|
||||
func (s SqlChannelStore) GetMembers(channelId string, offset, limit int) (model.ChannelMembers, error) {
|
||||
var dbMembers channelMemberWithSchemeRolesList
|
||||
_, err := s.GetReplica().Select(&dbMembers, ChannelMembersWithSchemeSelectQuery+"WHERE ChannelId = :ChannelId LIMIT :Limit OFFSET :Offset", map[string]interface{}{"ChannelId": channelId, "Limit": limit, "Offset": offset})
|
||||
if err != nil {
|
||||
@@ -2388,7 +2388,7 @@ func (s SqlChannelStore) AnalyticsDeletedTypeCount(teamId string, channelType st
|
||||
return v, nil
|
||||
}
|
||||
|
||||
func (s SqlChannelStore) GetMembersForUser(teamId string, userId string) (*model.ChannelMembers, error) {
|
||||
func (s SqlChannelStore) GetMembersForUser(teamId string, userId string) (model.ChannelMembers, error) {
|
||||
var dbMembers channelMemberWithSchemeRolesList
|
||||
_, err := s.GetReplica().Select(&dbMembers, ChannelMembersWithSchemeSelectQuery+"WHERE ChannelMembers.UserId = :UserId AND (Teams.Id = :TeamId OR Teams.Id = '' OR Teams.Id IS NULL)", map[string]interface{}{"TeamId": teamId, "UserId": userId})
|
||||
if err != nil {
|
||||
@@ -2398,7 +2398,7 @@ func (s SqlChannelStore) GetMembersForUser(teamId string, userId string) (*model
|
||||
return dbMembers.ToModel(), nil
|
||||
}
|
||||
|
||||
func (s SqlChannelStore) GetMembersForUserWithPagination(teamId, userId string, page, perPage int) (*model.ChannelMembers, error) {
|
||||
func (s SqlChannelStore) GetMembersForUserWithPagination(teamId, userId string, page, perPage int) (model.ChannelMembers, error) {
|
||||
var dbMembers channelMemberWithSchemeRolesList
|
||||
offset := page * perPage
|
||||
_, err := s.GetReplica().Select(&dbMembers, ChannelMembersWithSchemeSelectQuery+"WHERE ChannelMembers.UserId = :UserId Limit :Limit Offset :Offset", map[string]interface{}{"TeamId": teamId, "UserId": userId, "Limit": perPage, "Offset": offset})
|
||||
@@ -2410,7 +2410,7 @@ func (s SqlChannelStore) GetMembersForUserWithPagination(teamId, userId string,
|
||||
return dbMembers.ToModel(), nil
|
||||
}
|
||||
|
||||
func (s SqlChannelStore) AutocompleteInTeam(teamId string, term string, includeDeleted bool) (*model.ChannelList, error) {
|
||||
func (s SqlChannelStore) AutocompleteInTeam(teamId string, term string, includeDeleted bool) (model.ChannelList, error) {
|
||||
deleteFilter := "AND Channels.DeleteAt = 0"
|
||||
if includeDeleted {
|
||||
deleteFilter = ""
|
||||
@@ -2451,10 +2451,10 @@ func (s SqlChannelStore) AutocompleteInTeam(teamId string, term string, includeD
|
||||
sort.Slice(channels, func(a, b int) bool {
|
||||
return strings.ToLower(channels[a].DisplayName) < strings.ToLower(channels[b].DisplayName)
|
||||
})
|
||||
return &channels, nil
|
||||
return channels, nil
|
||||
}
|
||||
|
||||
func (s SqlChannelStore) AutocompleteInTeamForSearch(teamId string, userId string, term string, includeDeleted bool) (*model.ChannelList, error) {
|
||||
func (s SqlChannelStore) AutocompleteInTeamForSearch(teamId string, userId string, term string, includeDeleted bool) (model.ChannelList, error) {
|
||||
deleteFilter := "AND DeleteAt = 0"
|
||||
if includeDeleted {
|
||||
deleteFilter = ""
|
||||
@@ -2503,7 +2503,7 @@ func (s SqlChannelStore) AutocompleteInTeamForSearch(teamId string, userId strin
|
||||
sort.Slice(channels, func(a, b int) bool {
|
||||
return strings.ToLower(channels[a].DisplayName) < strings.ToLower(channels[b].DisplayName)
|
||||
})
|
||||
return &channels, nil
|
||||
return channels, nil
|
||||
}
|
||||
|
||||
func (s SqlChannelStore) autocompleteInTeamForSearchDirectMessages(userId string, term string) ([]*model.Channel, error) {
|
||||
@@ -2548,7 +2548,7 @@ func (s SqlChannelStore) autocompleteInTeamForSearchDirectMessages(userId string
|
||||
return channels, nil
|
||||
}
|
||||
|
||||
func (s SqlChannelStore) SearchInTeam(teamId string, term string, includeDeleted bool) (*model.ChannelList, error) {
|
||||
func (s SqlChannelStore) SearchInTeam(teamId string, term string, includeDeleted bool) (model.ChannelList, error) {
|
||||
deleteFilter := "AND c.DeleteAt = 0"
|
||||
if includeDeleted {
|
||||
deleteFilter = ""
|
||||
@@ -2572,7 +2572,7 @@ func (s SqlChannelStore) SearchInTeam(teamId string, term string, includeDeleted
|
||||
})
|
||||
}
|
||||
|
||||
func (s SqlChannelStore) SearchArchivedInTeam(teamId string, term string, userId string) (*model.ChannelList, error) {
|
||||
func (s SqlChannelStore) SearchArchivedInTeam(teamId string, term string, userId string) (model.ChannelList, error) {
|
||||
publicChannels, publicErr := s.performSearch(`
|
||||
SELECT
|
||||
Channels.*
|
||||
@@ -2621,13 +2621,13 @@ func (s SqlChannelStore) SearchArchivedInTeam(teamId string, term string, userId
|
||||
return nil, outputErr
|
||||
}
|
||||
|
||||
output := *publicChannels
|
||||
output = append(output, *privateChannels...)
|
||||
output := publicChannels
|
||||
output = append(output, privateChannels...)
|
||||
|
||||
return &output, nil
|
||||
return output, nil
|
||||
}
|
||||
|
||||
func (s SqlChannelStore) SearchForUserInTeam(userId string, teamId string, term string, includeDeleted bool) (*model.ChannelList, error) {
|
||||
func (s SqlChannelStore) SearchForUserInTeam(userId string, teamId string, term string, includeDeleted bool) (model.ChannelList, error) {
|
||||
deleteFilter := "AND c.DeleteAt = 0"
|
||||
if includeDeleted {
|
||||
deleteFilter = ""
|
||||
@@ -2758,7 +2758,7 @@ func (s SqlChannelStore) channelSearchQuery(opts *store.ChannelSearchOpts) sq.Se
|
||||
return query
|
||||
}
|
||||
|
||||
func (s SqlChannelStore) SearchAllChannels(term string, opts store.ChannelSearchOpts) (*model.ChannelListWithTeamData, int64, error) {
|
||||
func (s SqlChannelStore) SearchAllChannels(term string, opts store.ChannelSearchOpts) (model.ChannelListWithTeamData, int64, error) {
|
||||
opts.Term = term
|
||||
opts.IncludeTeamInfo = true
|
||||
queryString, args, err := s.channelSearchQuery(&opts).ToSql()
|
||||
@@ -2786,10 +2786,10 @@ func (s SqlChannelStore) SearchAllChannels(term string, opts store.ChannelSearch
|
||||
totalCount = int64(len(channels))
|
||||
}
|
||||
|
||||
return &channels, totalCount, nil
|
||||
return channels, totalCount, nil
|
||||
}
|
||||
|
||||
func (s SqlChannelStore) SearchMore(userId string, teamId string, term string) (*model.ChannelList, error) {
|
||||
func (s SqlChannelStore) SearchMore(userId string, teamId string, term string) (model.ChannelList, error) {
|
||||
return s.performSearch(`
|
||||
SELECT
|
||||
Channels.*
|
||||
@@ -2882,7 +2882,7 @@ func (s SqlChannelStore) buildFulltextClause(term string, searchColumns string)
|
||||
return
|
||||
}
|
||||
|
||||
func (s SqlChannelStore) performSearch(searchQuery string, term string, parameters map[string]interface{}) (*model.ChannelList, error) {
|
||||
func (s SqlChannelStore) performSearch(searchQuery string, term string, parameters map[string]interface{}) (model.ChannelList, error) {
|
||||
likeClause, likeTerm := s.buildLIKEClause(term, "c.Name, c.DisplayName, c.Purpose")
|
||||
if likeTerm == "" {
|
||||
// If the likeTerm is empty after preparing, then don't bother searching.
|
||||
@@ -2900,7 +2900,7 @@ func (s SqlChannelStore) performSearch(searchQuery string, term string, paramete
|
||||
return nil, errors.Wrapf(err, "failed to find Channels with term='%s'", term)
|
||||
}
|
||||
|
||||
return &channels, nil
|
||||
return channels, nil
|
||||
}
|
||||
|
||||
func (s SqlChannelStore) getSearchGroupChannelsQuery(userId, term string, isPostgreSQL bool) (string, map[string]interface{}) {
|
||||
@@ -2991,7 +2991,7 @@ func (s SqlChannelStore) getSearchGroupChannelsQuery(userId, term string, isPost
|
||||
return query, args
|
||||
}
|
||||
|
||||
func (s SqlChannelStore) SearchGroupChannels(userId, term string) (*model.ChannelList, error) {
|
||||
func (s SqlChannelStore) SearchGroupChannels(userId, term string) (model.ChannelList, error) {
|
||||
isPostgreSQL := s.DriverName() == model.DatabaseDriverPostgres
|
||||
queryString, args := s.getSearchGroupChannelsQuery(userId, term, isPostgreSQL)
|
||||
|
||||
@@ -2999,10 +2999,10 @@ func (s SqlChannelStore) SearchGroupChannels(userId, term string) (*model.Channe
|
||||
if _, err := s.GetReplica().Select(&groupChannels, queryString, args); err != nil {
|
||||
return nil, errors.Wrapf(err, "failed to find Channels with term='%s' and userId=%s", term, userId)
|
||||
}
|
||||
return &groupChannels, nil
|
||||
return groupChannels, nil
|
||||
}
|
||||
|
||||
func (s SqlChannelStore) GetMembersByIds(channelId string, userIds []string) (*model.ChannelMembers, error) {
|
||||
func (s SqlChannelStore) GetMembersByIds(channelId string, userIds []string) (model.ChannelMembers, error) {
|
||||
var dbMembers channelMemberWithSchemeRolesList
|
||||
|
||||
keys, props := MapStringsToQueryParams(userIds, "User")
|
||||
@@ -3015,7 +3015,7 @@ func (s SqlChannelStore) GetMembersByIds(channelId string, userIds []string) (*m
|
||||
return dbMembers.ToModel(), nil
|
||||
}
|
||||
|
||||
func (s SqlChannelStore) GetMembersByChannelIds(channelIds []string, userId string) (*model.ChannelMembers, error) {
|
||||
func (s SqlChannelStore) GetMembersByChannelIds(channelIds []string, userId string) (model.ChannelMembers, error) {
|
||||
var dbMembers channelMemberWithSchemeRolesList
|
||||
|
||||
keys, props := MapStringsToQueryParams(channelIds, "Channel")
|
||||
|
||||
@@ -767,14 +767,14 @@ func (s SqlChannelStore) UpdateSidebarCategories(userId, teamId string, categori
|
||||
|
||||
// UpdateSidebarChannelsByPreferences is called when the Preference table is being updated to keep SidebarCategories in sync
|
||||
// At the moment, it's only handling Favorites and NOT DMs/GMs (those will be handled client side)
|
||||
func (s SqlChannelStore) UpdateSidebarChannelsByPreferences(preferences *model.Preferences) error {
|
||||
func (s SqlChannelStore) UpdateSidebarChannelsByPreferences(preferences model.Preferences) error {
|
||||
transaction, err := s.GetMaster().Begin()
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "UpdateSidebarChannelsByPreferences: begin_transaction")
|
||||
}
|
||||
defer finalizeTransaction(transaction)
|
||||
|
||||
for _, preference := range *preferences {
|
||||
for _, preference := range preferences {
|
||||
preference := preference
|
||||
|
||||
if preference.Category != model.PreferenceCategoryFavoriteChannel {
|
||||
@@ -918,14 +918,14 @@ func (s SqlChannelStore) addChannelToFavoritesCategoryT(transaction *gorp.Transa
|
||||
|
||||
// DeleteSidebarChannelsByPreferences is called when the Preference table is being updated to keep SidebarCategories in sync
|
||||
// At the moment, it's only handling Favorites and NOT DMs/GMs (those will be handled client side)
|
||||
func (s SqlChannelStore) DeleteSidebarChannelsByPreferences(preferences *model.Preferences) error {
|
||||
func (s SqlChannelStore) DeleteSidebarChannelsByPreferences(preferences model.Preferences) error {
|
||||
transaction, err := s.GetMaster().Begin()
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "DeleteSidebarChannelsByPreferences: begin_transaction")
|
||||
}
|
||||
defer finalizeTransaction(transaction)
|
||||
|
||||
for _, preference := range *preferences {
|
||||
for _, preference := range preferences {
|
||||
preference := preference
|
||||
|
||||
if preference.Category != model.PreferenceCategoryFavoriteChannel {
|
||||
|
||||
@@ -194,7 +194,7 @@ func createPostWithUserId(ss store.Store, id string) *model.Post {
|
||||
return createPost(ss, model.NewId(), id, "", "")
|
||||
}
|
||||
|
||||
func createPreferences(ss store.Store, userId string) *model.Preferences {
|
||||
func createPreferences(ss store.Store, userId string) model.Preferences {
|
||||
preferences := model.Preferences{
|
||||
{
|
||||
UserId: userId,
|
||||
@@ -203,8 +203,8 @@ func createPreferences(ss store.Store, userId string) *model.Preferences {
|
||||
Value: "somevalue",
|
||||
},
|
||||
}
|
||||
ss.Preference().Save(&preferences)
|
||||
return &preferences
|
||||
ss.Preference().Save(preferences)
|
||||
return preferences
|
||||
}
|
||||
|
||||
func createReaction(ss store.Store, userId, postId string) *model.Reaction {
|
||||
|
||||
@@ -50,7 +50,7 @@ func (s SqlPreferenceStore) deleteUnusedFeatures() {
|
||||
}
|
||||
}
|
||||
|
||||
func (s SqlPreferenceStore) Save(preferences *model.Preferences) error {
|
||||
func (s SqlPreferenceStore) Save(preferences model.Preferences) error {
|
||||
// wrap in a transaction so that if one fails, everything fails
|
||||
transaction, err := s.GetMaster().Begin()
|
||||
if err != nil {
|
||||
@@ -58,7 +58,7 @@ func (s SqlPreferenceStore) Save(preferences *model.Preferences) error {
|
||||
}
|
||||
|
||||
defer finalizeTransaction(transaction)
|
||||
for _, preference := range *preferences {
|
||||
for _, preference := range preferences {
|
||||
preference := preference
|
||||
if upsertErr := s.save(transaction, &preference); upsertErr != nil {
|
||||
return upsertErr
|
||||
|
||||
@@ -52,7 +52,7 @@ func TestDeleteUnusedFeatures(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
err := ss.Preference().Save(&features)
|
||||
err := ss.Preference().Save(features)
|
||||
require.NoError(t, err)
|
||||
|
||||
ss.Preference().(*SqlPreferenceStore).deleteUnusedFeatures()
|
||||
|
||||
@@ -42,9 +42,9 @@ func (s SqlProductNoticesStore) Clear(notices []string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s SqlProductNoticesStore) ClearOldNotices(currentNotices *model.ProductNotices) error {
|
||||
func (s SqlProductNoticesStore) ClearOldNotices(currentNotices model.ProductNotices) error {
|
||||
var notices []string
|
||||
for _, currentNotice := range *currentNotices {
|
||||
for _, currentNotice := range currentNotices {
|
||||
notices = append(notices, currentNotice.ID)
|
||||
}
|
||||
sql, args, _ := s.getQueryBuilder().Delete("ProductNoticeViewState").Where(sq.NotEq{"NoticeId": notices}).ToSql()
|
||||
|
||||
@@ -329,7 +329,7 @@ func upgradeDatabaseToVersion33(sqlStore *SqlStore) {
|
||||
data[i].Value = strings.Replace(data[i].Value, "solarized_", "solarized-", -1)
|
||||
}
|
||||
|
||||
sqlStore.Preference().Save(&data)
|
||||
sqlStore.Preference().Save(data)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -241,7 +241,7 @@ func TestMsgCountRootMigration(t *testing.T) {
|
||||
members, err := ss.Channel().GetMembersByIds(channel.Id, userIds)
|
||||
require.NoError(t, err)
|
||||
|
||||
for _, m := range *members {
|
||||
for _, m := range members {
|
||||
for i, uid := range userIds {
|
||||
if m.UserId == uid {
|
||||
assert.Equal(t, testChannel.ExpectedMembershipMsgCountRoot[i], m.MsgCountRoot)
|
||||
|
||||
@@ -177,16 +177,16 @@ type ChannelStore interface {
|
||||
GetByNames(team_id string, names []string, allowFromCache bool) ([]*model.Channel, error)
|
||||
GetByNameIncludeDeleted(team_id string, name string, allowFromCache bool) (*model.Channel, error)
|
||||
GetDeletedByName(team_id string, name string) (*model.Channel, error)
|
||||
GetDeleted(team_id string, offset int, limit int, userID string) (*model.ChannelList, error)
|
||||
GetChannels(teamID string, userID string, includeDeleted bool, lastDeleteAt int) (*model.ChannelList, error)
|
||||
GetAllChannels(page, perPage int, opts ChannelSearchOpts) (*model.ChannelListWithTeamData, error)
|
||||
GetDeleted(team_id string, offset int, limit int, userID string) (model.ChannelList, error)
|
||||
GetChannels(teamID string, userID string, includeDeleted bool, lastDeleteAt int) (model.ChannelList, error)
|
||||
GetAllChannels(page, perPage int, opts ChannelSearchOpts) (model.ChannelListWithTeamData, error)
|
||||
GetAllChannelsCount(opts ChannelSearchOpts) (int64, error)
|
||||
GetMoreChannels(teamID string, userID string, offset int, limit int) (*model.ChannelList, error)
|
||||
GetPrivateChannelsForTeam(teamID string, offset int, limit int) (*model.ChannelList, error)
|
||||
GetPublicChannelsForTeam(teamID string, offset int, limit int) (*model.ChannelList, error)
|
||||
GetPublicChannelsByIdsForTeam(teamID string, channelIds []string) (*model.ChannelList, error)
|
||||
GetMoreChannels(teamID string, userID string, offset int, limit int) (model.ChannelList, error)
|
||||
GetPrivateChannelsForTeam(teamID string, offset int, limit int) (model.ChannelList, error)
|
||||
GetPublicChannelsForTeam(teamID string, offset int, limit int) (model.ChannelList, error)
|
||||
GetPublicChannelsByIdsForTeam(teamID string, channelIds []string) (model.ChannelList, error)
|
||||
GetChannelCounts(teamID string, userID string) (*model.ChannelCounts, error)
|
||||
GetTeamChannels(teamID string) (*model.ChannelList, error)
|
||||
GetTeamChannels(teamID string) (model.ChannelList, error)
|
||||
GetAll(teamID string) ([]*model.Channel, error)
|
||||
GetChannelsByIds(channelIds []string, includeDeleted bool) ([]*model.Channel, error)
|
||||
GetForPost(postID string) (*model.Channel, error)
|
||||
@@ -194,7 +194,7 @@ type ChannelStore interface {
|
||||
SaveMember(member *model.ChannelMember) (*model.ChannelMember, error)
|
||||
UpdateMember(member *model.ChannelMember) (*model.ChannelMember, error)
|
||||
UpdateMultipleMembers(members []*model.ChannelMember) ([]*model.ChannelMember, error)
|
||||
GetMembers(channelID string, offset, limit int) (*model.ChannelMembers, error)
|
||||
GetMembers(channelID string, offset, limit int) (model.ChannelMembers, error)
|
||||
GetMember(ctx context.Context, channelID string, userID string) (*model.ChannelMember, error)
|
||||
GetChannelMembersTimezones(channelID string) ([]model.StringMap, error)
|
||||
GetAllChannelMembersForUser(userID string, allowFromCache bool, includeDeleted bool) (map[string]string, error)
|
||||
@@ -221,18 +221,18 @@ type ChannelStore interface {
|
||||
CountPostsAfter(channelID string, timestamp int64, userID string) (int, int, error)
|
||||
IncrementMentionCount(channelID string, userID string, updateThreads, isRoot bool) error
|
||||
AnalyticsTypeCount(teamID string, channelType model.ChannelType) (int64, error)
|
||||
GetMembersForUser(teamID string, userID string) (*model.ChannelMembers, error)
|
||||
GetMembersForUserWithPagination(teamID, userID string, page, perPage int) (*model.ChannelMembers, error)
|
||||
AutocompleteInTeam(teamID string, term string, includeDeleted bool) (*model.ChannelList, error)
|
||||
AutocompleteInTeamForSearch(teamID string, userID string, term string, includeDeleted bool) (*model.ChannelList, error)
|
||||
SearchAllChannels(term string, opts ChannelSearchOpts) (*model.ChannelListWithTeamData, int64, error)
|
||||
SearchInTeam(teamID string, term string, includeDeleted bool) (*model.ChannelList, error)
|
||||
SearchArchivedInTeam(teamID string, term string, userID string) (*model.ChannelList, error)
|
||||
SearchForUserInTeam(userID string, teamID string, term string, includeDeleted bool) (*model.ChannelList, error)
|
||||
SearchMore(userID string, teamID string, term string) (*model.ChannelList, error)
|
||||
SearchGroupChannels(userID, term string) (*model.ChannelList, error)
|
||||
GetMembersByIds(channelID string, userIds []string) (*model.ChannelMembers, error)
|
||||
GetMembersByChannelIds(channelIds []string, userID string) (*model.ChannelMembers, error)
|
||||
GetMembersForUser(teamID string, userID string) (model.ChannelMembers, error)
|
||||
GetMembersForUserWithPagination(teamID, userID string, page, perPage int) (model.ChannelMembers, error)
|
||||
AutocompleteInTeam(teamID string, term string, includeDeleted bool) (model.ChannelList, error)
|
||||
AutocompleteInTeamForSearch(teamID string, userID string, term string, includeDeleted bool) (model.ChannelList, error)
|
||||
SearchAllChannels(term string, opts ChannelSearchOpts) (model.ChannelListWithTeamData, int64, error)
|
||||
SearchInTeam(teamID string, term string, includeDeleted bool) (model.ChannelList, error)
|
||||
SearchArchivedInTeam(teamID string, term string, userID string) (model.ChannelList, error)
|
||||
SearchForUserInTeam(userID string, teamID string, term string, includeDeleted bool) (model.ChannelList, error)
|
||||
SearchMore(userID string, teamID string, term string) (model.ChannelList, error)
|
||||
SearchGroupChannels(userID, term string) (model.ChannelList, error)
|
||||
GetMembersByIds(channelID string, userIds []string) (model.ChannelMembers, error)
|
||||
GetMembersByChannelIds(channelIds []string, userID string) (model.ChannelMembers, error)
|
||||
AnalyticsDeletedTypeCount(teamID string, channelType string) (int64, error)
|
||||
GetChannelUnread(channelID, userID string) (*model.ChannelUnread, error)
|
||||
ClearCaches()
|
||||
@@ -248,8 +248,8 @@ type ChannelStore interface {
|
||||
CreateSidebarCategory(userID, teamID string, newCategory *model.SidebarCategoryWithChannels) (*model.SidebarCategoryWithChannels, error)
|
||||
UpdateSidebarCategoryOrder(userID, teamID string, categoryOrder []string) error
|
||||
UpdateSidebarCategories(userID, teamID string, categories []*model.SidebarCategoryWithChannels) ([]*model.SidebarCategoryWithChannels, []*model.SidebarCategoryWithChannels, error)
|
||||
UpdateSidebarChannelsByPreferences(preferences *model.Preferences) error
|
||||
DeleteSidebarChannelsByPreferences(preferences *model.Preferences) error
|
||||
UpdateSidebarChannelsByPreferences(preferences model.Preferences) error
|
||||
DeleteSidebarChannelsByPreferences(preferences model.Preferences) error
|
||||
DeleteSidebarCategory(categoryID string) error
|
||||
GetAllChannelsForExportAfter(limit int, afterID string) ([]*model.ChannelForExport, error)
|
||||
GetAllDirectChannelsForExportAfter(limit int, afterID string) ([]*model.DirectChannelForExport, error)
|
||||
@@ -574,7 +574,7 @@ type CommandWebhookStore interface {
|
||||
}
|
||||
|
||||
type PreferenceStore interface {
|
||||
Save(preferences *model.Preferences) error
|
||||
Save(preferences model.Preferences) error
|
||||
GetCategory(userID string, category string) (model.Preferences, error)
|
||||
Get(userID string, category string, name string) (*model.Preference, error)
|
||||
GetAll(userID string) (model.Preferences, error)
|
||||
@@ -746,7 +746,7 @@ type TermsOfServiceStore interface {
|
||||
type ProductNoticesStore interface {
|
||||
View(userID string, notices []string) error
|
||||
Clear(notices []string) error
|
||||
ClearOldNotices(currentNotices *model.ProductNotices) error
|
||||
ClearOldNotices(currentNotices model.ProductNotices) error
|
||||
GetViews(userID string) ([]model.ProductNoticeViewState, error)
|
||||
}
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ type SqlStore interface {
|
||||
func cleanupChannels(t *testing.T, ss store.Store) {
|
||||
list, err := ss.Channel().GetAllChannels(0, 100000, store.ChannelSearchOpts{IncludeDeleted: true})
|
||||
require.NoError(t, err, "error cleaning all channels", err)
|
||||
for _, channel := range *list {
|
||||
for _, channel := range list {
|
||||
err = ss.Channel().PermanentDelete(channel.Id)
|
||||
assert.NoError(t, err)
|
||||
}
|
||||
@@ -206,7 +206,7 @@ func testChannelStoreSaveDirectChannel(t *testing.T, ss store.Store, s SqlStore)
|
||||
|
||||
members, nErr := ss.Channel().GetMembers(o1.Id, 0, 100)
|
||||
require.NoError(t, nErr)
|
||||
require.Len(t, *members, 2, "should have saved 2 members")
|
||||
require.Len(t, members, 2, "should have saved 2 members")
|
||||
|
||||
_, nErr = ss.Channel().SaveDirectChannel(&o1, &m1, &m2)
|
||||
require.Error(t, nErr, "shoudn't be a able to update from save")
|
||||
@@ -242,7 +242,7 @@ func testChannelStoreSaveDirectChannel(t *testing.T, ss store.Store, s SqlStore)
|
||||
|
||||
members, nErr = ss.Channel().GetMembers(o1.Id, 0, 100)
|
||||
require.NoError(t, nErr)
|
||||
require.Len(t, *members, 1, "should have saved just 1 member")
|
||||
require.Len(t, members, 1, "should have saved just 1 member")
|
||||
|
||||
// Manually truncate Channels table until testlib can handle cleanups
|
||||
s.GetMaster().Exec("TRUNCATE Channels")
|
||||
@@ -274,7 +274,7 @@ func testChannelStoreCreateDirectChannel(t *testing.T, ss store.Store) {
|
||||
|
||||
members, nErr := ss.Channel().GetMembers(c1.Id, 0, 100)
|
||||
require.NoError(t, nErr)
|
||||
require.Len(t, *members, 2, "should have saved 2 members")
|
||||
require.Len(t, members, 2, "should have saved 2 members")
|
||||
}
|
||||
|
||||
func testChannelStoreUpdate(t *testing.T, ss store.Store) {
|
||||
@@ -432,7 +432,7 @@ func testChannelStoreGet(t *testing.T, ss store.Store, s SqlStore) {
|
||||
|
||||
channelsTeam, err := ss.Channel().GetTeamChannels(o1.TeamId)
|
||||
require.NoError(t, err, err)
|
||||
require.Greater(t, len(*channelsTeam), 0, "too little")
|
||||
require.Greater(t, len(channelsTeam), 0, "too little")
|
||||
|
||||
// Manually truncate Channels table until testlib can handle cleanups
|
||||
s.GetMaster().Exec("TRUNCATE Channels")
|
||||
@@ -623,11 +623,11 @@ func testChannelStoreDelete(t *testing.T, ss store.Store) {
|
||||
|
||||
list, nErr := ss.Channel().GetChannels(o1.TeamId, m1.UserId, false, 0)
|
||||
require.NoError(t, nErr)
|
||||
require.Len(t, *list, 1, "invalid number of channels")
|
||||
require.Len(t, list, 1, "invalid number of channels")
|
||||
|
||||
list, nErr = ss.Channel().GetMoreChannels(o1.TeamId, m1.UserId, 0, 100)
|
||||
require.NoError(t, nErr)
|
||||
require.Len(t, *list, 1, "invalid number of channels")
|
||||
require.Len(t, list, 1, "invalid number of channels")
|
||||
|
||||
cresult := ss.Channel().PermanentDelete(o2.Id)
|
||||
require.NoError(t, cresult)
|
||||
@@ -637,7 +637,7 @@ func testChannelStoreDelete(t *testing.T, ss store.Store) {
|
||||
var nfErr *store.ErrNotFound
|
||||
require.True(t, errors.As(nErr, &nfErr))
|
||||
} else {
|
||||
require.Equal(t, &model.ChannelList{}, list)
|
||||
require.Equal(t, model.ChannelList{}, list)
|
||||
}
|
||||
|
||||
nErr = ss.Channel().PermanentDeleteByTeam(o1.TeamId)
|
||||
@@ -771,8 +771,8 @@ func testChannelStoreGetDeleted(t *testing.T, ss store.Store) {
|
||||
|
||||
list, nErr := ss.Channel().GetDeleted(o1.TeamId, 0, 100, userId)
|
||||
require.NoError(t, nErr, nErr)
|
||||
require.Len(t, *list, 1, "wrong list")
|
||||
require.Equal(t, o1.Name, (*list)[0].Name, "missing channel")
|
||||
require.Len(t, list, 1, "wrong list")
|
||||
require.Equal(t, o1.Name, list[0].Name, "missing channel")
|
||||
|
||||
o2 := model.Channel{}
|
||||
o2.TeamId = o1.TeamId
|
||||
@@ -784,7 +784,7 @@ func testChannelStoreGetDeleted(t *testing.T, ss store.Store) {
|
||||
|
||||
list, nErr = ss.Channel().GetDeleted(o1.TeamId, 0, 100, userId)
|
||||
require.NoError(t, nErr, nErr)
|
||||
require.Len(t, *list, 1, "wrong list")
|
||||
require.Len(t, list, 1, "wrong list")
|
||||
|
||||
o3 := model.Channel{}
|
||||
o3.TeamId = o1.TeamId
|
||||
@@ -800,15 +800,15 @@ func testChannelStoreGetDeleted(t *testing.T, ss store.Store) {
|
||||
|
||||
list, nErr = ss.Channel().GetDeleted(o1.TeamId, 0, 100, userId)
|
||||
require.NoError(t, nErr, nErr)
|
||||
require.Len(t, *list, 2, "wrong list length")
|
||||
require.Len(t, list, 2, "wrong list length")
|
||||
|
||||
list, nErr = ss.Channel().GetDeleted(o1.TeamId, 0, 1, userId)
|
||||
require.NoError(t, nErr, nErr)
|
||||
require.Len(t, *list, 1, "wrong list length")
|
||||
require.Len(t, list, 1, "wrong list length")
|
||||
|
||||
list, nErr = ss.Channel().GetDeleted(o1.TeamId, 1, 1, userId)
|
||||
require.NoError(t, nErr, nErr)
|
||||
require.Len(t, *list, 1, "wrong list length")
|
||||
require.Len(t, list, 1, "wrong list length")
|
||||
|
||||
}
|
||||
|
||||
@@ -3177,10 +3177,10 @@ func testChannelStoreGetChannels(t *testing.T, ss store.Store) {
|
||||
|
||||
list, nErr := ss.Channel().GetChannels(o1.TeamId, m1.UserId, false, 0)
|
||||
require.NoError(t, nErr)
|
||||
require.Len(t, *list, 3)
|
||||
require.Equal(t, o1.Id, (*list)[0].Id, "missing channel")
|
||||
require.Equal(t, o2.Id, (*list)[1].Id, "missing channel")
|
||||
require.Equal(t, o3.Id, (*list)[2].Id, "missing channel")
|
||||
require.Len(t, list, 3)
|
||||
require.Equal(t, o1.Id, list[0].Id, "missing channel")
|
||||
require.Equal(t, o2.Id, list[1].Id, "missing channel")
|
||||
require.Equal(t, o3.Id, list[2].Id, "missing channel")
|
||||
|
||||
ids, err := ss.Channel().GetAllChannelMembersForUser(m1.UserId, false, false)
|
||||
require.NoError(t, err)
|
||||
@@ -3211,31 +3211,31 @@ func testChannelStoreGetChannels(t *testing.T, ss store.Store) {
|
||||
// should return 1
|
||||
list, nErr = ss.Channel().GetChannels(o1.TeamId, m1.UserId, false, 0)
|
||||
require.NoError(t, nErr)
|
||||
require.Len(t, *list, 1)
|
||||
require.Equal(t, o1.Id, (*list)[0].Id, "missing channel")
|
||||
require.Len(t, list, 1)
|
||||
require.Equal(t, o1.Id, list[0].Id, "missing channel")
|
||||
|
||||
// Should return all
|
||||
list, nErr = ss.Channel().GetChannels(o1.TeamId, m1.UserId, true, 0)
|
||||
require.NoError(t, nErr)
|
||||
require.Len(t, *list, 3)
|
||||
require.Equal(t, o1.Id, (*list)[0].Id, "missing channel")
|
||||
require.Equal(t, o2.Id, (*list)[1].Id, "missing channel")
|
||||
require.Equal(t, o3.Id, (*list)[2].Id, "missing channel")
|
||||
require.Len(t, list, 3)
|
||||
require.Equal(t, o1.Id, list[0].Id, "missing channel")
|
||||
require.Equal(t, o2.Id, list[1].Id, "missing channel")
|
||||
require.Equal(t, o3.Id, list[2].Id, "missing channel")
|
||||
|
||||
// Should still return all
|
||||
list, nErr = ss.Channel().GetChannels(o1.TeamId, m1.UserId, true, 10)
|
||||
require.NoError(t, nErr)
|
||||
require.Len(t, *list, 3)
|
||||
require.Equal(t, o1.Id, (*list)[0].Id, "missing channel")
|
||||
require.Equal(t, o2.Id, (*list)[1].Id, "missing channel")
|
||||
require.Equal(t, o3.Id, (*list)[2].Id, "missing channel")
|
||||
require.Len(t, list, 3)
|
||||
require.Equal(t, o1.Id, list[0].Id, "missing channel")
|
||||
require.Equal(t, o2.Id, list[1].Id, "missing channel")
|
||||
require.Equal(t, o3.Id, list[2].Id, "missing channel")
|
||||
|
||||
// Should return 2
|
||||
list, nErr = ss.Channel().GetChannels(o1.TeamId, m1.UserId, true, 20)
|
||||
require.NoError(t, nErr)
|
||||
require.Len(t, *list, 2)
|
||||
require.Equal(t, o1.Id, (*list)[0].Id, "missing channel")
|
||||
require.Equal(t, o3.Id, (*list)[1].Id, "missing channel")
|
||||
require.Len(t, list, 2)
|
||||
require.Equal(t, o1.Id, list[0].Id, "missing channel")
|
||||
require.Equal(t, o3.Id, list[1].Id, "missing channel")
|
||||
|
||||
require.True(
|
||||
t,
|
||||
@@ -3335,22 +3335,22 @@ func testChannelStoreGetAllChannels(t *testing.T, ss store.Store, s SqlStore) {
|
||||
|
||||
list, nErr := ss.Channel().GetAllChannels(0, 10, store.ChannelSearchOpts{})
|
||||
require.NoError(t, nErr)
|
||||
assert.Len(t, *list, 2)
|
||||
assert.Equal(t, c1.Id, (*list)[0].Id)
|
||||
assert.Equal(t, "Name", (*list)[0].TeamDisplayName)
|
||||
assert.Equal(t, c3.Id, (*list)[1].Id)
|
||||
assert.Equal(t, "Name2", (*list)[1].TeamDisplayName)
|
||||
assert.Len(t, list, 2)
|
||||
assert.Equal(t, c1.Id, list[0].Id)
|
||||
assert.Equal(t, "Name", list[0].TeamDisplayName)
|
||||
assert.Equal(t, c3.Id, list[1].Id)
|
||||
assert.Equal(t, "Name2", list[1].TeamDisplayName)
|
||||
|
||||
count1, nErr := ss.Channel().GetAllChannelsCount(store.ChannelSearchOpts{})
|
||||
require.NoError(t, nErr)
|
||||
|
||||
list, nErr = ss.Channel().GetAllChannels(0, 10, store.ChannelSearchOpts{IncludeDeleted: true})
|
||||
require.NoError(t, nErr)
|
||||
assert.Len(t, *list, 3)
|
||||
assert.Equal(t, c1.Id, (*list)[0].Id)
|
||||
assert.Equal(t, "Name", (*list)[0].TeamDisplayName)
|
||||
assert.Equal(t, c2.Id, (*list)[1].Id)
|
||||
assert.Equal(t, c3.Id, (*list)[2].Id)
|
||||
assert.Len(t, list, 3)
|
||||
assert.Equal(t, c1.Id, list[0].Id)
|
||||
assert.Equal(t, "Name", list[0].TeamDisplayName)
|
||||
assert.Equal(t, c2.Id, list[1].Id)
|
||||
assert.Equal(t, c3.Id, list[2].Id)
|
||||
|
||||
count2, nErr := ss.Channel().GetAllChannelsCount(store.ChannelSearchOpts{IncludeDeleted: true})
|
||||
require.NoError(t, nErr)
|
||||
@@ -3360,19 +3360,19 @@ func testChannelStoreGetAllChannels(t *testing.T, ss store.Store, s SqlStore) {
|
||||
|
||||
list, nErr = ss.Channel().GetAllChannels(0, 1, store.ChannelSearchOpts{IncludeDeleted: true})
|
||||
require.NoError(t, nErr)
|
||||
assert.Len(t, *list, 1)
|
||||
assert.Equal(t, c1.Id, (*list)[0].Id)
|
||||
assert.Equal(t, "Name", (*list)[0].TeamDisplayName)
|
||||
assert.Len(t, list, 1)
|
||||
assert.Equal(t, c1.Id, list[0].Id)
|
||||
assert.Equal(t, "Name", list[0].TeamDisplayName)
|
||||
|
||||
// Not associated to group
|
||||
list, nErr = ss.Channel().GetAllChannels(0, 10, store.ChannelSearchOpts{NotAssociatedToGroup: group.Id})
|
||||
require.NoError(t, nErr)
|
||||
assert.Len(t, *list, 1)
|
||||
assert.Len(t, list, 1)
|
||||
|
||||
// Exclude channel names
|
||||
list, nErr = ss.Channel().GetAllChannels(0, 10, store.ChannelSearchOpts{ExcludeChannelNames: []string{c1.Name}})
|
||||
require.NoError(t, nErr)
|
||||
assert.Len(t, *list, 1)
|
||||
assert.Len(t, list, 1)
|
||||
|
||||
// Exclude policy constrained
|
||||
policy, nErr := ss.RetentionPolicy().Save(&model.RetentionPolicyWithTeamAndChannelIDs{
|
||||
@@ -3385,21 +3385,21 @@ func testChannelStoreGetAllChannels(t *testing.T, ss store.Store, s SqlStore) {
|
||||
require.NoError(t, nErr)
|
||||
list, nErr = ss.Channel().GetAllChannels(0, 10, store.ChannelSearchOpts{ExcludePolicyConstrained: true})
|
||||
require.NoError(t, nErr)
|
||||
assert.Len(t, *list, 1)
|
||||
assert.Equal(t, c3.Id, (*list)[0].Id)
|
||||
assert.Len(t, list, 1)
|
||||
assert.Equal(t, c3.Id, list[0].Id)
|
||||
|
||||
// Without the policy ID
|
||||
list, nErr = ss.Channel().GetAllChannels(0, 1, store.ChannelSearchOpts{})
|
||||
require.NoError(t, nErr)
|
||||
assert.Len(t, *list, 1)
|
||||
assert.Equal(t, c1.Id, (*list)[0].Id)
|
||||
assert.Nil(t, (*list)[0].PolicyID)
|
||||
assert.Len(t, list, 1)
|
||||
assert.Equal(t, c1.Id, list[0].Id)
|
||||
assert.Nil(t, list[0].PolicyID)
|
||||
// With the policy ID
|
||||
list, nErr = ss.Channel().GetAllChannels(0, 1, store.ChannelSearchOpts{IncludePolicyID: true})
|
||||
require.NoError(t, nErr)
|
||||
assert.Len(t, *list, 1)
|
||||
assert.Equal(t, c1.Id, (*list)[0].Id)
|
||||
assert.Equal(t, *(*list)[0].PolicyID, policy.ID)
|
||||
assert.Len(t, list, 1)
|
||||
assert.Equal(t, c1.Id, list[0].Id)
|
||||
assert.Equal(t, *list[0].PolicyID, policy.ID)
|
||||
|
||||
// Manually truncate Channels table until testlib can handle cleanups
|
||||
s.GetMaster().Exec("TRUNCATE Channels")
|
||||
@@ -3494,7 +3494,7 @@ func testChannelStoreGetMoreChannels(t *testing.T, ss store.Store) {
|
||||
t.Run("only o3 listed in more channels", func(t *testing.T) {
|
||||
list, channelErr := ss.Channel().GetMoreChannels(teamId, userId, 0, 100)
|
||||
require.NoError(t, channelErr)
|
||||
require.Equal(t, &model.ChannelList{&o3}, list)
|
||||
require.Equal(t, model.ChannelList{&o3}, list)
|
||||
})
|
||||
|
||||
// o6 is another channel on the team to which the user does not belong, and would thus
|
||||
@@ -3525,19 +3525,19 @@ func testChannelStoreGetMoreChannels(t *testing.T, ss store.Store) {
|
||||
t.Run("both o3 and o6 listed in more channels", func(t *testing.T) {
|
||||
list, err := ss.Channel().GetMoreChannels(teamId, userId, 0, 100)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, &model.ChannelList{&o3, &o6}, list)
|
||||
require.Equal(t, model.ChannelList{&o3, &o6}, list)
|
||||
})
|
||||
|
||||
t.Run("only o3 listed in more channels with offset 0, limit 1", func(t *testing.T) {
|
||||
list, err := ss.Channel().GetMoreChannels(teamId, userId, 0, 1)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, &model.ChannelList{&o3}, list)
|
||||
require.Equal(t, model.ChannelList{&o3}, list)
|
||||
})
|
||||
|
||||
t.Run("only o6 listed in more channels with offset 1, limit 1", func(t *testing.T) {
|
||||
list, err := ss.Channel().GetMoreChannels(teamId, userId, 1, 1)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, &model.ChannelList{&o6}, list)
|
||||
require.Equal(t, model.ChannelList{&o6}, list)
|
||||
})
|
||||
|
||||
t.Run("verify analytics for open channels", func(t *testing.T) {
|
||||
@@ -3589,7 +3589,7 @@ func testChannelStoreGetPrivateChannelsForTeam(t *testing.T, ss store.Store) {
|
||||
t.Run("only p1 initially listed in private channels", func(t *testing.T) {
|
||||
list, channelErr := ss.Channel().GetPrivateChannelsForTeam(teamId, 0, 100)
|
||||
require.NoError(t, channelErr)
|
||||
require.Equal(t, &model.ChannelList{&p1}, list)
|
||||
require.Equal(t, model.ChannelList{&p1}, list)
|
||||
})
|
||||
|
||||
// p3 is another private channel on the team
|
||||
@@ -3617,19 +3617,19 @@ func testChannelStoreGetPrivateChannelsForTeam(t *testing.T, ss store.Store) {
|
||||
t.Run("both p1 and p3 listed in private channels", func(t *testing.T) {
|
||||
list, err := ss.Channel().GetPrivateChannelsForTeam(teamId, 0, 100)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, &model.ChannelList{&p1, &p3}, list)
|
||||
require.Equal(t, model.ChannelList{&p1, &p3}, list)
|
||||
})
|
||||
|
||||
t.Run("only p1 listed in private channels with offset 0, limit 1", func(t *testing.T) {
|
||||
list, err := ss.Channel().GetPrivateChannelsForTeam(teamId, 0, 1)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, &model.ChannelList{&p1}, list)
|
||||
require.Equal(t, model.ChannelList{&p1}, list)
|
||||
})
|
||||
|
||||
t.Run("only p3 listed in private channels with offset 1, limit 1", func(t *testing.T) {
|
||||
list, err := ss.Channel().GetPrivateChannelsForTeam(teamId, 1, 1)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, &model.ChannelList{&p3}, list)
|
||||
require.Equal(t, model.ChannelList{&p3}, list)
|
||||
})
|
||||
|
||||
t.Run("verify analytics for private channels", func(t *testing.T) {
|
||||
@@ -3681,7 +3681,7 @@ func testChannelStoreGetPublicChannelsForTeam(t *testing.T, ss store.Store) {
|
||||
t.Run("only o1 initially listed in public channels", func(t *testing.T) {
|
||||
list, channelErr := ss.Channel().GetPublicChannelsForTeam(teamId, 0, 100)
|
||||
require.NoError(t, channelErr)
|
||||
require.Equal(t, &model.ChannelList{&o1}, list)
|
||||
require.Equal(t, model.ChannelList{&o1}, list)
|
||||
})
|
||||
|
||||
// o4 is another public channel on the team
|
||||
@@ -3709,19 +3709,19 @@ func testChannelStoreGetPublicChannelsForTeam(t *testing.T, ss store.Store) {
|
||||
t.Run("both o1 and o4 listed in public channels", func(t *testing.T) {
|
||||
list, err := ss.Channel().GetPublicChannelsForTeam(teamId, 0, 100)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, &model.ChannelList{&o1, &o4}, list)
|
||||
require.Equal(t, model.ChannelList{&o1, &o4}, list)
|
||||
})
|
||||
|
||||
t.Run("only o1 listed in public channels with offset 0, limit 1", func(t *testing.T) {
|
||||
list, err := ss.Channel().GetPublicChannelsForTeam(teamId, 0, 1)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, &model.ChannelList{&o1}, list)
|
||||
require.Equal(t, model.ChannelList{&o1}, list)
|
||||
})
|
||||
|
||||
t.Run("only o4 listed in public channels with offset 1, limit 1", func(t *testing.T) {
|
||||
list, err := ss.Channel().GetPublicChannelsForTeam(teamId, 1, 1)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, &model.ChannelList{&o4}, list)
|
||||
require.Equal(t, model.ChannelList{&o4}, list)
|
||||
})
|
||||
|
||||
t.Run("verify analytics for open channels", func(t *testing.T) {
|
||||
@@ -3773,13 +3773,13 @@ func testChannelStoreGetPublicChannelsByIdsForTeam(t *testing.T, ss store.Store)
|
||||
t.Run("oc1 by itself should be found as a public channel in the team", func(t *testing.T) {
|
||||
list, channelErr := ss.Channel().GetPublicChannelsByIdsForTeam(teamId, []string{oc1.Id})
|
||||
require.NoError(t, channelErr)
|
||||
require.Equal(t, &model.ChannelList{&oc1}, list)
|
||||
require.Equal(t, model.ChannelList{&oc1}, list)
|
||||
})
|
||||
|
||||
t.Run("only oc1, among others, should be found as a public channel in the team", func(t *testing.T) {
|
||||
list, channelErr := ss.Channel().GetPublicChannelsByIdsForTeam(teamId, []string{oc1.Id, oc2.Id, model.NewId(), pc3.Id})
|
||||
require.NoError(t, channelErr)
|
||||
require.Equal(t, &model.ChannelList{&oc1}, list)
|
||||
require.Equal(t, model.ChannelList{&oc1}, list)
|
||||
})
|
||||
|
||||
// oc4 is another public channel on the team
|
||||
@@ -3808,7 +3808,7 @@ func testChannelStoreGetPublicChannelsByIdsForTeam(t *testing.T, ss store.Store)
|
||||
t.Run("only oc1 and oc4, among others, should be found as a public channel in the team", func(t *testing.T) {
|
||||
list, err := ss.Channel().GetPublicChannelsByIdsForTeam(teamId, []string{oc1.Id, oc2.Id, model.NewId(), pc3.Id, oc4.Id})
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, &model.ChannelList{&oc1, &oc4}, list)
|
||||
require.Equal(t, model.ChannelList{&oc1, &oc4}, list)
|
||||
})
|
||||
|
||||
t.Run("random channel id should not be found as a public channel in the team", func(t *testing.T) {
|
||||
@@ -3903,11 +3903,11 @@ func testChannelStoreGetMembersForUser(t *testing.T, ss store.Store) {
|
||||
require.NoError(t, err)
|
||||
|
||||
t.Run("with channels", func(t *testing.T) {
|
||||
var members *model.ChannelMembers
|
||||
var members model.ChannelMembers
|
||||
members, err = ss.Channel().GetMembersForUser(o1.TeamId, m1.UserId)
|
||||
require.NoError(t, err)
|
||||
|
||||
assert.Len(t, *members, 2)
|
||||
assert.Len(t, members, 2)
|
||||
})
|
||||
|
||||
t.Run("with channels and direct messages", func(t *testing.T) {
|
||||
@@ -3924,11 +3924,11 @@ func testChannelStoreGetMembersForUser(t *testing.T, ss store.Store) {
|
||||
_, nErr = ss.Channel().CreateDirectChannel(&u3, &u4)
|
||||
require.NoError(t, nErr)
|
||||
|
||||
var members *model.ChannelMembers
|
||||
var members model.ChannelMembers
|
||||
members, err = ss.Channel().GetMembersForUser(o1.TeamId, m1.UserId)
|
||||
require.NoError(t, err)
|
||||
|
||||
assert.Len(t, *members, 4)
|
||||
assert.Len(t, members, 4)
|
||||
})
|
||||
|
||||
t.Run("with channels, direct channels and group messages", func(t *testing.T) {
|
||||
@@ -3952,11 +3952,11 @@ func testChannelStoreGetMembersForUser(t *testing.T, ss store.Store) {
|
||||
_, err = ss.Channel().SaveMember(cm)
|
||||
require.NoError(t, err)
|
||||
}
|
||||
var members *model.ChannelMembers
|
||||
var members model.ChannelMembers
|
||||
members, err = ss.Channel().GetMembersForUser(o1.TeamId, m1.UserId)
|
||||
require.NoError(t, err)
|
||||
|
||||
assert.Len(t, *members, 5)
|
||||
assert.Len(t, members, 5)
|
||||
})
|
||||
}
|
||||
|
||||
@@ -4001,11 +4001,11 @@ func testChannelStoreGetMembersForUserWithPagination(t *testing.T, ss store.Stor
|
||||
|
||||
members, err := ss.Channel().GetMembersForUserWithPagination(o1.TeamId, m1.UserId, 0, 1)
|
||||
require.NoError(t, err)
|
||||
assert.Len(t, *members, 1)
|
||||
assert.Len(t, members, 1)
|
||||
|
||||
members, err = ss.Channel().GetMembersForUserWithPagination(o1.TeamId, m1.UserId, 1, 1)
|
||||
require.NoError(t, err)
|
||||
assert.Len(t, *members, 1)
|
||||
assert.Len(t, members, 1)
|
||||
}
|
||||
|
||||
func testCountPostsAfter(t *testing.T, ss store.Store) {
|
||||
@@ -4940,31 +4940,31 @@ func testChannelStoreSearchMore(t *testing.T, ss store.Store) {
|
||||
t.Run("three public channels matching 'ChannelA', but already a member of one and one deleted", func(t *testing.T) {
|
||||
channels, err := ss.Channel().SearchMore(m1.UserId, teamId, "ChannelA")
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, &model.ChannelList{&o3}, channels)
|
||||
require.Equal(t, model.ChannelList{&o3}, channels)
|
||||
})
|
||||
|
||||
t.Run("one public channels, but already a member", func(t *testing.T) {
|
||||
channels, err := ss.Channel().SearchMore(m1.UserId, teamId, o4.Name)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, &model.ChannelList{}, channels)
|
||||
require.Equal(t, model.ChannelList{}, channels)
|
||||
})
|
||||
|
||||
t.Run("three matching channels, but only two public", func(t *testing.T) {
|
||||
channels, err := ss.Channel().SearchMore(m1.UserId, teamId, "off-")
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, &model.ChannelList{&o7, &o6}, channels)
|
||||
require.Equal(t, model.ChannelList{&o7, &o6}, channels)
|
||||
})
|
||||
|
||||
t.Run("one channel matching 'off-topic'", func(t *testing.T) {
|
||||
channels, err := ss.Channel().SearchMore(m1.UserId, teamId, "off-topic")
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, &model.ChannelList{&o6}, channels)
|
||||
require.Equal(t, model.ChannelList{&o6}, channels)
|
||||
})
|
||||
|
||||
t.Run("search purpose", func(t *testing.T) {
|
||||
channels, err := ss.Channel().SearchMore(m1.UserId, teamId, "now searchable")
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, &model.ChannelList{&o9}, channels)
|
||||
require.Equal(t, model.ChannelList{&o9}, channels)
|
||||
})
|
||||
}
|
||||
|
||||
@@ -5159,23 +5159,23 @@ func testChannelStoreSearchInTeam(t *testing.T, ss store.Store) {
|
||||
TeamId string
|
||||
Term string
|
||||
IncludeDeleted bool
|
||||
ExpectedResults *model.ChannelList
|
||||
ExpectedResults model.ChannelList
|
||||
}{
|
||||
{"ChannelA", teamId, "ChannelA", false, &model.ChannelList{&o1, &o3}},
|
||||
{"ChannelA, include deleted", teamId, "ChannelA", true, &model.ChannelList{&o1, &o3, &o13}},
|
||||
{"ChannelA, other team", otherTeamId, "ChannelA", false, &model.ChannelList{&o2}},
|
||||
{"empty string", teamId, "", false, &model.ChannelList{&o1, &o3, &o12, &o11, &o7, &o6, &o10, &o9}},
|
||||
{"no matches", teamId, "blargh", false, &model.ChannelList{}},
|
||||
{"prefix", teamId, "off-", false, &model.ChannelList{&o7, &o6}},
|
||||
{"full match with dash", teamId, "off-topic", false, &model.ChannelList{&o6}},
|
||||
{"town square", teamId, "town square", false, &model.ChannelList{&o9}},
|
||||
{"the in name", teamId, "thename", false, &model.ChannelList{&o10}},
|
||||
{"Mobile", teamId, "Mobile", false, &model.ChannelList{&o11}},
|
||||
{"search purpose", teamId, "now searchable", false, &model.ChannelList{&o12}},
|
||||
{"pipe ignored", teamId, "town square |", false, &model.ChannelList{&o9}},
|
||||
{"ChannelA", teamId, "ChannelA", false, model.ChannelList{&o1, &o3}},
|
||||
{"ChannelA, include deleted", teamId, "ChannelA", true, model.ChannelList{&o1, &o3, &o13}},
|
||||
{"ChannelA, other team", otherTeamId, "ChannelA", false, model.ChannelList{&o2}},
|
||||
{"empty string", teamId, "", false, model.ChannelList{&o1, &o3, &o12, &o11, &o7, &o6, &o10, &o9}},
|
||||
{"no matches", teamId, "blargh", false, model.ChannelList{}},
|
||||
{"prefix", teamId, "off-", false, model.ChannelList{&o7, &o6}},
|
||||
{"full match with dash", teamId, "off-topic", false, model.ChannelList{&o6}},
|
||||
{"town square", teamId, "town square", false, model.ChannelList{&o9}},
|
||||
{"the in name", teamId, "thename", false, model.ChannelList{&o10}},
|
||||
{"Mobile", teamId, "Mobile", false, model.ChannelList{&o11}},
|
||||
{"search purpose", teamId, "now searchable", false, model.ChannelList{&o12}},
|
||||
{"pipe ignored", teamId, "town square |", false, model.ChannelList{&o9}},
|
||||
}
|
||||
|
||||
for name, search := range map[string]func(teamId string, term string, includeDeleted bool) (*model.ChannelList, error){
|
||||
for name, search := range map[string]func(teamId string, term string, includeDeleted bool) (model.ChannelList, error){
|
||||
"AutocompleteInTeam": ss.Channel().AutocompleteInTeam,
|
||||
"SearchInTeam": ss.Channel().SearchInTeam,
|
||||
} {
|
||||
@@ -5186,7 +5186,7 @@ func testChannelStoreSearchInTeam(t *testing.T, ss store.Store) {
|
||||
|
||||
// AutoCompleteInTeam doesn't currently sort its output results.
|
||||
if name == "AutocompleteInTeam" {
|
||||
sort.Sort(ByChannelDisplayName(*channels))
|
||||
sort.Sort(ByChannelDisplayName(channels))
|
||||
}
|
||||
|
||||
require.Equal(t, testCase.ExpectedResults, channels)
|
||||
@@ -5259,10 +5259,10 @@ func testChannelStoreSearchForUserInTeam(t *testing.T, ss store.Store) {
|
||||
searchAndCheck := func(t *testing.T, term string, includeDeleted bool, expectedDisplayNames []string) {
|
||||
res, searchErr := ss.Channel().SearchForUserInTeam(userId, teamId, term, includeDeleted)
|
||||
require.NoError(t, searchErr)
|
||||
require.Len(t, *res, len(expectedDisplayNames))
|
||||
require.Len(t, res, len(expectedDisplayNames))
|
||||
|
||||
resultDisplayNames := []string{}
|
||||
for _, c := range *res {
|
||||
for _, c := range res {
|
||||
resultDisplayNames = append(resultDisplayNames, c.DisplayName)
|
||||
}
|
||||
require.ElementsMatch(t, expectedDisplayNames, resultDisplayNames)
|
||||
@@ -5502,54 +5502,54 @@ func testChannelStoreSearchAllChannels(t *testing.T, ss store.Store) {
|
||||
Description string
|
||||
Term string
|
||||
Opts store.ChannelSearchOpts
|
||||
ExpectedResults *model.ChannelList
|
||||
ExpectedResults model.ChannelList
|
||||
TotalCount int
|
||||
}{
|
||||
{"Search FooBar by display name", "bardisplay", store.ChannelSearchOpts{IncludeDeleted: false}, &model.ChannelList{&o14}, 1},
|
||||
{"Search FooBar by display name2", "foobar", store.ChannelSearchOpts{IncludeDeleted: false}, &model.ChannelList{&o14}, 1},
|
||||
{"Search FooBar by display name3", "displayname", store.ChannelSearchOpts{IncludeDeleted: false}, &model.ChannelList{&o14}, 1},
|
||||
{"Search FooBar by name", "what", store.ChannelSearchOpts{IncludeDeleted: false}, &model.ChannelList{&o14}, 1},
|
||||
{"Search FooBar by name2", "ever", store.ChannelSearchOpts{IncludeDeleted: false}, &model.ChannelList{&o14}, 1},
|
||||
{"ChannelA", "ChannelA", store.ChannelSearchOpts{IncludeDeleted: false}, &model.ChannelList{&o1, &o2, &o3}, 0},
|
||||
{"ChannelA, include deleted", "ChannelA", store.ChannelSearchOpts{IncludeDeleted: true}, &model.ChannelList{&o1, &o2, &o3, &o13}, 0},
|
||||
{"empty string", "", store.ChannelSearchOpts{IncludeDeleted: false}, &model.ChannelList{&o1, &o2, &o3, &o4, &o5, &o6, &o7, &o8, &o9, &o10, &o11, &o12, &o14}, 0},
|
||||
{"no matches", "blargh", store.ChannelSearchOpts{IncludeDeleted: false}, &model.ChannelList{}, 0},
|
||||
{"prefix", "off-", store.ChannelSearchOpts{IncludeDeleted: false}, &model.ChannelList{&o6, &o7, &o8}, 0},
|
||||
{"full match with dash", "off-topic", store.ChannelSearchOpts{IncludeDeleted: false}, &model.ChannelList{&o6}, 0},
|
||||
{"town square", "town square", store.ChannelSearchOpts{IncludeDeleted: false}, &model.ChannelList{&o9}, 0},
|
||||
{"which in name", "which", store.ChannelSearchOpts{IncludeDeleted: false}, &model.ChannelList{&o10}, 0},
|
||||
{"Mobile", "Mobile", store.ChannelSearchOpts{IncludeDeleted: false}, &model.ChannelList{&o11}, 0},
|
||||
{"search purpose", "now searchable", store.ChannelSearchOpts{IncludeDeleted: false}, &model.ChannelList{&o12}, 0},
|
||||
{"pipe ignored", "town square |", store.ChannelSearchOpts{IncludeDeleted: false}, &model.ChannelList{&o9}, 0},
|
||||
{"exclude defaults search 'off'", "off-", store.ChannelSearchOpts{IncludeDeleted: false, ExcludeChannelNames: []string{"off-topic"}}, &model.ChannelList{&o7, &o8}, 0},
|
||||
{"exclude defaults search 'town'", "town", store.ChannelSearchOpts{IncludeDeleted: false, ExcludeChannelNames: []string{"town-square"}}, &model.ChannelList{}, 0},
|
||||
{"exclude by group association", "off-", store.ChannelSearchOpts{IncludeDeleted: false, NotAssociatedToGroup: group.Id}, &model.ChannelList{&o6, &o8}, 0},
|
||||
{"paginate includes count", "off-", store.ChannelSearchOpts{IncludeDeleted: false, PerPage: model.NewInt(100)}, &model.ChannelList{&o6, &o7, &o8}, 3},
|
||||
{"paginate, page 2 correct entries and count", "off-", store.ChannelSearchOpts{IncludeDeleted: false, PerPage: model.NewInt(2), Page: model.NewInt(1)}, &model.ChannelList{&o8}, 3},
|
||||
{"Filter private", "", store.ChannelSearchOpts{IncludeDeleted: false, Private: true}, &model.ChannelList{&o4, &o5, &o8}, 3},
|
||||
{"Filter public", "", store.ChannelSearchOpts{IncludeDeleted: false, Public: true, Page: model.NewInt(0), PerPage: model.NewInt(5)}, &model.ChannelList{&o1, &o2, &o3, &o6, &o7}, 10},
|
||||
{"Filter public and private", "", store.ChannelSearchOpts{IncludeDeleted: false, Public: true, Private: true, Page: model.NewInt(0), PerPage: model.NewInt(5)}, &model.ChannelList{&o1, &o2, &o3, &o4, &o5}, 13},
|
||||
{"Filter public and private and include deleted", "", store.ChannelSearchOpts{IncludeDeleted: true, Public: true, Private: true, Page: model.NewInt(0), PerPage: model.NewInt(5)}, &model.ChannelList{&o1, &o2, &o3, &o4, &o5}, 14},
|
||||
{"Filter group constrained", "", store.ChannelSearchOpts{IncludeDeleted: false, GroupConstrained: true, Page: model.NewInt(0), PerPage: model.NewInt(5)}, &model.ChannelList{&o5}, 1},
|
||||
{"Filter exclude group constrained and include deleted", "", store.ChannelSearchOpts{IncludeDeleted: true, ExcludeGroupConstrained: true, Page: model.NewInt(0), PerPage: model.NewInt(5)}, &model.ChannelList{&o1, &o2, &o3, &o4, &o6}, 13},
|
||||
{"Filter private and exclude group constrained", "", store.ChannelSearchOpts{IncludeDeleted: false, ExcludeGroupConstrained: true, Private: true, Page: model.NewInt(0), PerPage: model.NewInt(5)}, &model.ChannelList{&o4, &o8}, 2},
|
||||
{"Exclude policy constrained", "", store.ChannelSearchOpts{ExcludePolicyConstrained: true}, &model.ChannelList{&o1, &o2, &o3, &o4, &o5, &o6, &o7, &o8, &o9, &o10, &o11, &o12}, 0},
|
||||
{"Filter team 2", "", store.ChannelSearchOpts{IncludeDeleted: false, TeamIds: []string{t2.Id}, Page: model.NewInt(0), PerPage: model.NewInt(5)}, &model.ChannelList{&o2, &o14}, 2},
|
||||
{"Filter team 2, private", "", store.ChannelSearchOpts{IncludeDeleted: false, TeamIds: []string{t2.Id}, Private: true, Page: model.NewInt(0), PerPage: model.NewInt(5)}, &model.ChannelList{}, 0},
|
||||
{"Filter team 1 and team 2, private", "", store.ChannelSearchOpts{IncludeDeleted: false, TeamIds: []string{t1.Id, t2.Id}, Private: true, Page: model.NewInt(0), PerPage: model.NewInt(5)}, &model.ChannelList{&o4, &o5, &o8}, 3},
|
||||
{"Filter team 1 and team 2, public and private", "", store.ChannelSearchOpts{IncludeDeleted: false, TeamIds: []string{t1.Id, t2.Id}, Public: true, Private: true, Page: model.NewInt(0), PerPage: model.NewInt(5)}, &model.ChannelList{&o1, &o2, &o3, &o4, &o5}, 13},
|
||||
{"Filter team 1 and team 2, public and private and group constrained", "", store.ChannelSearchOpts{IncludeDeleted: false, TeamIds: []string{t1.Id, t2.Id}, Public: true, Private: true, GroupConstrained: true, Page: model.NewInt(0), PerPage: model.NewInt(5)}, &model.ChannelList{&o5}, 1},
|
||||
{"Filter team 1 and team 2, public and private and exclude group constrained", "", store.ChannelSearchOpts{IncludeDeleted: false, TeamIds: []string{t1.Id, t2.Id}, Public: true, Private: true, ExcludeGroupConstrained: true, Page: model.NewInt(0), PerPage: model.NewInt(5)}, &model.ChannelList{&o1, &o2, &o3, &o4, &o6}, 12},
|
||||
{"Filter deleted returns only deleted channels", "", store.ChannelSearchOpts{Deleted: true, Page: model.NewInt(0), PerPage: model.NewInt(5)}, &model.ChannelList{&o13}, 1},
|
||||
{"Search FooBar by display name", "bardisplay", store.ChannelSearchOpts{IncludeDeleted: false}, model.ChannelList{&o14}, 1},
|
||||
{"Search FooBar by display name2", "foobar", store.ChannelSearchOpts{IncludeDeleted: false}, model.ChannelList{&o14}, 1},
|
||||
{"Search FooBar by display name3", "displayname", store.ChannelSearchOpts{IncludeDeleted: false}, model.ChannelList{&o14}, 1},
|
||||
{"Search FooBar by name", "what", store.ChannelSearchOpts{IncludeDeleted: false}, model.ChannelList{&o14}, 1},
|
||||
{"Search FooBar by name2", "ever", store.ChannelSearchOpts{IncludeDeleted: false}, model.ChannelList{&o14}, 1},
|
||||
{"ChannelA", "ChannelA", store.ChannelSearchOpts{IncludeDeleted: false}, model.ChannelList{&o1, &o2, &o3}, 0},
|
||||
{"ChannelA, include deleted", "ChannelA", store.ChannelSearchOpts{IncludeDeleted: true}, model.ChannelList{&o1, &o2, &o3, &o13}, 0},
|
||||
{"empty string", "", store.ChannelSearchOpts{IncludeDeleted: false}, model.ChannelList{&o1, &o2, &o3, &o4, &o5, &o6, &o7, &o8, &o9, &o10, &o11, &o12, &o14}, 0},
|
||||
{"no matches", "blargh", store.ChannelSearchOpts{IncludeDeleted: false}, model.ChannelList{}, 0},
|
||||
{"prefix", "off-", store.ChannelSearchOpts{IncludeDeleted: false}, model.ChannelList{&o6, &o7, &o8}, 0},
|
||||
{"full match with dash", "off-topic", store.ChannelSearchOpts{IncludeDeleted: false}, model.ChannelList{&o6}, 0},
|
||||
{"town square", "town square", store.ChannelSearchOpts{IncludeDeleted: false}, model.ChannelList{&o9}, 0},
|
||||
{"which in name", "which", store.ChannelSearchOpts{IncludeDeleted: false}, model.ChannelList{&o10}, 0},
|
||||
{"Mobile", "Mobile", store.ChannelSearchOpts{IncludeDeleted: false}, model.ChannelList{&o11}, 0},
|
||||
{"search purpose", "now searchable", store.ChannelSearchOpts{IncludeDeleted: false}, model.ChannelList{&o12}, 0},
|
||||
{"pipe ignored", "town square |", store.ChannelSearchOpts{IncludeDeleted: false}, model.ChannelList{&o9}, 0},
|
||||
{"exclude defaults search 'off'", "off-", store.ChannelSearchOpts{IncludeDeleted: false, ExcludeChannelNames: []string{"off-topic"}}, model.ChannelList{&o7, &o8}, 0},
|
||||
{"exclude defaults search 'town'", "town", store.ChannelSearchOpts{IncludeDeleted: false, ExcludeChannelNames: []string{"town-square"}}, model.ChannelList{}, 0},
|
||||
{"exclude by group association", "off-", store.ChannelSearchOpts{IncludeDeleted: false, NotAssociatedToGroup: group.Id}, model.ChannelList{&o6, &o8}, 0},
|
||||
{"paginate includes count", "off-", store.ChannelSearchOpts{IncludeDeleted: false, PerPage: model.NewInt(100)}, model.ChannelList{&o6, &o7, &o8}, 3},
|
||||
{"paginate, page 2 correct entries and count", "off-", store.ChannelSearchOpts{IncludeDeleted: false, PerPage: model.NewInt(2), Page: model.NewInt(1)}, model.ChannelList{&o8}, 3},
|
||||
{"Filter private", "", store.ChannelSearchOpts{IncludeDeleted: false, Private: true}, model.ChannelList{&o4, &o5, &o8}, 3},
|
||||
{"Filter public", "", store.ChannelSearchOpts{IncludeDeleted: false, Public: true, Page: model.NewInt(0), PerPage: model.NewInt(5)}, model.ChannelList{&o1, &o2, &o3, &o6, &o7}, 10},
|
||||
{"Filter public and private", "", store.ChannelSearchOpts{IncludeDeleted: false, Public: true, Private: true, Page: model.NewInt(0), PerPage: model.NewInt(5)}, model.ChannelList{&o1, &o2, &o3, &o4, &o5}, 13},
|
||||
{"Filter public and private and include deleted", "", store.ChannelSearchOpts{IncludeDeleted: true, Public: true, Private: true, Page: model.NewInt(0), PerPage: model.NewInt(5)}, model.ChannelList{&o1, &o2, &o3, &o4, &o5}, 14},
|
||||
{"Filter group constrained", "", store.ChannelSearchOpts{IncludeDeleted: false, GroupConstrained: true, Page: model.NewInt(0), PerPage: model.NewInt(5)}, model.ChannelList{&o5}, 1},
|
||||
{"Filter exclude group constrained and include deleted", "", store.ChannelSearchOpts{IncludeDeleted: true, ExcludeGroupConstrained: true, Page: model.NewInt(0), PerPage: model.NewInt(5)}, model.ChannelList{&o1, &o2, &o3, &o4, &o6}, 13},
|
||||
{"Filter private and exclude group constrained", "", store.ChannelSearchOpts{IncludeDeleted: false, ExcludeGroupConstrained: true, Private: true, Page: model.NewInt(0), PerPage: model.NewInt(5)}, model.ChannelList{&o4, &o8}, 2},
|
||||
{"Exclude policy constrained", "", store.ChannelSearchOpts{ExcludePolicyConstrained: true}, model.ChannelList{&o1, &o2, &o3, &o4, &o5, &o6, &o7, &o8, &o9, &o10, &o11, &o12}, 0},
|
||||
{"Filter team 2", "", store.ChannelSearchOpts{IncludeDeleted: false, TeamIds: []string{t2.Id}, Page: model.NewInt(0), PerPage: model.NewInt(5)}, model.ChannelList{&o2, &o14}, 2},
|
||||
{"Filter team 2, private", "", store.ChannelSearchOpts{IncludeDeleted: false, TeamIds: []string{t2.Id}, Private: true, Page: model.NewInt(0), PerPage: model.NewInt(5)}, model.ChannelList{}, 0},
|
||||
{"Filter team 1 and team 2, private", "", store.ChannelSearchOpts{IncludeDeleted: false, TeamIds: []string{t1.Id, t2.Id}, Private: true, Page: model.NewInt(0), PerPage: model.NewInt(5)}, model.ChannelList{&o4, &o5, &o8}, 3},
|
||||
{"Filter team 1 and team 2, public and private", "", store.ChannelSearchOpts{IncludeDeleted: false, TeamIds: []string{t1.Id, t2.Id}, Public: true, Private: true, Page: model.NewInt(0), PerPage: model.NewInt(5)}, model.ChannelList{&o1, &o2, &o3, &o4, &o5}, 13},
|
||||
{"Filter team 1 and team 2, public and private and group constrained", "", store.ChannelSearchOpts{IncludeDeleted: false, TeamIds: []string{t1.Id, t2.Id}, Public: true, Private: true, GroupConstrained: true, Page: model.NewInt(0), PerPage: model.NewInt(5)}, model.ChannelList{&o5}, 1},
|
||||
{"Filter team 1 and team 2, public and private and exclude group constrained", "", store.ChannelSearchOpts{IncludeDeleted: false, TeamIds: []string{t1.Id, t2.Id}, Public: true, Private: true, ExcludeGroupConstrained: true, Page: model.NewInt(0), PerPage: model.NewInt(5)}, model.ChannelList{&o1, &o2, &o3, &o4, &o6}, 12},
|
||||
{"Filter deleted returns only deleted channels", "", store.ChannelSearchOpts{Deleted: true, Page: model.NewInt(0), PerPage: model.NewInt(5)}, model.ChannelList{&o13}, 1},
|
||||
}
|
||||
|
||||
for _, testCase := range testCases {
|
||||
t.Run(testCase.Description, func(t *testing.T) {
|
||||
channels, count, err := ss.Channel().SearchAllChannels(testCase.Term, testCase.Opts)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, len(*testCase.ExpectedResults), len(*channels))
|
||||
for i, expected := range *testCase.ExpectedResults {
|
||||
require.Equal(t, expected.Id, (*channels)[i].Id)
|
||||
require.Equal(t, len(testCase.ExpectedResults), len(channels))
|
||||
for i, expected := range testCase.ExpectedResults {
|
||||
require.Equal(t, expected.Id, channels[i].Id)
|
||||
}
|
||||
if testCase.Opts.Page != nil || testCase.Opts.PerPage != nil {
|
||||
require.Equal(t, int64(testCase.TotalCount), count)
|
||||
@@ -5571,10 +5571,10 @@ func testChannelStoreGetMembersByIds(t *testing.T, ss store.Store) {
|
||||
_, err := ss.Channel().SaveMember(m1)
|
||||
require.NoError(t, err)
|
||||
|
||||
var members *model.ChannelMembers
|
||||
var members model.ChannelMembers
|
||||
members, nErr = ss.Channel().GetMembersByIds(m1.ChannelId, []string{m1.UserId})
|
||||
require.NoError(t, nErr, nErr)
|
||||
rm1 := (*members)[0]
|
||||
rm1 := members[0]
|
||||
|
||||
require.Equal(t, m1.ChannelId, rm1.ChannelId, "bad team id")
|
||||
require.Equal(t, m1.UserId, rm1.UserId, "bad user id")
|
||||
@@ -5585,7 +5585,7 @@ func testChannelStoreGetMembersByIds(t *testing.T, ss store.Store) {
|
||||
|
||||
members, nErr = ss.Channel().GetMembersByIds(m1.ChannelId, []string{m1.UserId, m2.UserId, model.NewId()})
|
||||
require.NoError(t, nErr, nErr)
|
||||
require.Len(t, *members, 2, "return wrong number of results")
|
||||
require.Len(t, members, 2, "return wrong number of results")
|
||||
|
||||
_, nErr = ss.Channel().GetMembersByIds(m1.ChannelId, []string{})
|
||||
require.Error(t, nErr, "empty user ids - should have failed")
|
||||
@@ -5628,24 +5628,24 @@ func testChannelStoreGetMembersByChannelIds(t *testing.T, ss store.Store) {
|
||||
t.Run("should return the user's members for the given channels", func(t *testing.T) {
|
||||
result, nErr := ss.Channel().GetMembersByChannelIds([]string{channel1.Id, channel2.Id}, userId)
|
||||
require.NoError(t, nErr)
|
||||
assert.Len(t, *result, 2)
|
||||
assert.Len(t, result, 2)
|
||||
|
||||
assert.Equal(t, userId, (*result)[0].UserId)
|
||||
assert.True(t, (*result)[0].ChannelId == channel1.Id || (*result)[1].ChannelId == channel1.Id)
|
||||
assert.Equal(t, userId, (*result)[1].UserId)
|
||||
assert.True(t, (*result)[0].ChannelId == channel2.Id || (*result)[1].ChannelId == channel2.Id)
|
||||
assert.Equal(t, userId, result[0].UserId)
|
||||
assert.True(t, result[0].ChannelId == channel1.Id || result[1].ChannelId == channel1.Id)
|
||||
assert.Equal(t, userId, result[1].UserId)
|
||||
assert.True(t, result[0].ChannelId == channel2.Id || result[1].ChannelId == channel2.Id)
|
||||
})
|
||||
|
||||
t.Run("should not error or return anything for invalid channel IDs", func(t *testing.T) {
|
||||
result, nErr := ss.Channel().GetMembersByChannelIds([]string{model.NewId(), model.NewId()}, userId)
|
||||
require.NoError(t, nErr)
|
||||
assert.Len(t, *result, 0)
|
||||
assert.Len(t, result, 0)
|
||||
})
|
||||
|
||||
t.Run("should not error or return anything for invalid user IDs", func(t *testing.T) {
|
||||
result, nErr := ss.Channel().GetMembersByChannelIds([]string{channel1.Id, channel2.Id}, model.NewId())
|
||||
require.NoError(t, nErr)
|
||||
assert.Len(t, *result, 0)
|
||||
assert.Len(t, result, 0)
|
||||
})
|
||||
}
|
||||
|
||||
@@ -5794,7 +5794,7 @@ func testChannelStoreSearchGroupChannels(t *testing.T, ss store.Store) {
|
||||
require.NoError(t, err)
|
||||
|
||||
resultIds := []string{}
|
||||
for _, gc := range *result {
|
||||
for _, gc := range result {
|
||||
resultIds = append(resultIds, gc.Id)
|
||||
}
|
||||
|
||||
@@ -6315,7 +6315,7 @@ func testMaterializedPublicChannels(t *testing.T, ss store.Store, s SqlStore) {
|
||||
t.Run("o1 and o2 initially listed in public channels", func(t *testing.T) {
|
||||
channels, channelErr := ss.Channel().SearchInTeam(teamId, "", true)
|
||||
require.NoError(t, channelErr)
|
||||
require.Equal(t, &model.ChannelList{&o1, &o2}, channels)
|
||||
require.Equal(t, model.ChannelList{&o1, &o2}, channels)
|
||||
})
|
||||
|
||||
o1.DeleteAt = model.GetMillis()
|
||||
@@ -6327,7 +6327,7 @@ func testMaterializedPublicChannels(t *testing.T, ss store.Store, s SqlStore) {
|
||||
t.Run("o1 still listed in public channels when marked as deleted", func(t *testing.T) {
|
||||
channels, channelErr := ss.Channel().SearchInTeam(teamId, "", true)
|
||||
require.NoError(t, channelErr)
|
||||
require.Equal(t, &model.ChannelList{&o1, &o2}, channels)
|
||||
require.Equal(t, model.ChannelList{&o1, &o2}, channels)
|
||||
})
|
||||
|
||||
ss.Channel().PermanentDelete(o1.Id)
|
||||
@@ -6335,7 +6335,7 @@ func testMaterializedPublicChannels(t *testing.T, ss store.Store, s SqlStore) {
|
||||
t.Run("o1 no longer listed in public channels when permanently deleted", func(t *testing.T) {
|
||||
channels, channelErr := ss.Channel().SearchInTeam(teamId, "", true)
|
||||
require.NoError(t, channelErr)
|
||||
require.Equal(t, &model.ChannelList{&o2}, channels)
|
||||
require.Equal(t, model.ChannelList{&o2}, channels)
|
||||
})
|
||||
|
||||
o2.Type = model.ChannelTypePrivate
|
||||
@@ -6345,7 +6345,7 @@ func testMaterializedPublicChannels(t *testing.T, ss store.Store, s SqlStore) {
|
||||
t.Run("o2 no longer listed since now private", func(t *testing.T) {
|
||||
channels, channelErr := ss.Channel().SearchInTeam(teamId, "", true)
|
||||
require.NoError(t, channelErr)
|
||||
require.Equal(t, &model.ChannelList{}, channels)
|
||||
require.Equal(t, model.ChannelList{}, channels)
|
||||
})
|
||||
|
||||
o2.Type = model.ChannelTypeOpen
|
||||
@@ -6355,7 +6355,7 @@ func testMaterializedPublicChannels(t *testing.T, ss store.Store, s SqlStore) {
|
||||
t.Run("o2 listed once again since now public", func(t *testing.T) {
|
||||
channels, channelErr := ss.Channel().SearchInTeam(teamId, "", true)
|
||||
require.NoError(t, channelErr)
|
||||
require.Equal(t, &model.ChannelList{&o2}, channels)
|
||||
require.Equal(t, model.ChannelList{&o2}, channels)
|
||||
})
|
||||
|
||||
// o3 is a public channel on the team that already existed in the PublicChannels table.
|
||||
@@ -6411,7 +6411,7 @@ func testMaterializedPublicChannels(t *testing.T, ss store.Store, s SqlStore) {
|
||||
t.Run("verify o3 INSERT converted to UPDATE", func(t *testing.T) {
|
||||
channels, channelErr := ss.Channel().SearchInTeam(teamId, "", true)
|
||||
require.NoError(t, channelErr)
|
||||
require.Equal(t, &model.ChannelList{&o2, &o3}, channels)
|
||||
require.Equal(t, model.ChannelList{&o2, &o3}, channels)
|
||||
})
|
||||
|
||||
// o4 is a public channel on the team that existed in the Channels table but was omitted from the PublicChannels table.
|
||||
@@ -6442,7 +6442,7 @@ func testMaterializedPublicChannels(t *testing.T, ss store.Store, s SqlStore) {
|
||||
t.Run("verify o4 UPDATE converted to INSERT", func(t *testing.T) {
|
||||
channels, err := ss.Channel().SearchInTeam(teamId, "", true)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, &model.ChannelList{&o2, &o3, &o4}, channels)
|
||||
require.Equal(t, model.ChannelList{&o2, &o3, &o4}, channels)
|
||||
})
|
||||
}
|
||||
|
||||
@@ -6594,7 +6594,7 @@ func testChannelStoreRemoveAllDeactivatedMembers(t *testing.T, ss store.Store, s
|
||||
// Get all the channel members. Check there are 3.
|
||||
d1, err := ss.Channel().GetMembers(c1.Id, 0, 1000)
|
||||
assert.NoError(t, err)
|
||||
assert.Len(t, *d1, 3)
|
||||
assert.Len(t, d1, 3)
|
||||
|
||||
// Deactivate users 1 & 2.
|
||||
u1.DeleteAt = model.GetMillis()
|
||||
@@ -6610,8 +6610,8 @@ func testChannelStoreRemoveAllDeactivatedMembers(t *testing.T, ss store.Store, s
|
||||
// Get all the channel members. Check there is now only 1: m3.
|
||||
d2, err := ss.Channel().GetMembers(c1.Id, 0, 1000)
|
||||
assert.NoError(t, err)
|
||||
assert.Len(t, *d2, 1)
|
||||
assert.Equal(t, u3.Id, (*d2)[0].UserId)
|
||||
assert.Len(t, d2, 1)
|
||||
assert.Equal(t, u3.Id, d2[0].UserId)
|
||||
|
||||
// Manually truncate Channels table until testlib can handle cleanups
|
||||
s.GetMaster().Exec("TRUNCATE Channels")
|
||||
|
||||
@@ -165,7 +165,7 @@ func testCreateInitialSidebarCategories(t *testing.T, ss store.Store) {
|
||||
})
|
||||
require.NoError(t, err)
|
||||
|
||||
nErr = ss.Preference().Save(&model.Preferences{
|
||||
nErr = ss.Preference().Save(model.Preferences{
|
||||
{
|
||||
UserId: userId,
|
||||
Category: model.PreferenceCategoryFavoriteChannel,
|
||||
@@ -223,7 +223,7 @@ func testCreateInitialSidebarCategories(t *testing.T, ss store.Store) {
|
||||
})
|
||||
require.NoError(t, err)
|
||||
|
||||
nErr = ss.Preference().Save(&model.Preferences{
|
||||
nErr = ss.Preference().Save(model.Preferences{
|
||||
{
|
||||
UserId: userId,
|
||||
Category: model.PreferenceCategoryFavoriteChannel,
|
||||
@@ -292,7 +292,7 @@ func testCreateInitialSidebarCategories(t *testing.T, ss store.Store) {
|
||||
)
|
||||
require.NoError(t, err)
|
||||
|
||||
err = ss.Preference().Save(&model.Preferences{
|
||||
err = ss.Preference().Save(model.Preferences{
|
||||
{
|
||||
UserId: userId,
|
||||
Category: model.PreferenceCategoryFavoriteChannel,
|
||||
@@ -336,7 +336,7 @@ func testCreateInitialSidebarCategories(t *testing.T, ss store.Store) {
|
||||
})
|
||||
require.NoError(t, err)
|
||||
|
||||
nErr = ss.Preference().Save(&model.Preferences{
|
||||
nErr = ss.Preference().Save(model.Preferences{
|
||||
{
|
||||
UserId: userId,
|
||||
Category: model.PreferenceCategoryFavoriteChannel,
|
||||
@@ -2028,7 +2028,7 @@ func testUpdateSidebarChannelsByPreferences(t *testing.T, ss store.Store) {
|
||||
}, 10)
|
||||
require.NoError(t, nErr)
|
||||
|
||||
err := ss.Channel().UpdateSidebarChannelsByPreferences(&model.Preferences{
|
||||
err := ss.Channel().UpdateSidebarChannelsByPreferences(model.Preferences{
|
||||
model.Preference{
|
||||
Name: channel.Id,
|
||||
Category: model.PreferenceCategoryFavoriteChannel,
|
||||
@@ -2047,7 +2047,7 @@ func testUpdateSidebarChannelsByPreferences(t *testing.T, ss store.Store) {
|
||||
require.NotEmpty(t, res)
|
||||
|
||||
require.NotPanics(t, func() {
|
||||
_ = ss.Channel().UpdateSidebarChannelsByPreferences(&model.Preferences{
|
||||
_ = ss.Channel().UpdateSidebarChannelsByPreferences(model.Preferences{
|
||||
model.Preference{
|
||||
Name: "fakeid",
|
||||
Category: model.PreferenceCategoryFavoriteChannel,
|
||||
|
||||
@@ -31,7 +31,7 @@ func cleanupStoreState(t *testing.T, ss store.Store) {
|
||||
//remove existing channels
|
||||
allChannels, nErr := ss.Channel().GetAllChannels(0, 100000, store.ChannelSearchOpts{IncludeDeleted: true})
|
||||
require.NoError(t, nErr, "error cleaning all test channels", nErr)
|
||||
for _, channel := range *allChannels {
|
||||
for _, channel := range allChannels {
|
||||
nErr = ss.Channel().PermanentDelete(channel.Id)
|
||||
require.NoError(t, nErr, "failed cleaning up test channel %s", channel.Id)
|
||||
}
|
||||
|
||||
@@ -4401,9 +4401,9 @@ func groupTestpUpdateMembersRoleChannel(t *testing.T, ss store.Store) {
|
||||
members, err := ss.Channel().GetMembers(channel.Id, 0, 100)
|
||||
require.NoError(t, err)
|
||||
|
||||
require.GreaterOrEqual(t, len(*members), 4) // sanity check for channel membership
|
||||
require.GreaterOrEqual(t, len(members), 4) // sanity check for channel membership
|
||||
|
||||
for _, member := range *members {
|
||||
for _, member := range members {
|
||||
if utils.StringInSlice(member.UserId, tt.inUserIDs) {
|
||||
require.True(t, member.SchemeAdmin)
|
||||
} else {
|
||||
|
||||
@@ -61,15 +61,15 @@ func (_m *ChannelStore) AnalyticsTypeCount(teamID string, channelType model.Chan
|
||||
}
|
||||
|
||||
// AutocompleteInTeam provides a mock function with given fields: teamID, term, includeDeleted
|
||||
func (_m *ChannelStore) AutocompleteInTeam(teamID string, term string, includeDeleted bool) (*model.ChannelList, error) {
|
||||
func (_m *ChannelStore) AutocompleteInTeam(teamID string, term string, includeDeleted bool) (model.ChannelList, error) {
|
||||
ret := _m.Called(teamID, term, includeDeleted)
|
||||
|
||||
var r0 *model.ChannelList
|
||||
if rf, ok := ret.Get(0).(func(string, string, bool) *model.ChannelList); ok {
|
||||
var r0 model.ChannelList
|
||||
if rf, ok := ret.Get(0).(func(string, string, bool) model.ChannelList); ok {
|
||||
r0 = rf(teamID, term, includeDeleted)
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).(*model.ChannelList)
|
||||
r0 = ret.Get(0).(model.ChannelList)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -84,15 +84,15 @@ func (_m *ChannelStore) AutocompleteInTeam(teamID string, term string, includeDe
|
||||
}
|
||||
|
||||
// AutocompleteInTeamForSearch provides a mock function with given fields: teamID, userID, term, includeDeleted
|
||||
func (_m *ChannelStore) AutocompleteInTeamForSearch(teamID string, userID string, term string, includeDeleted bool) (*model.ChannelList, error) {
|
||||
func (_m *ChannelStore) AutocompleteInTeamForSearch(teamID string, userID string, term string, includeDeleted bool) (model.ChannelList, error) {
|
||||
ret := _m.Called(teamID, userID, term, includeDeleted)
|
||||
|
||||
var r0 *model.ChannelList
|
||||
if rf, ok := ret.Get(0).(func(string, string, string, bool) *model.ChannelList); ok {
|
||||
var r0 model.ChannelList
|
||||
if rf, ok := ret.Get(0).(func(string, string, string, bool) model.ChannelList); ok {
|
||||
r0 = rf(teamID, userID, term, includeDeleted)
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).(*model.ChannelList)
|
||||
r0 = ret.Get(0).(model.ChannelList)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -272,11 +272,11 @@ func (_m *ChannelStore) DeleteSidebarCategory(categoryID string) error {
|
||||
}
|
||||
|
||||
// DeleteSidebarChannelsByPreferences provides a mock function with given fields: preferences
|
||||
func (_m *ChannelStore) DeleteSidebarChannelsByPreferences(preferences *model.Preferences) error {
|
||||
func (_m *ChannelStore) DeleteSidebarChannelsByPreferences(preferences model.Preferences) error {
|
||||
ret := _m.Called(preferences)
|
||||
|
||||
var r0 error
|
||||
if rf, ok := ret.Get(0).(func(*model.Preferences) error); ok {
|
||||
if rf, ok := ret.Get(0).(func(model.Preferences) error); ok {
|
||||
r0 = rf(preferences)
|
||||
} else {
|
||||
r0 = ret.Error(0)
|
||||
@@ -378,15 +378,15 @@ func (_m *ChannelStore) GetAllChannelMembersNotifyPropsForChannel(channelID stri
|
||||
}
|
||||
|
||||
// GetAllChannels provides a mock function with given fields: page, perPage, opts
|
||||
func (_m *ChannelStore) GetAllChannels(page int, perPage int, opts store.ChannelSearchOpts) (*model.ChannelListWithTeamData, error) {
|
||||
func (_m *ChannelStore) GetAllChannels(page int, perPage int, opts store.ChannelSearchOpts) (model.ChannelListWithTeamData, error) {
|
||||
ret := _m.Called(page, perPage, opts)
|
||||
|
||||
var r0 *model.ChannelListWithTeamData
|
||||
if rf, ok := ret.Get(0).(func(int, int, store.ChannelSearchOpts) *model.ChannelListWithTeamData); ok {
|
||||
var r0 model.ChannelListWithTeamData
|
||||
if rf, ok := ret.Get(0).(func(int, int, store.ChannelSearchOpts) model.ChannelListWithTeamData); ok {
|
||||
r0 = rf(page, perPage, opts)
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).(*model.ChannelListWithTeamData)
|
||||
r0 = ret.Get(0).(model.ChannelListWithTeamData)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -629,15 +629,15 @@ func (_m *ChannelStore) GetChannelUnread(channelID string, userID string) (*mode
|
||||
}
|
||||
|
||||
// GetChannels provides a mock function with given fields: teamID, userID, includeDeleted, lastDeleteAt
|
||||
func (_m *ChannelStore) GetChannels(teamID string, userID string, includeDeleted bool, lastDeleteAt int) (*model.ChannelList, error) {
|
||||
func (_m *ChannelStore) GetChannels(teamID string, userID string, includeDeleted bool, lastDeleteAt int) (model.ChannelList, error) {
|
||||
ret := _m.Called(teamID, userID, includeDeleted, lastDeleteAt)
|
||||
|
||||
var r0 *model.ChannelList
|
||||
if rf, ok := ret.Get(0).(func(string, string, bool, int) *model.ChannelList); ok {
|
||||
var r0 model.ChannelList
|
||||
if rf, ok := ret.Get(0).(func(string, string, bool, int) model.ChannelList); ok {
|
||||
r0 = rf(teamID, userID, includeDeleted, lastDeleteAt)
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).(*model.ChannelList)
|
||||
r0 = ret.Get(0).(model.ChannelList)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -721,15 +721,15 @@ func (_m *ChannelStore) GetChannelsByScheme(schemeID string, offset int, limit i
|
||||
}
|
||||
|
||||
// GetDeleted provides a mock function with given fields: team_id, offset, limit, userID
|
||||
func (_m *ChannelStore) GetDeleted(team_id string, offset int, limit int, userID string) (*model.ChannelList, error) {
|
||||
func (_m *ChannelStore) GetDeleted(team_id string, offset int, limit int, userID string) (model.ChannelList, error) {
|
||||
ret := _m.Called(team_id, offset, limit, userID)
|
||||
|
||||
var r0 *model.ChannelList
|
||||
if rf, ok := ret.Get(0).(func(string, int, int, string) *model.ChannelList); ok {
|
||||
var r0 model.ChannelList
|
||||
if rf, ok := ret.Get(0).(func(string, int, int, string) model.ChannelList); ok {
|
||||
r0 = rf(team_id, offset, limit, userID)
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).(*model.ChannelList)
|
||||
r0 = ret.Get(0).(model.ChannelList)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -938,15 +938,15 @@ func (_m *ChannelStore) GetMemberForPost(postID string, userID string) (*model.C
|
||||
}
|
||||
|
||||
// GetMembers provides a mock function with given fields: channelID, offset, limit
|
||||
func (_m *ChannelStore) GetMembers(channelID string, offset int, limit int) (*model.ChannelMembers, error) {
|
||||
func (_m *ChannelStore) GetMembers(channelID string, offset int, limit int) (model.ChannelMembers, error) {
|
||||
ret := _m.Called(channelID, offset, limit)
|
||||
|
||||
var r0 *model.ChannelMembers
|
||||
if rf, ok := ret.Get(0).(func(string, int, int) *model.ChannelMembers); ok {
|
||||
var r0 model.ChannelMembers
|
||||
if rf, ok := ret.Get(0).(func(string, int, int) model.ChannelMembers); ok {
|
||||
r0 = rf(channelID, offset, limit)
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).(*model.ChannelMembers)
|
||||
r0 = ret.Get(0).(model.ChannelMembers)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -961,15 +961,15 @@ func (_m *ChannelStore) GetMembers(channelID string, offset int, limit int) (*mo
|
||||
}
|
||||
|
||||
// GetMembersByChannelIds provides a mock function with given fields: channelIds, userID
|
||||
func (_m *ChannelStore) GetMembersByChannelIds(channelIds []string, userID string) (*model.ChannelMembers, error) {
|
||||
func (_m *ChannelStore) GetMembersByChannelIds(channelIds []string, userID string) (model.ChannelMembers, error) {
|
||||
ret := _m.Called(channelIds, userID)
|
||||
|
||||
var r0 *model.ChannelMembers
|
||||
if rf, ok := ret.Get(0).(func([]string, string) *model.ChannelMembers); ok {
|
||||
var r0 model.ChannelMembers
|
||||
if rf, ok := ret.Get(0).(func([]string, string) model.ChannelMembers); ok {
|
||||
r0 = rf(channelIds, userID)
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).(*model.ChannelMembers)
|
||||
r0 = ret.Get(0).(model.ChannelMembers)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -984,15 +984,15 @@ func (_m *ChannelStore) GetMembersByChannelIds(channelIds []string, userID strin
|
||||
}
|
||||
|
||||
// GetMembersByIds provides a mock function with given fields: channelID, userIds
|
||||
func (_m *ChannelStore) GetMembersByIds(channelID string, userIds []string) (*model.ChannelMembers, error) {
|
||||
func (_m *ChannelStore) GetMembersByIds(channelID string, userIds []string) (model.ChannelMembers, error) {
|
||||
ret := _m.Called(channelID, userIds)
|
||||
|
||||
var r0 *model.ChannelMembers
|
||||
if rf, ok := ret.Get(0).(func(string, []string) *model.ChannelMembers); ok {
|
||||
var r0 model.ChannelMembers
|
||||
if rf, ok := ret.Get(0).(func(string, []string) model.ChannelMembers); ok {
|
||||
r0 = rf(channelID, userIds)
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).(*model.ChannelMembers)
|
||||
r0 = ret.Get(0).(model.ChannelMembers)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1007,15 +1007,15 @@ func (_m *ChannelStore) GetMembersByIds(channelID string, userIds []string) (*mo
|
||||
}
|
||||
|
||||
// GetMembersForUser provides a mock function with given fields: teamID, userID
|
||||
func (_m *ChannelStore) GetMembersForUser(teamID string, userID string) (*model.ChannelMembers, error) {
|
||||
func (_m *ChannelStore) GetMembersForUser(teamID string, userID string) (model.ChannelMembers, error) {
|
||||
ret := _m.Called(teamID, userID)
|
||||
|
||||
var r0 *model.ChannelMembers
|
||||
if rf, ok := ret.Get(0).(func(string, string) *model.ChannelMembers); ok {
|
||||
var r0 model.ChannelMembers
|
||||
if rf, ok := ret.Get(0).(func(string, string) model.ChannelMembers); ok {
|
||||
r0 = rf(teamID, userID)
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).(*model.ChannelMembers)
|
||||
r0 = ret.Get(0).(model.ChannelMembers)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1030,15 +1030,15 @@ func (_m *ChannelStore) GetMembersForUser(teamID string, userID string) (*model.
|
||||
}
|
||||
|
||||
// GetMembersForUserWithPagination provides a mock function with given fields: teamID, userID, page, perPage
|
||||
func (_m *ChannelStore) GetMembersForUserWithPagination(teamID string, userID string, page int, perPage int) (*model.ChannelMembers, error) {
|
||||
func (_m *ChannelStore) GetMembersForUserWithPagination(teamID string, userID string, page int, perPage int) (model.ChannelMembers, error) {
|
||||
ret := _m.Called(teamID, userID, page, perPage)
|
||||
|
||||
var r0 *model.ChannelMembers
|
||||
if rf, ok := ret.Get(0).(func(string, string, int, int) *model.ChannelMembers); ok {
|
||||
var r0 model.ChannelMembers
|
||||
if rf, ok := ret.Get(0).(func(string, string, int, int) model.ChannelMembers); ok {
|
||||
r0 = rf(teamID, userID, page, perPage)
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).(*model.ChannelMembers)
|
||||
r0 = ret.Get(0).(model.ChannelMembers)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1053,15 +1053,15 @@ func (_m *ChannelStore) GetMembersForUserWithPagination(teamID string, userID st
|
||||
}
|
||||
|
||||
// GetMoreChannels provides a mock function with given fields: teamID, userID, offset, limit
|
||||
func (_m *ChannelStore) GetMoreChannels(teamID string, userID string, offset int, limit int) (*model.ChannelList, error) {
|
||||
func (_m *ChannelStore) GetMoreChannels(teamID string, userID string, offset int, limit int) (model.ChannelList, error) {
|
||||
ret := _m.Called(teamID, userID, offset, limit)
|
||||
|
||||
var r0 *model.ChannelList
|
||||
if rf, ok := ret.Get(0).(func(string, string, int, int) *model.ChannelList); ok {
|
||||
var r0 model.ChannelList
|
||||
if rf, ok := ret.Get(0).(func(string, string, int, int) model.ChannelList); ok {
|
||||
r0 = rf(teamID, userID, offset, limit)
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).(*model.ChannelList)
|
||||
r0 = ret.Get(0).(model.ChannelList)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1120,15 +1120,15 @@ func (_m *ChannelStore) GetPinnedPosts(channelID string) (*model.PostList, error
|
||||
}
|
||||
|
||||
// GetPrivateChannelsForTeam provides a mock function with given fields: teamID, offset, limit
|
||||
func (_m *ChannelStore) GetPrivateChannelsForTeam(teamID string, offset int, limit int) (*model.ChannelList, error) {
|
||||
func (_m *ChannelStore) GetPrivateChannelsForTeam(teamID string, offset int, limit int) (model.ChannelList, error) {
|
||||
ret := _m.Called(teamID, offset, limit)
|
||||
|
||||
var r0 *model.ChannelList
|
||||
if rf, ok := ret.Get(0).(func(string, int, int) *model.ChannelList); ok {
|
||||
var r0 model.ChannelList
|
||||
if rf, ok := ret.Get(0).(func(string, int, int) model.ChannelList); ok {
|
||||
r0 = rf(teamID, offset, limit)
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).(*model.ChannelList)
|
||||
r0 = ret.Get(0).(model.ChannelList)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1143,15 +1143,15 @@ func (_m *ChannelStore) GetPrivateChannelsForTeam(teamID string, offset int, lim
|
||||
}
|
||||
|
||||
// GetPublicChannelsByIdsForTeam provides a mock function with given fields: teamID, channelIds
|
||||
func (_m *ChannelStore) GetPublicChannelsByIdsForTeam(teamID string, channelIds []string) (*model.ChannelList, error) {
|
||||
func (_m *ChannelStore) GetPublicChannelsByIdsForTeam(teamID string, channelIds []string) (model.ChannelList, error) {
|
||||
ret := _m.Called(teamID, channelIds)
|
||||
|
||||
var r0 *model.ChannelList
|
||||
if rf, ok := ret.Get(0).(func(string, []string) *model.ChannelList); ok {
|
||||
var r0 model.ChannelList
|
||||
if rf, ok := ret.Get(0).(func(string, []string) model.ChannelList); ok {
|
||||
r0 = rf(teamID, channelIds)
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).(*model.ChannelList)
|
||||
r0 = ret.Get(0).(model.ChannelList)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1166,15 +1166,15 @@ func (_m *ChannelStore) GetPublicChannelsByIdsForTeam(teamID string, channelIds
|
||||
}
|
||||
|
||||
// GetPublicChannelsForTeam provides a mock function with given fields: teamID, offset, limit
|
||||
func (_m *ChannelStore) GetPublicChannelsForTeam(teamID string, offset int, limit int) (*model.ChannelList, error) {
|
||||
func (_m *ChannelStore) GetPublicChannelsForTeam(teamID string, offset int, limit int) (model.ChannelList, error) {
|
||||
ret := _m.Called(teamID, offset, limit)
|
||||
|
||||
var r0 *model.ChannelList
|
||||
if rf, ok := ret.Get(0).(func(string, int, int) *model.ChannelList); ok {
|
||||
var r0 model.ChannelList
|
||||
if rf, ok := ret.Get(0).(func(string, int, int) model.ChannelList); ok {
|
||||
r0 = rf(teamID, offset, limit)
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).(*model.ChannelList)
|
||||
r0 = ret.Get(0).(model.ChannelList)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1258,15 +1258,15 @@ func (_m *ChannelStore) GetSidebarCategoryOrder(userID string, teamID string) ([
|
||||
}
|
||||
|
||||
// GetTeamChannels provides a mock function with given fields: teamID
|
||||
func (_m *ChannelStore) GetTeamChannels(teamID string) (*model.ChannelList, error) {
|
||||
func (_m *ChannelStore) GetTeamChannels(teamID string) (model.ChannelList, error) {
|
||||
ret := _m.Called(teamID)
|
||||
|
||||
var r0 *model.ChannelList
|
||||
if rf, ok := ret.Get(0).(func(string) *model.ChannelList); ok {
|
||||
var r0 model.ChannelList
|
||||
if rf, ok := ret.Get(0).(func(string) model.ChannelList); ok {
|
||||
r0 = rf(teamID)
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).(*model.ChannelList)
|
||||
r0 = ret.Get(0).(model.ChannelList)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1643,15 +1643,15 @@ func (_m *ChannelStore) SaveMultipleMembers(members []*model.ChannelMember) ([]*
|
||||
}
|
||||
|
||||
// SearchAllChannels provides a mock function with given fields: term, opts
|
||||
func (_m *ChannelStore) SearchAllChannels(term string, opts store.ChannelSearchOpts) (*model.ChannelListWithTeamData, int64, error) {
|
||||
func (_m *ChannelStore) SearchAllChannels(term string, opts store.ChannelSearchOpts) (model.ChannelListWithTeamData, int64, error) {
|
||||
ret := _m.Called(term, opts)
|
||||
|
||||
var r0 *model.ChannelListWithTeamData
|
||||
if rf, ok := ret.Get(0).(func(string, store.ChannelSearchOpts) *model.ChannelListWithTeamData); ok {
|
||||
var r0 model.ChannelListWithTeamData
|
||||
if rf, ok := ret.Get(0).(func(string, store.ChannelSearchOpts) model.ChannelListWithTeamData); ok {
|
||||
r0 = rf(term, opts)
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).(*model.ChannelListWithTeamData)
|
||||
r0 = ret.Get(0).(model.ChannelListWithTeamData)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1673,15 +1673,15 @@ func (_m *ChannelStore) SearchAllChannels(term string, opts store.ChannelSearchO
|
||||
}
|
||||
|
||||
// SearchArchivedInTeam provides a mock function with given fields: teamID, term, userID
|
||||
func (_m *ChannelStore) SearchArchivedInTeam(teamID string, term string, userID string) (*model.ChannelList, error) {
|
||||
func (_m *ChannelStore) SearchArchivedInTeam(teamID string, term string, userID string) (model.ChannelList, error) {
|
||||
ret := _m.Called(teamID, term, userID)
|
||||
|
||||
var r0 *model.ChannelList
|
||||
if rf, ok := ret.Get(0).(func(string, string, string) *model.ChannelList); ok {
|
||||
var r0 model.ChannelList
|
||||
if rf, ok := ret.Get(0).(func(string, string, string) model.ChannelList); ok {
|
||||
r0 = rf(teamID, term, userID)
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).(*model.ChannelList)
|
||||
r0 = ret.Get(0).(model.ChannelList)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1696,15 +1696,15 @@ func (_m *ChannelStore) SearchArchivedInTeam(teamID string, term string, userID
|
||||
}
|
||||
|
||||
// SearchForUserInTeam provides a mock function with given fields: userID, teamID, term, includeDeleted
|
||||
func (_m *ChannelStore) SearchForUserInTeam(userID string, teamID string, term string, includeDeleted bool) (*model.ChannelList, error) {
|
||||
func (_m *ChannelStore) SearchForUserInTeam(userID string, teamID string, term string, includeDeleted bool) (model.ChannelList, error) {
|
||||
ret := _m.Called(userID, teamID, term, includeDeleted)
|
||||
|
||||
var r0 *model.ChannelList
|
||||
if rf, ok := ret.Get(0).(func(string, string, string, bool) *model.ChannelList); ok {
|
||||
var r0 model.ChannelList
|
||||
if rf, ok := ret.Get(0).(func(string, string, string, bool) model.ChannelList); ok {
|
||||
r0 = rf(userID, teamID, term, includeDeleted)
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).(*model.ChannelList)
|
||||
r0 = ret.Get(0).(model.ChannelList)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1719,15 +1719,15 @@ func (_m *ChannelStore) SearchForUserInTeam(userID string, teamID string, term s
|
||||
}
|
||||
|
||||
// SearchGroupChannels provides a mock function with given fields: userID, term
|
||||
func (_m *ChannelStore) SearchGroupChannels(userID string, term string) (*model.ChannelList, error) {
|
||||
func (_m *ChannelStore) SearchGroupChannels(userID string, term string) (model.ChannelList, error) {
|
||||
ret := _m.Called(userID, term)
|
||||
|
||||
var r0 *model.ChannelList
|
||||
if rf, ok := ret.Get(0).(func(string, string) *model.ChannelList); ok {
|
||||
var r0 model.ChannelList
|
||||
if rf, ok := ret.Get(0).(func(string, string) model.ChannelList); ok {
|
||||
r0 = rf(userID, term)
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).(*model.ChannelList)
|
||||
r0 = ret.Get(0).(model.ChannelList)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1742,15 +1742,15 @@ func (_m *ChannelStore) SearchGroupChannels(userID string, term string) (*model.
|
||||
}
|
||||
|
||||
// SearchInTeam provides a mock function with given fields: teamID, term, includeDeleted
|
||||
func (_m *ChannelStore) SearchInTeam(teamID string, term string, includeDeleted bool) (*model.ChannelList, error) {
|
||||
func (_m *ChannelStore) SearchInTeam(teamID string, term string, includeDeleted bool) (model.ChannelList, error) {
|
||||
ret := _m.Called(teamID, term, includeDeleted)
|
||||
|
||||
var r0 *model.ChannelList
|
||||
if rf, ok := ret.Get(0).(func(string, string, bool) *model.ChannelList); ok {
|
||||
var r0 model.ChannelList
|
||||
if rf, ok := ret.Get(0).(func(string, string, bool) model.ChannelList); ok {
|
||||
r0 = rf(teamID, term, includeDeleted)
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).(*model.ChannelList)
|
||||
r0 = ret.Get(0).(model.ChannelList)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1765,15 +1765,15 @@ func (_m *ChannelStore) SearchInTeam(teamID string, term string, includeDeleted
|
||||
}
|
||||
|
||||
// SearchMore provides a mock function with given fields: userID, teamID, term
|
||||
func (_m *ChannelStore) SearchMore(userID string, teamID string, term string) (*model.ChannelList, error) {
|
||||
func (_m *ChannelStore) SearchMore(userID string, teamID string, term string) (model.ChannelList, error) {
|
||||
ret := _m.Called(userID, teamID, term)
|
||||
|
||||
var r0 *model.ChannelList
|
||||
if rf, ok := ret.Get(0).(func(string, string, string) *model.ChannelList); ok {
|
||||
var r0 model.ChannelList
|
||||
if rf, ok := ret.Get(0).(func(string, string, string) model.ChannelList); ok {
|
||||
r0 = rf(userID, teamID, term)
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).(*model.ChannelList)
|
||||
r0 = ret.Get(0).(model.ChannelList)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2005,11 +2005,11 @@ func (_m *ChannelStore) UpdateSidebarChannelCategoryOnMove(channel *model.Channe
|
||||
}
|
||||
|
||||
// UpdateSidebarChannelsByPreferences provides a mock function with given fields: preferences
|
||||
func (_m *ChannelStore) UpdateSidebarChannelsByPreferences(preferences *model.Preferences) error {
|
||||
func (_m *ChannelStore) UpdateSidebarChannelsByPreferences(preferences model.Preferences) error {
|
||||
ret := _m.Called(preferences)
|
||||
|
||||
var r0 error
|
||||
if rf, ok := ret.Get(0).(func(*model.Preferences) error); ok {
|
||||
if rf, ok := ret.Get(0).(func(model.Preferences) error); ok {
|
||||
r0 = rf(preferences)
|
||||
} else {
|
||||
r0 = ret.Error(0)
|
||||
|
||||
@@ -182,11 +182,11 @@ func (_m *PreferenceStore) PermanentDeleteByUser(userID string) error {
|
||||
}
|
||||
|
||||
// Save provides a mock function with given fields: preferences
|
||||
func (_m *PreferenceStore) Save(preferences *model.Preferences) error {
|
||||
func (_m *PreferenceStore) Save(preferences model.Preferences) error {
|
||||
ret := _m.Called(preferences)
|
||||
|
||||
var r0 error
|
||||
if rf, ok := ret.Get(0).(func(*model.Preferences) error); ok {
|
||||
if rf, ok := ret.Get(0).(func(model.Preferences) error); ok {
|
||||
r0 = rf(preferences)
|
||||
} else {
|
||||
r0 = ret.Error(0)
|
||||
|
||||
@@ -29,11 +29,11 @@ func (_m *ProductNoticesStore) Clear(notices []string) error {
|
||||
}
|
||||
|
||||
// ClearOldNotices provides a mock function with given fields: currentNotices
|
||||
func (_m *ProductNoticesStore) ClearOldNotices(currentNotices *model.ProductNotices) error {
|
||||
func (_m *ProductNoticesStore) ClearOldNotices(currentNotices model.ProductNotices) error {
|
||||
ret := _m.Called(currentNotices)
|
||||
|
||||
var r0 error
|
||||
if rf, ok := ret.Get(0).(func(*model.ProductNotices) error); ok {
|
||||
if rf, ok := ret.Get(0).(func(model.ProductNotices) error); ok {
|
||||
r0 = rf(currentNotices)
|
||||
} else {
|
||||
r0 = ret.Error(0)
|
||||
|
||||
@@ -305,7 +305,7 @@ func testOAuthGetAuthorizedApps(t *testing.T, ss store.Store) {
|
||||
p.Category = model.PreferenceCategoryAuthorizedOAuthApp
|
||||
p.Name = a1.Id
|
||||
p.Value = "true"
|
||||
nErr := ss.Preference().Save(&model.Preferences{p})
|
||||
nErr := ss.Preference().Save(model.Preferences{p})
|
||||
require.NoError(t, nErr)
|
||||
|
||||
apps, err = ss.OAuth().GetAuthorizedApps(a1.CreatorId, 0, 1000)
|
||||
@@ -328,7 +328,7 @@ func testOAuthGetAccessDataByUserForApp(t *testing.T, ss store.Store) {
|
||||
p.Category = model.PreferenceCategoryAuthorizedOAuthApp
|
||||
p.Name = a1.Id
|
||||
p.Value = "true"
|
||||
nErr := ss.Preference().Save(&model.Preferences{p})
|
||||
nErr := ss.Preference().Save(model.Preferences{p})
|
||||
require.NoError(t, nErr)
|
||||
|
||||
apps, err := ss.OAuth().GetAuthorizedApps(a1.CreatorId, 0, 1000)
|
||||
|
||||
@@ -1939,7 +1939,7 @@ func testPostStoreGetFlaggedPostsForTeam(t *testing.T, ss store.Store, s SqlStor
|
||||
},
|
||||
}
|
||||
|
||||
err = ss.Preference().Save(&preferences)
|
||||
err = ss.Preference().Save(preferences)
|
||||
require.NoError(t, err)
|
||||
|
||||
r2, err := ss.Post().GetFlaggedPostsForTeam(o1.UserId, c1.TeamId, 0, 2)
|
||||
@@ -1955,7 +1955,7 @@ func testPostStoreGetFlaggedPostsForTeam(t *testing.T, ss store.Store, s SqlStor
|
||||
},
|
||||
}
|
||||
|
||||
err = ss.Preference().Save(&preferences)
|
||||
err = ss.Preference().Save(preferences)
|
||||
require.NoError(t, err)
|
||||
|
||||
r3, err := ss.Post().GetFlaggedPostsForTeam(o1.UserId, c1.TeamId, 0, 1)
|
||||
@@ -1983,7 +1983,7 @@ func testPostStoreGetFlaggedPostsForTeam(t *testing.T, ss store.Store, s SqlStor
|
||||
},
|
||||
}
|
||||
|
||||
err = ss.Preference().Save(&preferences)
|
||||
err = ss.Preference().Save(preferences)
|
||||
require.NoError(t, err)
|
||||
|
||||
r4, err = ss.Post().GetFlaggedPostsForTeam(o1.UserId, c1.TeamId, 0, 2)
|
||||
@@ -1998,7 +1998,7 @@ func testPostStoreGetFlaggedPostsForTeam(t *testing.T, ss store.Store, s SqlStor
|
||||
Value: "true",
|
||||
},
|
||||
}
|
||||
err = ss.Preference().Save(&preferences)
|
||||
err = ss.Preference().Save(preferences)
|
||||
require.NoError(t, err)
|
||||
|
||||
r4, err = ss.Post().GetFlaggedPostsForTeam(o1.UserId, c1.TeamId, 0, 2)
|
||||
@@ -2017,7 +2017,7 @@ func testPostStoreGetFlaggedPostsForTeam(t *testing.T, ss store.Store, s SqlStor
|
||||
Value: "true",
|
||||
},
|
||||
}
|
||||
err = ss.Preference().Save(&preferences)
|
||||
err = ss.Preference().Save(preferences)
|
||||
require.NoError(t, err)
|
||||
|
||||
r4, err = ss.Post().GetFlaggedPostsForTeam(o1.UserId, c1.TeamId, 0, 10)
|
||||
@@ -2067,7 +2067,7 @@ func testPostStoreGetFlaggedPosts(t *testing.T, ss store.Store) {
|
||||
},
|
||||
}
|
||||
|
||||
nErr := ss.Preference().Save(&preferences)
|
||||
nErr := ss.Preference().Save(preferences)
|
||||
require.NoError(t, nErr)
|
||||
|
||||
r2, err := ss.Post().GetFlaggedPosts(o1.UserId, 0, 2)
|
||||
@@ -2083,7 +2083,7 @@ func testPostStoreGetFlaggedPosts(t *testing.T, ss store.Store) {
|
||||
},
|
||||
}
|
||||
|
||||
nErr = ss.Preference().Save(&preferences)
|
||||
nErr = ss.Preference().Save(preferences)
|
||||
require.NoError(t, nErr)
|
||||
|
||||
r3, err := ss.Post().GetFlaggedPosts(o1.UserId, 0, 1)
|
||||
@@ -2111,7 +2111,7 @@ func testPostStoreGetFlaggedPosts(t *testing.T, ss store.Store) {
|
||||
},
|
||||
}
|
||||
|
||||
nErr = ss.Preference().Save(&preferences)
|
||||
nErr = ss.Preference().Save(preferences)
|
||||
require.NoError(t, nErr)
|
||||
|
||||
r4, err = ss.Post().GetFlaggedPosts(o1.UserId, 0, 2)
|
||||
@@ -2165,7 +2165,7 @@ func testPostStoreGetFlaggedPostsForChannel(t *testing.T, ss store.Store) {
|
||||
Value: "true",
|
||||
}
|
||||
|
||||
nErr := ss.Preference().Save(&model.Preferences{preference})
|
||||
nErr := ss.Preference().Save(model.Preferences{preference})
|
||||
require.NoError(t, nErr)
|
||||
|
||||
r, err = ss.Post().GetFlaggedPostsForChannel(o1.UserId, o1.ChannelId, 0, 10)
|
||||
@@ -2173,11 +2173,11 @@ func testPostStoreGetFlaggedPostsForChannel(t *testing.T, ss store.Store) {
|
||||
require.Len(t, r.Order, 1, "should have 1 post")
|
||||
|
||||
preference.Name = o2.Id
|
||||
nErr = ss.Preference().Save(&model.Preferences{preference})
|
||||
nErr = ss.Preference().Save(model.Preferences{preference})
|
||||
require.NoError(t, nErr)
|
||||
|
||||
preference.Name = o3.Id
|
||||
nErr = ss.Preference().Save(&model.Preferences{preference})
|
||||
nErr = ss.Preference().Save(model.Preferences{preference})
|
||||
require.NoError(t, nErr)
|
||||
|
||||
r, err = ss.Post().GetFlaggedPostsForChannel(o1.UserId, o1.ChannelId, 0, 1)
|
||||
@@ -2197,7 +2197,7 @@ func testPostStoreGetFlaggedPostsForChannel(t *testing.T, ss store.Store) {
|
||||
require.Len(t, r.Order, 2, "should have 2 posts")
|
||||
|
||||
preference.Name = o4.Id
|
||||
nErr = ss.Preference().Save(&model.Preferences{preference})
|
||||
nErr = ss.Preference().Save(model.Preferences{preference})
|
||||
require.NoError(t, nErr)
|
||||
|
||||
r, err = ss.Post().GetFlaggedPostsForChannel(o1.UserId, o4.ChannelId, 0, 10)
|
||||
|
||||
@@ -42,7 +42,7 @@ func testPreferenceSave(t *testing.T, ss store.Store) {
|
||||
Value: "value1b",
|
||||
},
|
||||
}
|
||||
err := ss.Preference().Save(&preferences)
|
||||
err := ss.Preference().Save(preferences)
|
||||
require.NoError(t, err, "saving preference returned error")
|
||||
|
||||
for _, preference := range preferences {
|
||||
@@ -52,7 +52,7 @@ func testPreferenceSave(t *testing.T, ss store.Store) {
|
||||
|
||||
preferences[0].Value = "value2a"
|
||||
preferences[1].Value = "value2b"
|
||||
err = ss.Preference().Save(&preferences)
|
||||
err = ss.Preference().Save(preferences)
|
||||
require.NoError(t, err, "saving preference returned error")
|
||||
|
||||
for _, preference := range preferences {
|
||||
@@ -89,7 +89,7 @@ func testPreferenceGet(t *testing.T, ss store.Store) {
|
||||
},
|
||||
}
|
||||
|
||||
err := ss.Preference().Save(&preferences)
|
||||
err := ss.Preference().Save(preferences)
|
||||
require.NoError(t, err)
|
||||
|
||||
data, err := ss.Preference().Get(userId, category, name)
|
||||
@@ -132,7 +132,7 @@ func testPreferenceGetCategory(t *testing.T, ss store.Store) {
|
||||
},
|
||||
}
|
||||
|
||||
err := ss.Preference().Save(&preferences)
|
||||
err := ss.Preference().Save(preferences)
|
||||
require.NoError(t, err)
|
||||
|
||||
preferencesByCategory, err := ss.Preference().GetCategory(userId, category)
|
||||
@@ -181,7 +181,7 @@ func testPreferenceGetAll(t *testing.T, ss store.Store) {
|
||||
},
|
||||
}
|
||||
|
||||
err := ss.Preference().Save(&preferences)
|
||||
err := ss.Preference().Save(preferences)
|
||||
require.NoError(t, err)
|
||||
|
||||
result, err := ss.Preference().GetAll(userId)
|
||||
@@ -225,7 +225,7 @@ func testPreferenceDeleteByUser(t *testing.T, ss store.Store) {
|
||||
},
|
||||
}
|
||||
|
||||
err := ss.Preference().Save(&preferences)
|
||||
err := ss.Preference().Save(preferences)
|
||||
require.NoError(t, err)
|
||||
|
||||
err = ss.Preference().PermanentDeleteByUser(userId)
|
||||
@@ -240,7 +240,7 @@ func testPreferenceDelete(t *testing.T, ss store.Store) {
|
||||
Value: "value1a",
|
||||
}
|
||||
|
||||
err := ss.Preference().Save(&model.Preferences{preference})
|
||||
err := ss.Preference().Save(model.Preferences{preference})
|
||||
require.NoError(t, err)
|
||||
|
||||
preferences, err := ss.Preference().GetAll(preference.UserId)
|
||||
@@ -272,7 +272,7 @@ func testPreferenceDeleteCategory(t *testing.T, ss store.Store) {
|
||||
Value: "value1a",
|
||||
}
|
||||
|
||||
err := ss.Preference().Save(&model.Preferences{preference1, preference2})
|
||||
err := ss.Preference().Save(model.Preferences{preference1, preference2})
|
||||
require.NoError(t, err)
|
||||
|
||||
preferences, err := ss.Preference().GetAll(userId)
|
||||
@@ -307,7 +307,7 @@ func testPreferenceDeleteCategoryAndName(t *testing.T, ss store.Store) {
|
||||
Value: "value1a",
|
||||
}
|
||||
|
||||
err := ss.Preference().Save(&model.Preferences{preference1, preference2})
|
||||
err := ss.Preference().Save(model.Preferences{preference1, preference2})
|
||||
require.NoError(t, err)
|
||||
|
||||
preferences, err := ss.Preference().GetAll(userId)
|
||||
@@ -378,7 +378,7 @@ func testPreferenceDeleteOrphanedRows(t *testing.T, ss store.Store) {
|
||||
Value: "true",
|
||||
}
|
||||
|
||||
nErr := ss.Preference().Save(&model.Preferences{preference1, preference2})
|
||||
nErr := ss.Preference().Save(model.Preferences{preference1, preference2})
|
||||
require.NoError(t, nErr)
|
||||
|
||||
_, _, nErr = ss.Post().PermanentDeleteBatchForRetentionPolicies(0, 2000, limit, model.RetentionPolicyCursor{})
|
||||
|
||||
@@ -64,7 +64,7 @@ func testClearOld(t *testing.T, ss store.Store) {
|
||||
err := ss.ProductNotices().View("testuser", noticesA)
|
||||
require.NoError(t, err)
|
||||
|
||||
err = ss.ProductNotices().ClearOldNotices(&model.ProductNotices{
|
||||
err = ss.ProductNotices().ClearOldNotices(model.ProductNotices{
|
||||
{
|
||||
ID: "noticeA",
|
||||
},
|
||||
|
||||
@@ -550,7 +550,7 @@ func (s *TimerLayerChannelStore) AnalyticsTypeCount(teamID string, channelType m
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *TimerLayerChannelStore) AutocompleteInTeam(teamID string, term string, includeDeleted bool) (*model.ChannelList, error) {
|
||||
func (s *TimerLayerChannelStore) AutocompleteInTeam(teamID string, term string, includeDeleted bool) (model.ChannelList, error) {
|
||||
start := timemodule.Now()
|
||||
|
||||
result, err := s.ChannelStore.AutocompleteInTeam(teamID, term, includeDeleted)
|
||||
@@ -566,7 +566,7 @@ func (s *TimerLayerChannelStore) AutocompleteInTeam(teamID string, term string,
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *TimerLayerChannelStore) AutocompleteInTeamForSearch(teamID string, userID string, term string, includeDeleted bool) (*model.ChannelList, error) {
|
||||
func (s *TimerLayerChannelStore) AutocompleteInTeamForSearch(teamID string, userID string, term string, includeDeleted bool) (model.ChannelList, error) {
|
||||
start := timemodule.Now()
|
||||
|
||||
result, err := s.ChannelStore.AutocompleteInTeamForSearch(teamID, userID, term, includeDeleted)
|
||||
@@ -725,7 +725,7 @@ func (s *TimerLayerChannelStore) DeleteSidebarCategory(categoryID string) error
|
||||
return err
|
||||
}
|
||||
|
||||
func (s *TimerLayerChannelStore) DeleteSidebarChannelsByPreferences(preferences *model.Preferences) error {
|
||||
func (s *TimerLayerChannelStore) DeleteSidebarChannelsByPreferences(preferences model.Preferences) error {
|
||||
start := timemodule.Now()
|
||||
|
||||
err := s.ChannelStore.DeleteSidebarChannelsByPreferences(preferences)
|
||||
@@ -805,7 +805,7 @@ func (s *TimerLayerChannelStore) GetAllChannelMembersNotifyPropsForChannel(chann
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *TimerLayerChannelStore) GetAllChannels(page int, perPage int, opts store.ChannelSearchOpts) (*model.ChannelListWithTeamData, error) {
|
||||
func (s *TimerLayerChannelStore) GetAllChannels(page int, perPage int, opts store.ChannelSearchOpts) (model.ChannelListWithTeamData, error) {
|
||||
start := timemodule.Now()
|
||||
|
||||
result, err := s.ChannelStore.GetAllChannels(page, perPage, opts)
|
||||
@@ -981,7 +981,7 @@ func (s *TimerLayerChannelStore) GetChannelUnread(channelID string, userID strin
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *TimerLayerChannelStore) GetChannels(teamID string, userID string, includeDeleted bool, lastDeleteAt int) (*model.ChannelList, error) {
|
||||
func (s *TimerLayerChannelStore) GetChannels(teamID string, userID string, includeDeleted bool, lastDeleteAt int) (model.ChannelList, error) {
|
||||
start := timemodule.Now()
|
||||
|
||||
result, err := s.ChannelStore.GetChannels(teamID, userID, includeDeleted, lastDeleteAt)
|
||||
@@ -1045,7 +1045,7 @@ func (s *TimerLayerChannelStore) GetChannelsByScheme(schemeID string, offset int
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *TimerLayerChannelStore) GetDeleted(team_id string, offset int, limit int, userID string) (*model.ChannelList, error) {
|
||||
func (s *TimerLayerChannelStore) GetDeleted(team_id string, offset int, limit int, userID string) (model.ChannelList, error) {
|
||||
start := timemodule.Now()
|
||||
|
||||
result, err := s.ChannelStore.GetDeleted(team_id, offset, limit, userID)
|
||||
@@ -1205,7 +1205,7 @@ func (s *TimerLayerChannelStore) GetMemberForPost(postID string, userID string)
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *TimerLayerChannelStore) GetMembers(channelID string, offset int, limit int) (*model.ChannelMembers, error) {
|
||||
func (s *TimerLayerChannelStore) GetMembers(channelID string, offset int, limit int) (model.ChannelMembers, error) {
|
||||
start := timemodule.Now()
|
||||
|
||||
result, err := s.ChannelStore.GetMembers(channelID, offset, limit)
|
||||
@@ -1221,7 +1221,7 @@ func (s *TimerLayerChannelStore) GetMembers(channelID string, offset int, limit
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *TimerLayerChannelStore) GetMembersByChannelIds(channelIds []string, userID string) (*model.ChannelMembers, error) {
|
||||
func (s *TimerLayerChannelStore) GetMembersByChannelIds(channelIds []string, userID string) (model.ChannelMembers, error) {
|
||||
start := timemodule.Now()
|
||||
|
||||
result, err := s.ChannelStore.GetMembersByChannelIds(channelIds, userID)
|
||||
@@ -1237,7 +1237,7 @@ func (s *TimerLayerChannelStore) GetMembersByChannelIds(channelIds []string, use
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *TimerLayerChannelStore) GetMembersByIds(channelID string, userIds []string) (*model.ChannelMembers, error) {
|
||||
func (s *TimerLayerChannelStore) GetMembersByIds(channelID string, userIds []string) (model.ChannelMembers, error) {
|
||||
start := timemodule.Now()
|
||||
|
||||
result, err := s.ChannelStore.GetMembersByIds(channelID, userIds)
|
||||
@@ -1253,7 +1253,7 @@ func (s *TimerLayerChannelStore) GetMembersByIds(channelID string, userIds []str
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *TimerLayerChannelStore) GetMembersForUser(teamID string, userID string) (*model.ChannelMembers, error) {
|
||||
func (s *TimerLayerChannelStore) GetMembersForUser(teamID string, userID string) (model.ChannelMembers, error) {
|
||||
start := timemodule.Now()
|
||||
|
||||
result, err := s.ChannelStore.GetMembersForUser(teamID, userID)
|
||||
@@ -1269,7 +1269,7 @@ func (s *TimerLayerChannelStore) GetMembersForUser(teamID string, userID string)
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *TimerLayerChannelStore) GetMembersForUserWithPagination(teamID string, userID string, page int, perPage int) (*model.ChannelMembers, error) {
|
||||
func (s *TimerLayerChannelStore) GetMembersForUserWithPagination(teamID string, userID string, page int, perPage int) (model.ChannelMembers, error) {
|
||||
start := timemodule.Now()
|
||||
|
||||
result, err := s.ChannelStore.GetMembersForUserWithPagination(teamID, userID, page, perPage)
|
||||
@@ -1285,7 +1285,7 @@ func (s *TimerLayerChannelStore) GetMembersForUserWithPagination(teamID string,
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *TimerLayerChannelStore) GetMoreChannels(teamID string, userID string, offset int, limit int) (*model.ChannelList, error) {
|
||||
func (s *TimerLayerChannelStore) GetMoreChannels(teamID string, userID string, offset int, limit int) (model.ChannelList, error) {
|
||||
start := timemodule.Now()
|
||||
|
||||
result, err := s.ChannelStore.GetMoreChannels(teamID, userID, offset, limit)
|
||||
@@ -1333,7 +1333,7 @@ func (s *TimerLayerChannelStore) GetPinnedPosts(channelID string) (*model.PostLi
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *TimerLayerChannelStore) GetPrivateChannelsForTeam(teamID string, offset int, limit int) (*model.ChannelList, error) {
|
||||
func (s *TimerLayerChannelStore) GetPrivateChannelsForTeam(teamID string, offset int, limit int) (model.ChannelList, error) {
|
||||
start := timemodule.Now()
|
||||
|
||||
result, err := s.ChannelStore.GetPrivateChannelsForTeam(teamID, offset, limit)
|
||||
@@ -1349,7 +1349,7 @@ func (s *TimerLayerChannelStore) GetPrivateChannelsForTeam(teamID string, offset
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *TimerLayerChannelStore) GetPublicChannelsByIdsForTeam(teamID string, channelIds []string) (*model.ChannelList, error) {
|
||||
func (s *TimerLayerChannelStore) GetPublicChannelsByIdsForTeam(teamID string, channelIds []string) (model.ChannelList, error) {
|
||||
start := timemodule.Now()
|
||||
|
||||
result, err := s.ChannelStore.GetPublicChannelsByIdsForTeam(teamID, channelIds)
|
||||
@@ -1365,7 +1365,7 @@ func (s *TimerLayerChannelStore) GetPublicChannelsByIdsForTeam(teamID string, ch
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *TimerLayerChannelStore) GetPublicChannelsForTeam(teamID string, offset int, limit int) (*model.ChannelList, error) {
|
||||
func (s *TimerLayerChannelStore) GetPublicChannelsForTeam(teamID string, offset int, limit int) (model.ChannelList, error) {
|
||||
start := timemodule.Now()
|
||||
|
||||
result, err := s.ChannelStore.GetPublicChannelsForTeam(teamID, offset, limit)
|
||||
@@ -1429,7 +1429,7 @@ func (s *TimerLayerChannelStore) GetSidebarCategoryOrder(userID string, teamID s
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *TimerLayerChannelStore) GetTeamChannels(teamID string) (*model.ChannelList, error) {
|
||||
func (s *TimerLayerChannelStore) GetTeamChannels(teamID string) (model.ChannelList, error) {
|
||||
start := timemodule.Now()
|
||||
|
||||
result, err := s.ChannelStore.GetTeamChannels(teamID)
|
||||
@@ -1854,7 +1854,7 @@ func (s *TimerLayerChannelStore) SaveMultipleMembers(members []*model.ChannelMem
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *TimerLayerChannelStore) SearchAllChannels(term string, opts store.ChannelSearchOpts) (*model.ChannelListWithTeamData, int64, error) {
|
||||
func (s *TimerLayerChannelStore) SearchAllChannels(term string, opts store.ChannelSearchOpts) (model.ChannelListWithTeamData, int64, error) {
|
||||
start := timemodule.Now()
|
||||
|
||||
result, resultVar1, err := s.ChannelStore.SearchAllChannels(term, opts)
|
||||
@@ -1870,7 +1870,7 @@ func (s *TimerLayerChannelStore) SearchAllChannels(term string, opts store.Chann
|
||||
return result, resultVar1, err
|
||||
}
|
||||
|
||||
func (s *TimerLayerChannelStore) SearchArchivedInTeam(teamID string, term string, userID string) (*model.ChannelList, error) {
|
||||
func (s *TimerLayerChannelStore) SearchArchivedInTeam(teamID string, term string, userID string) (model.ChannelList, error) {
|
||||
start := timemodule.Now()
|
||||
|
||||
result, err := s.ChannelStore.SearchArchivedInTeam(teamID, term, userID)
|
||||
@@ -1886,7 +1886,7 @@ func (s *TimerLayerChannelStore) SearchArchivedInTeam(teamID string, term string
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *TimerLayerChannelStore) SearchForUserInTeam(userID string, teamID string, term string, includeDeleted bool) (*model.ChannelList, error) {
|
||||
func (s *TimerLayerChannelStore) SearchForUserInTeam(userID string, teamID string, term string, includeDeleted bool) (model.ChannelList, error) {
|
||||
start := timemodule.Now()
|
||||
|
||||
result, err := s.ChannelStore.SearchForUserInTeam(userID, teamID, term, includeDeleted)
|
||||
@@ -1902,7 +1902,7 @@ func (s *TimerLayerChannelStore) SearchForUserInTeam(userID string, teamID strin
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *TimerLayerChannelStore) SearchGroupChannels(userID string, term string) (*model.ChannelList, error) {
|
||||
func (s *TimerLayerChannelStore) SearchGroupChannels(userID string, term string) (model.ChannelList, error) {
|
||||
start := timemodule.Now()
|
||||
|
||||
result, err := s.ChannelStore.SearchGroupChannels(userID, term)
|
||||
@@ -1918,7 +1918,7 @@ func (s *TimerLayerChannelStore) SearchGroupChannels(userID string, term string)
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *TimerLayerChannelStore) SearchInTeam(teamID string, term string, includeDeleted bool) (*model.ChannelList, error) {
|
||||
func (s *TimerLayerChannelStore) SearchInTeam(teamID string, term string, includeDeleted bool) (model.ChannelList, error) {
|
||||
start := timemodule.Now()
|
||||
|
||||
result, err := s.ChannelStore.SearchInTeam(teamID, term, includeDeleted)
|
||||
@@ -1934,7 +1934,7 @@ func (s *TimerLayerChannelStore) SearchInTeam(teamID string, term string, includ
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *TimerLayerChannelStore) SearchMore(userID string, teamID string, term string) (*model.ChannelList, error) {
|
||||
func (s *TimerLayerChannelStore) SearchMore(userID string, teamID string, term string) (model.ChannelList, error) {
|
||||
start := timemodule.Now()
|
||||
|
||||
result, err := s.ChannelStore.SearchMore(userID, teamID, term)
|
||||
@@ -2126,7 +2126,7 @@ func (s *TimerLayerChannelStore) UpdateSidebarChannelCategoryOnMove(channel *mod
|
||||
return err
|
||||
}
|
||||
|
||||
func (s *TimerLayerChannelStore) UpdateSidebarChannelsByPreferences(preferences *model.Preferences) error {
|
||||
func (s *TimerLayerChannelStore) UpdateSidebarChannelsByPreferences(preferences model.Preferences) error {
|
||||
start := timemodule.Now()
|
||||
|
||||
err := s.ChannelStore.UpdateSidebarChannelsByPreferences(preferences)
|
||||
@@ -5353,7 +5353,7 @@ func (s *TimerLayerPreferenceStore) PermanentDeleteByUser(userID string) error {
|
||||
return err
|
||||
}
|
||||
|
||||
func (s *TimerLayerPreferenceStore) Save(preferences *model.Preferences) error {
|
||||
func (s *TimerLayerPreferenceStore) Save(preferences model.Preferences) error {
|
||||
start := timemodule.Now()
|
||||
|
||||
err := s.PreferenceStore.Save(preferences)
|
||||
@@ -5385,7 +5385,7 @@ func (s *TimerLayerProductNoticesStore) Clear(notices []string) error {
|
||||
return err
|
||||
}
|
||||
|
||||
func (s *TimerLayerProductNoticesStore) ClearOldNotices(currentNotices *model.ProductNotices) error {
|
||||
func (s *TimerLayerProductNoticesStore) ClearOldNotices(currentNotices model.ProductNotices) error {
|
||||
start := timemodule.Now()
|
||||
|
||||
err := s.ProductNoticesStore.ClearOldNotices(currentNotices)
|
||||
|
||||
Ссылка в новой задаче
Block a user