From 71bf7777f57531c1a9d36a473be5790bb83fa077 Mon Sep 17 00:00:00 2001 From: Matthew Straughn Date: Tue, 29 Oct 2024 05:50:38 -0400 Subject: [PATCH] fixed most init errors in channels/store/storetest dir | 24 files edited (#26522) Co-authored-by: Ben Schumacher Co-authored-by: Agniva De Sarker --- server/.golangci.yml | 4 +- server/channels/app/channel.go | 2 +- server/channels/app/post.go | 2 +- .../opentracinglayer/opentracinglayer.go | 240 ++--- .../channels/store/retrylayer/retrylayer.go | 240 ++--- .../channels/store/sqlstore/channel_store.go | 2 +- server/channels/store/sqlstore/post_store.go | 2 +- server/channels/store/store.go | 126 +-- server/channels/store/storetest/bot_store.go | 24 +- .../store/storetest/channel_bookmark.go | 104 +-- .../storetest/channel_member_history_store.go | 10 +- .../channels/store/storetest/channel_store.go | 862 +++++++++--------- .../storetest/channel_store_categories.go | 684 +++++++------- .../store/storetest/compliance_store.go | 64 +- .../store/storetest/desktop_tokens_store.go | 24 +- .../channels/store/storetest/draft_store.go | 242 ++--- .../store/storetest/file_info_store.go | 254 +++--- .../channels/store/storetest/group_store.go | 20 +- .../store/storetest/mocks/AuditStore.go | 12 +- .../storetest/mocks/ChannelBookmarkStore.go | 40 +- .../store/storetest/mocks/ChannelStore.go | 80 +- .../storetest/mocks/DesktopTokensStore.go | 16 +- .../store/storetest/mocks/DraftStore.go | 30 +- .../store/storetest/mocks/NotifyAdminStore.go | 20 +- .../store/storetest/mocks/OAuthStore.go | 40 +- .../storetest/mocks/PostPriorityStore.go | 12 +- .../store/storetest/mocks/PostStore.go | 24 +- .../store/storetest/mocks/ReactionStore.go | 36 +- .../storetest/mocks/RemoteClusterStore.go | 44 +- .../storetest/mocks/RetentionPolicyStore.go | 80 +- .../storetest/mocks/SharedChannelStore.go | 96 +- .../store/storetest/mocks/ThreadStore.go | 92 +- .../store/storetest/mocks/UserStore.go | 24 +- .../mocks/UserTermsOfServiceStore.go | 8 +- .../store/storetest/notify_admin_store.go | 40 +- .../storetest/outgoing_oauth_connection.go | 8 +- .../channels/store/storetest/plugin_store.go | 256 +++--- .../storetest/post_acknowledgements_store.go | 44 +- .../post_persistent_notification_store.go | 42 +- .../store/storetest/post_priority_store.go | 6 +- server/channels/store/storetest/post_store.go | 856 ++++++++--------- .../channels/store/storetest/status_store.go | 2 +- server/channels/store/storetest/team_store.go | 264 +++--- .../channels/store/storetest/thread_store.go | 30 +- server/channels/store/storetest/user_store.go | 676 +++++++------- server/channels/store/storetest/utils.go | 12 +- server/channels/store/storetest/utils_test.go | 2 +- .../channels/store/timerlayer/timerlayer.go | 240 ++--- 48 files changed, 3018 insertions(+), 3020 deletions(-) diff --git a/server/.golangci.yml b/server/.golangci.yml index 0b69db01b1142..92e7313ad4bc2 100644 --- a/server/.golangci.yml +++ b/server/.golangci.yml @@ -28,8 +28,6 @@ linters: - errcheck issues: - exclude-dirs: - - channels/store/storetest/mocks exclude-rules: - linters: # ignore unused warnings from enterprise code @@ -39,8 +37,8 @@ issues: - linters: - revive - text: "var-naming|error-naming|exported|increment-decrement|error-strings|if-return|unused-parameter|blank-imports|empty-block" # We need to fix the unused parameter issues and remove the exception. + text: "var-naming|error-naming|exported|increment-decrement|error-strings|if-return|unused-parameter|blank-imports|empty-block" # Use a seperate set of exception for the enterprise code to allow community members to fix only the open source issues. - linters: diff --git a/server/channels/app/channel.go b/server/channels/app/channel.go index 7d8a086f0a73c..8e06b5d9bbf8c 100644 --- a/server/channels/app/channel.go +++ b/server/channels/app/channel.go @@ -2954,7 +2954,7 @@ func (a *App) SearchAllChannels(c request.CTX, term string, opts model.ChannelSe ExcludeGroupConstrained: opts.ExcludeGroupConstrained, PolicyID: opts.PolicyID, IncludePolicyID: opts.IncludePolicyID, - IncludeSearchById: opts.IncludeSearchById, + IncludeSearchByID: opts.IncludeSearchById, ExcludeRemote: opts.ExcludeRemote, ExcludePolicyConstrained: opts.ExcludePolicyConstrained, Public: opts.Public, diff --git a/server/channels/app/post.go b/server/channels/app/post.go index 100f54ad17199..e5a6e387a9ec4 100644 --- a/server/channels/app/post.go +++ b/server/channels/app/post.go @@ -2151,7 +2151,7 @@ func (a *App) SetPostReminder(rctx request.CTX, postID, userID string, targetTim CreateAt: model.GetMillis(), UserId: userID, RootId: postID, - ChannelId: metadata.ChannelId, + ChannelId: metadata.ChannelID, // It's okay to keep this non-translated. This is just a fallback. // The webapp will parse the timestamp and show that in user's local timezone. Message: fmt.Sprintf("You will be reminded about %s by @%s at %s", permalink, metadata.Username, parsedTime), diff --git a/server/channels/store/opentracinglayer/opentracinglayer.go b/server/channels/store/opentracinglayer/opentracinglayer.go index 1f8808272a810..b6962678124a4 100644 --- a/server/channels/store/opentracinglayer/opentracinglayer.go +++ b/server/channels/store/opentracinglayer/opentracinglayer.go @@ -471,7 +471,7 @@ type OpenTracingLayerWebhookStore struct { Root *OpenTracingLayer } -func (s *OpenTracingLayerAuditStore) Get(user_id string, offset int, limit int) (model.Audits, error) { +func (s *OpenTracingLayerAuditStore) Get(userID string, offset int, limit int) (model.Audits, error) { origCtx := s.Root.Store.Context() span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "AuditStore.Get") s.Root.Store.SetContext(newCtx) @@ -480,7 +480,7 @@ func (s *OpenTracingLayerAuditStore) Get(user_id string, offset int, limit int) }() defer span.Finish() - result, err := s.AuditStore.Get(user_id, offset, limit) + result, err := s.AuditStore.Get(userID, offset, limit) if err != nil { span.LogFields(spanlog.Error(err)) ext.Error.Set(span, true) @@ -1091,7 +1091,7 @@ func (s *OpenTracingLayerChannelStore) GetAllDirectChannelsForExportAfter(limit return result, err } -func (s *OpenTracingLayerChannelStore) GetByName(team_id string, name string, allowFromCache bool) (*model.Channel, error) { +func (s *OpenTracingLayerChannelStore) GetByName(teamID string, name string, allowFromCache bool) (*model.Channel, error) { origCtx := s.Root.Store.Context() span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "ChannelStore.GetByName") s.Root.Store.SetContext(newCtx) @@ -1100,7 +1100,7 @@ func (s *OpenTracingLayerChannelStore) GetByName(team_id string, name string, al }() defer span.Finish() - result, err := s.ChannelStore.GetByName(team_id, name, allowFromCache) + result, err := s.ChannelStore.GetByName(teamID, name, allowFromCache) if err != nil { span.LogFields(spanlog.Error(err)) ext.Error.Set(span, true) @@ -1109,7 +1109,7 @@ func (s *OpenTracingLayerChannelStore) GetByName(team_id string, name string, al return result, err } -func (s *OpenTracingLayerChannelStore) GetByNameIncludeDeleted(team_id string, name string, allowFromCache bool) (*model.Channel, error) { +func (s *OpenTracingLayerChannelStore) GetByNameIncludeDeleted(teamID string, name string, allowFromCache bool) (*model.Channel, error) { origCtx := s.Root.Store.Context() span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "ChannelStore.GetByNameIncludeDeleted") s.Root.Store.SetContext(newCtx) @@ -1118,7 +1118,7 @@ func (s *OpenTracingLayerChannelStore) GetByNameIncludeDeleted(team_id string, n }() defer span.Finish() - result, err := s.ChannelStore.GetByNameIncludeDeleted(team_id, name, allowFromCache) + result, err := s.ChannelStore.GetByNameIncludeDeleted(teamID, name, allowFromCache) if err != nil { span.LogFields(spanlog.Error(err)) ext.Error.Set(span, true) @@ -1127,7 +1127,7 @@ func (s *OpenTracingLayerChannelStore) GetByNameIncludeDeleted(team_id string, n return result, err } -func (s *OpenTracingLayerChannelStore) GetByNames(team_id string, names []string, allowFromCache bool) ([]*model.Channel, error) { +func (s *OpenTracingLayerChannelStore) GetByNames(teamID string, names []string, allowFromCache bool) ([]*model.Channel, error) { origCtx := s.Root.Store.Context() span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "ChannelStore.GetByNames") s.Root.Store.SetContext(newCtx) @@ -1136,7 +1136,7 @@ func (s *OpenTracingLayerChannelStore) GetByNames(team_id string, names []string }() defer span.Finish() - result, err := s.ChannelStore.GetByNames(team_id, names, allowFromCache) + result, err := s.ChannelStore.GetByNames(teamID, names, allowFromCache) if err != nil { span.LogFields(spanlog.Error(err)) ext.Error.Set(span, true) @@ -1145,7 +1145,7 @@ func (s *OpenTracingLayerChannelStore) GetByNames(team_id string, names []string return result, err } -func (s *OpenTracingLayerChannelStore) GetByNamesIncludeDeleted(team_id string, names []string, allowFromCache bool) ([]*model.Channel, error) { +func (s *OpenTracingLayerChannelStore) GetByNamesIncludeDeleted(teamID string, names []string, allowFromCache bool) ([]*model.Channel, error) { origCtx := s.Root.Store.Context() span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "ChannelStore.GetByNamesIncludeDeleted") s.Root.Store.SetContext(newCtx) @@ -1154,7 +1154,7 @@ func (s *OpenTracingLayerChannelStore) GetByNamesIncludeDeleted(team_id string, }() defer span.Finish() - result, err := s.ChannelStore.GetByNamesIncludeDeleted(team_id, names, allowFromCache) + result, err := s.ChannelStore.GetByNamesIncludeDeleted(teamID, names, allowFromCache) if err != nil { span.LogFields(spanlog.Error(err)) ext.Error.Set(span, true) @@ -1379,7 +1379,7 @@ func (s *OpenTracingLayerChannelStore) GetChannelsWithUnreadsAndWithMentions(ctx return result, resultVar1, resultVar2, err } -func (s *OpenTracingLayerChannelStore) GetDeleted(team_id string, offset int, limit int, userID string) (model.ChannelList, error) { +func (s *OpenTracingLayerChannelStore) GetDeleted(teamID 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) @@ -1388,7 +1388,7 @@ func (s *OpenTracingLayerChannelStore) GetDeleted(team_id string, offset int, li }() defer span.Finish() - result, err := s.ChannelStore.GetDeleted(team_id, offset, limit, userID) + result, err := s.ChannelStore.GetDeleted(teamID, offset, limit, userID) if err != nil { span.LogFields(spanlog.Error(err)) ext.Error.Set(span, true) @@ -1397,7 +1397,7 @@ func (s *OpenTracingLayerChannelStore) GetDeleted(team_id string, offset int, li return result, err } -func (s *OpenTracingLayerChannelStore) GetDeletedByName(team_id string, name string) (*model.Channel, error) { +func (s *OpenTracingLayerChannelStore) GetDeletedByName(teamID string, name string) (*model.Channel, error) { origCtx := s.Root.Store.Context() span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "ChannelStore.GetDeletedByName") s.Root.Store.SetContext(newCtx) @@ -1406,7 +1406,7 @@ func (s *OpenTracingLayerChannelStore) GetDeletedByName(team_id string, name str }() defer span.Finish() - result, err := s.ChannelStore.GetDeletedByName(team_id, name) + result, err := s.ChannelStore.GetDeletedByName(teamID, name) if err != nil { span.LogFields(spanlog.Error(err)) ext.Error.Set(span, true) @@ -2491,7 +2491,7 @@ func (s *OpenTracingLayerChannelStore) SetDeleteAt(channelID string, deleteAt in return err } -func (s *OpenTracingLayerChannelStore) SetShared(channelId string, shared bool) error { +func (s *OpenTracingLayerChannelStore) SetShared(channelID string, shared bool) error { origCtx := s.Root.Store.Context() span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "ChannelStore.SetShared") s.Root.Store.SetContext(newCtx) @@ -2500,7 +2500,7 @@ func (s *OpenTracingLayerChannelStore) SetShared(channelId string, shared bool) }() defer span.Finish() - err := s.ChannelStore.SetShared(channelId, shared) + err := s.ChannelStore.SetShared(channelID, shared) if err != nil { span.LogFields(spanlog.Error(err)) ext.Error.Set(span, true) @@ -2725,7 +2725,7 @@ func (s *OpenTracingLayerChannelStore) UserBelongsToChannels(userID string, chan return result, err } -func (s *OpenTracingLayerChannelBookmarkStore) Delete(bookmarkId string, deleteFile bool) error { +func (s *OpenTracingLayerChannelBookmarkStore) Delete(bookmarkID string, deleteFile bool) error { origCtx := s.Root.Store.Context() span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "ChannelBookmarkStore.Delete") s.Root.Store.SetContext(newCtx) @@ -2734,7 +2734,7 @@ func (s *OpenTracingLayerChannelBookmarkStore) Delete(bookmarkId string, deleteF }() defer span.Finish() - err := s.ChannelBookmarkStore.Delete(bookmarkId, deleteFile) + err := s.ChannelBookmarkStore.Delete(bookmarkID, deleteFile) if err != nil { span.LogFields(spanlog.Error(err)) ext.Error.Set(span, true) @@ -2743,7 +2743,7 @@ func (s *OpenTracingLayerChannelBookmarkStore) Delete(bookmarkId string, deleteF return err } -func (s *OpenTracingLayerChannelBookmarkStore) ErrorIfBookmarkFileInfoAlreadyAttached(fileId string) error { +func (s *OpenTracingLayerChannelBookmarkStore) ErrorIfBookmarkFileInfoAlreadyAttached(fileID string) error { origCtx := s.Root.Store.Context() span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "ChannelBookmarkStore.ErrorIfBookmarkFileInfoAlreadyAttached") s.Root.Store.SetContext(newCtx) @@ -2752,7 +2752,7 @@ func (s *OpenTracingLayerChannelBookmarkStore) ErrorIfBookmarkFileInfoAlreadyAtt }() defer span.Finish() - err := s.ChannelBookmarkStore.ErrorIfBookmarkFileInfoAlreadyAttached(fileId) + err := s.ChannelBookmarkStore.ErrorIfBookmarkFileInfoAlreadyAttached(fileID) if err != nil { span.LogFields(spanlog.Error(err)) ext.Error.Set(span, true) @@ -2779,7 +2779,7 @@ func (s *OpenTracingLayerChannelBookmarkStore) Get(Id string, includeDeleted boo return result, err } -func (s *OpenTracingLayerChannelBookmarkStore) GetBookmarksForChannelSince(channelId string, since int64) ([]*model.ChannelBookmarkWithFileInfo, error) { +func (s *OpenTracingLayerChannelBookmarkStore) GetBookmarksForChannelSince(channelID string, since int64) ([]*model.ChannelBookmarkWithFileInfo, error) { origCtx := s.Root.Store.Context() span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "ChannelBookmarkStore.GetBookmarksForChannelSince") s.Root.Store.SetContext(newCtx) @@ -2788,7 +2788,7 @@ func (s *OpenTracingLayerChannelBookmarkStore) GetBookmarksForChannelSince(chann }() defer span.Finish() - result, err := s.ChannelBookmarkStore.GetBookmarksForChannelSince(channelId, since) + result, err := s.ChannelBookmarkStore.GetBookmarksForChannelSince(channelID, since) if err != nil { span.LogFields(spanlog.Error(err)) ext.Error.Set(span, true) @@ -2833,7 +2833,7 @@ func (s *OpenTracingLayerChannelBookmarkStore) Update(bookmark *model.ChannelBoo return err } -func (s *OpenTracingLayerChannelBookmarkStore) UpdateSortOrder(bookmarkId string, channelId string, newIndex int64) ([]*model.ChannelBookmarkWithFileInfo, error) { +func (s *OpenTracingLayerChannelBookmarkStore) UpdateSortOrder(bookmarkID string, channelID string, newIndex int64) ([]*model.ChannelBookmarkWithFileInfo, error) { origCtx := s.Root.Store.Context() span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "ChannelBookmarkStore.UpdateSortOrder") s.Root.Store.SetContext(newCtx) @@ -2842,7 +2842,7 @@ func (s *OpenTracingLayerChannelBookmarkStore) UpdateSortOrder(bookmarkId string }() defer span.Finish() - result, err := s.ChannelBookmarkStore.UpdateSortOrder(bookmarkId, channelId, newIndex) + result, err := s.ChannelBookmarkStore.UpdateSortOrder(bookmarkID, channelID, newIndex) if err != nil { span.LogFields(spanlog.Error(err)) ext.Error.Set(span, true) @@ -3440,7 +3440,7 @@ func (s *OpenTracingLayerDesktopTokensStore) Delete(token string) error { return err } -func (s *OpenTracingLayerDesktopTokensStore) DeleteByUserId(userId string) error { +func (s *OpenTracingLayerDesktopTokensStore) DeleteByUserId(userID string) error { origCtx := s.Root.Store.Context() span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "DesktopTokensStore.DeleteByUserId") s.Root.Store.SetContext(newCtx) @@ -3449,7 +3449,7 @@ func (s *OpenTracingLayerDesktopTokensStore) DeleteByUserId(userId string) error }() defer span.Finish() - err := s.DesktopTokensStore.DeleteByUserId(userId) + err := s.DesktopTokensStore.DeleteByUserId(userID) if err != nil { span.LogFields(spanlog.Error(err)) ext.Error.Set(span, true) @@ -3494,7 +3494,7 @@ func (s *OpenTracingLayerDesktopTokensStore) GetUserId(token string, minCreatedA return result, err } -func (s *OpenTracingLayerDesktopTokensStore) Insert(token string, createAt int64, userId string) error { +func (s *OpenTracingLayerDesktopTokensStore) Insert(token string, createAt int64, userID string) error { origCtx := s.Root.Store.Context() span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "DesktopTokensStore.Insert") s.Root.Store.SetContext(newCtx) @@ -3503,7 +3503,7 @@ func (s *OpenTracingLayerDesktopTokensStore) Insert(token string, createAt int64 }() defer span.Finish() - err := s.DesktopTokensStore.Insert(token, createAt, userId) + err := s.DesktopTokensStore.Insert(token, createAt, userID) if err != nil { span.LogFields(spanlog.Error(err)) ext.Error.Set(span, true) @@ -3548,7 +3548,7 @@ func (s *OpenTracingLayerDraftStore) DeleteDraftsAssociatedWithPost(channelID st return err } -func (s *OpenTracingLayerDraftStore) DeleteEmptyDraftsByCreateAtAndUserId(createAt int64, userId string) error { +func (s *OpenTracingLayerDraftStore) DeleteEmptyDraftsByCreateAtAndUserId(createAt int64, userID string) error { origCtx := s.Root.Store.Context() span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "DraftStore.DeleteEmptyDraftsByCreateAtAndUserId") s.Root.Store.SetContext(newCtx) @@ -3557,7 +3557,7 @@ func (s *OpenTracingLayerDraftStore) DeleteEmptyDraftsByCreateAtAndUserId(create }() defer span.Finish() - err := s.DraftStore.DeleteEmptyDraftsByCreateAtAndUserId(createAt, userId) + err := s.DraftStore.DeleteEmptyDraftsByCreateAtAndUserId(createAt, userID) if err != nil { span.LogFields(spanlog.Error(err)) ext.Error.Set(span, true) @@ -3566,7 +3566,7 @@ func (s *OpenTracingLayerDraftStore) DeleteEmptyDraftsByCreateAtAndUserId(create return err } -func (s *OpenTracingLayerDraftStore) DeleteOrphanDraftsByCreateAtAndUserId(createAt int64, userId string) error { +func (s *OpenTracingLayerDraftStore) DeleteOrphanDraftsByCreateAtAndUserId(createAt int64, userID string) error { origCtx := s.Root.Store.Context() span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "DraftStore.DeleteOrphanDraftsByCreateAtAndUserId") s.Root.Store.SetContext(newCtx) @@ -3575,7 +3575,7 @@ func (s *OpenTracingLayerDraftStore) DeleteOrphanDraftsByCreateAtAndUserId(creat }() defer span.Finish() - err := s.DraftStore.DeleteOrphanDraftsByCreateAtAndUserId(createAt, userId) + err := s.DraftStore.DeleteOrphanDraftsByCreateAtAndUserId(createAt, userID) if err != nil { span.LogFields(spanlog.Error(err)) ext.Error.Set(span, true) @@ -3620,7 +3620,7 @@ func (s *OpenTracingLayerDraftStore) GetDraftsForUser(userID string, teamID stri return result, err } -func (s *OpenTracingLayerDraftStore) GetLastCreateAtAndUserIdValuesForEmptyDraftsMigration(createAt int64, userId string) (int64, string, error) { +func (s *OpenTracingLayerDraftStore) GetLastCreateAtAndUserIdValuesForEmptyDraftsMigration(createAt int64, userID string) (int64, string, error) { origCtx := s.Root.Store.Context() span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "DraftStore.GetLastCreateAtAndUserIdValuesForEmptyDraftsMigration") s.Root.Store.SetContext(newCtx) @@ -3629,7 +3629,7 @@ func (s *OpenTracingLayerDraftStore) GetLastCreateAtAndUserIdValuesForEmptyDraft }() defer span.Finish() - result, resultVar1, err := s.DraftStore.GetLastCreateAtAndUserIdValuesForEmptyDraftsMigration(createAt, userId) + result, resultVar1, err := s.DraftStore.GetLastCreateAtAndUserIdValuesForEmptyDraftsMigration(createAt, userID) if err != nil { span.LogFields(spanlog.Error(err)) ext.Error.Set(span, true) @@ -5590,7 +5590,7 @@ func (s *OpenTracingLayerNotifyAdminStore) Get(trial bool) ([]*model.NotifyAdmin return result, err } -func (s *OpenTracingLayerNotifyAdminStore) GetDataByUserIdAndFeature(userId string, feature model.MattermostFeature) ([]*model.NotifyAdminData, error) { +func (s *OpenTracingLayerNotifyAdminStore) GetDataByUserIdAndFeature(userID string, feature model.MattermostFeature) ([]*model.NotifyAdminData, error) { origCtx := s.Root.Store.Context() span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "NotifyAdminStore.GetDataByUserIdAndFeature") s.Root.Store.SetContext(newCtx) @@ -5599,7 +5599,7 @@ func (s *OpenTracingLayerNotifyAdminStore) GetDataByUserIdAndFeature(userId stri }() defer span.Finish() - result, err := s.NotifyAdminStore.GetDataByUserIdAndFeature(userId, feature) + result, err := s.NotifyAdminStore.GetDataByUserIdAndFeature(userID, feature) if err != nil { span.LogFields(spanlog.Error(err)) ext.Error.Set(span, true) @@ -5626,7 +5626,7 @@ func (s *OpenTracingLayerNotifyAdminStore) Save(data *model.NotifyAdminData) (*m return result, err } -func (s *OpenTracingLayerNotifyAdminStore) Update(userId string, requiredPlan string, requiredFeature model.MattermostFeature, now int64) error { +func (s *OpenTracingLayerNotifyAdminStore) Update(userID string, requiredPlan string, requiredFeature model.MattermostFeature, now int64) error { origCtx := s.Root.Store.Context() span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "NotifyAdminStore.Update") s.Root.Store.SetContext(newCtx) @@ -5635,7 +5635,7 @@ func (s *OpenTracingLayerNotifyAdminStore) Update(userId string, requiredPlan st }() defer span.Finish() - err := s.NotifyAdminStore.Update(userId, requiredPlan, requiredFeature, now) + err := s.NotifyAdminStore.Update(userID, requiredPlan, requiredFeature, now) if err != nil { span.LogFields(spanlog.Error(err)) ext.Error.Set(span, true) @@ -5698,7 +5698,7 @@ func (s *OpenTracingLayerOAuthStore) GetAccessDataByRefreshToken(token string) ( return result, err } -func (s *OpenTracingLayerOAuthStore) GetAccessDataByUserForApp(userID string, clientId string) ([]*model.AccessData, error) { +func (s *OpenTracingLayerOAuthStore) GetAccessDataByUserForApp(userID string, clientID string) ([]*model.AccessData, error) { origCtx := s.Root.Store.Context() span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "OAuthStore.GetAccessDataByUserForApp") s.Root.Store.SetContext(newCtx) @@ -5707,7 +5707,7 @@ func (s *OpenTracingLayerOAuthStore) GetAccessDataByUserForApp(userID string, cl }() defer span.Finish() - result, err := s.OAuthStore.GetAccessDataByUserForApp(userID, clientId) + result, err := s.OAuthStore.GetAccessDataByUserForApp(userID, clientID) if err != nil { span.LogFields(spanlog.Error(err)) ext.Error.Set(span, true) @@ -5806,7 +5806,7 @@ func (s *OpenTracingLayerOAuthStore) GetAuthorizedApps(userID string, offset int return result, err } -func (s *OpenTracingLayerOAuthStore) GetPreviousAccessData(userID string, clientId string) (*model.AccessData, error) { +func (s *OpenTracingLayerOAuthStore) GetPreviousAccessData(userID string, clientID string) (*model.AccessData, error) { origCtx := s.Root.Store.Context() span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "OAuthStore.GetPreviousAccessData") s.Root.Store.SetContext(newCtx) @@ -5815,7 +5815,7 @@ func (s *OpenTracingLayerOAuthStore) GetPreviousAccessData(userID string, client }() defer span.Finish() - result, err := s.OAuthStore.GetPreviousAccessData(userID, clientId) + result, err := s.OAuthStore.GetPreviousAccessData(userID, clientID) if err != nil { span.LogFields(spanlog.Error(err)) ext.Error.Set(span, true) @@ -5896,7 +5896,7 @@ func (s *OpenTracingLayerOAuthStore) RemoveAuthData(code string) error { return err } -func (s *OpenTracingLayerOAuthStore) RemoveAuthDataByClientId(clientId string, userId string) error { +func (s *OpenTracingLayerOAuthStore) RemoveAuthDataByClientId(clientID string, userID string) error { origCtx := s.Root.Store.Context() span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "OAuthStore.RemoveAuthDataByClientId") s.Root.Store.SetContext(newCtx) @@ -5905,7 +5905,7 @@ func (s *OpenTracingLayerOAuthStore) RemoveAuthDataByClientId(clientId string, u }() defer span.Finish() - err := s.OAuthStore.RemoveAuthDataByClientId(clientId, userId) + err := s.OAuthStore.RemoveAuthDataByClientId(clientID, userID) if err != nil { span.LogFields(spanlog.Error(err)) ext.Error.Set(span, true) @@ -5914,7 +5914,7 @@ func (s *OpenTracingLayerOAuthStore) RemoveAuthDataByClientId(clientId string, u return err } -func (s *OpenTracingLayerOAuthStore) RemoveAuthDataByUserId(userId string) error { +func (s *OpenTracingLayerOAuthStore) RemoveAuthDataByUserId(userID string) error { origCtx := s.Root.Store.Context() span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "OAuthStore.RemoveAuthDataByUserId") s.Root.Store.SetContext(newCtx) @@ -5923,7 +5923,7 @@ func (s *OpenTracingLayerOAuthStore) RemoveAuthDataByUserId(userId string) error }() defer span.Finish() - err := s.OAuthStore.RemoveAuthDataByUserId(userId) + err := s.OAuthStore.RemoveAuthDataByUserId(userID) if err != nil { span.LogFields(spanlog.Error(err)) ext.Error.Set(span, true) @@ -6395,7 +6395,7 @@ func (s *OpenTracingLayerPostStore) GetDirectPostParentsForExportAfter(limit int return result, err } -func (s *OpenTracingLayerPostStore) GetEditHistoryForPost(postId string) ([]*model.Post, error) { +func (s *OpenTracingLayerPostStore) GetEditHistoryForPost(postID string) ([]*model.Post, error) { origCtx := s.Root.Store.Context() span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "PostStore.GetEditHistoryForPost") s.Root.Store.SetContext(newCtx) @@ -6404,7 +6404,7 @@ func (s *OpenTracingLayerPostStore) GetEditHistoryForPost(postId string) ([]*mod }() defer span.Finish() - result, err := s.PostStore.GetEditHistoryForPost(postId) + result, err := s.PostStore.GetEditHistoryForPost(postID) if err != nil { span.LogFields(spanlog.Error(err)) ext.Error.Set(span, true) @@ -6861,7 +6861,7 @@ func (s *OpenTracingLayerPostStore) GetSingle(rctx request.CTX, id string, inclD return result, err } -func (s *OpenTracingLayerPostStore) HasAutoResponsePostByUserSince(options model.GetPostsSinceOptions, userId string) (bool, error) { +func (s *OpenTracingLayerPostStore) HasAutoResponsePostByUserSince(options model.GetPostsSinceOptions, userID string) (bool, error) { origCtx := s.Root.Store.Context() span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "PostStore.HasAutoResponsePostByUserSince") s.Root.Store.SetContext(newCtx) @@ -6870,7 +6870,7 @@ func (s *OpenTracingLayerPostStore) HasAutoResponsePostByUserSince(options model }() defer span.Finish() - result, err := s.PostStore.HasAutoResponsePostByUserSince(options, userId) + result, err := s.PostStore.HasAutoResponsePostByUserSince(options, userID) if err != nil { span.LogFields(spanlog.Error(err)) ext.Error.Set(span, true) @@ -7342,7 +7342,7 @@ func (s *OpenTracingLayerPostPersistentNotificationStore) UpdateLastActivity(pos return err } -func (s *OpenTracingLayerPostPriorityStore) GetForPost(postId string) (*model.PostPriority, error) { +func (s *OpenTracingLayerPostPriorityStore) GetForPost(postID string) (*model.PostPriority, error) { origCtx := s.Root.Store.Context() span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "PostPriorityStore.GetForPost") s.Root.Store.SetContext(newCtx) @@ -7351,7 +7351,7 @@ func (s *OpenTracingLayerPostPriorityStore) GetForPost(postId string) (*model.Po }() defer span.Finish() - result, err := s.PostPriorityStore.GetForPost(postId) + result, err := s.PostPriorityStore.GetForPost(postID) if err != nil { span.LogFields(spanlog.Error(err)) ext.Error.Set(span, true) @@ -7738,7 +7738,7 @@ func (s *OpenTracingLayerReactionStore) DeleteOrphanedRowsByIds(r *model.Retenti return result, err } -func (s *OpenTracingLayerReactionStore) ExistsOnPost(postId string, emojiName string) (bool, error) { +func (s *OpenTracingLayerReactionStore) ExistsOnPost(postID string, emojiName string) (bool, error) { origCtx := s.Root.Store.Context() span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "ReactionStore.ExistsOnPost") s.Root.Store.SetContext(newCtx) @@ -7747,7 +7747,7 @@ func (s *OpenTracingLayerReactionStore) ExistsOnPost(postId string, emojiName st }() defer span.Finish() - result, err := s.ReactionStore.ExistsOnPost(postId, emojiName) + result, err := s.ReactionStore.ExistsOnPost(postID, emojiName) if err != nil { span.LogFields(spanlog.Error(err)) ext.Error.Set(span, true) @@ -7774,7 +7774,7 @@ func (s *OpenTracingLayerReactionStore) GetForPost(postID string, allowFromCache return result, err } -func (s *OpenTracingLayerReactionStore) GetForPostSince(postId string, since int64, excludeRemoteId string, inclDeleted bool) ([]*model.Reaction, error) { +func (s *OpenTracingLayerReactionStore) GetForPostSince(postID string, since int64, excludeRemoteID string, inclDeleted bool) ([]*model.Reaction, error) { origCtx := s.Root.Store.Context() span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "ReactionStore.GetForPostSince") s.Root.Store.SetContext(newCtx) @@ -7783,7 +7783,7 @@ func (s *OpenTracingLayerReactionStore) GetForPostSince(postId string, since int }() defer span.Finish() - result, err := s.ReactionStore.GetForPostSince(postId, since, excludeRemoteId, inclDeleted) + result, err := s.ReactionStore.GetForPostSince(postID, since, excludeRemoteID, inclDeleted) if err != nil { span.LogFields(spanlog.Error(err)) ext.Error.Set(span, true) @@ -7810,7 +7810,7 @@ func (s *OpenTracingLayerReactionStore) GetSingle(userID string, postID string, return result, err } -func (s *OpenTracingLayerReactionStore) GetUniqueCountForPost(postId string) (int, error) { +func (s *OpenTracingLayerReactionStore) GetUniqueCountForPost(postID string) (int, error) { origCtx := s.Root.Store.Context() span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "ReactionStore.GetUniqueCountForPost") s.Root.Store.SetContext(newCtx) @@ -7819,7 +7819,7 @@ func (s *OpenTracingLayerReactionStore) GetUniqueCountForPost(postId string) (in }() defer span.Finish() - result, err := s.ReactionStore.GetUniqueCountForPost(postId) + result, err := s.ReactionStore.GetUniqueCountForPost(postID) if err != nil { span.LogFields(spanlog.Error(err)) ext.Error.Set(span, true) @@ -7882,7 +7882,7 @@ func (s *OpenTracingLayerReactionStore) Save(reaction *model.Reaction) (*model.R return result, err } -func (s *OpenTracingLayerRemoteClusterStore) Delete(remoteClusterId string) (bool, error) { +func (s *OpenTracingLayerRemoteClusterStore) Delete(remoteClusterID string) (bool, error) { origCtx := s.Root.Store.Context() span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "RemoteClusterStore.Delete") s.Root.Store.SetContext(newCtx) @@ -7891,7 +7891,7 @@ func (s *OpenTracingLayerRemoteClusterStore) Delete(remoteClusterId string) (boo }() defer span.Finish() - result, err := s.RemoteClusterStore.Delete(remoteClusterId) + result, err := s.RemoteClusterStore.Delete(remoteClusterID) if err != nil { span.LogFields(spanlog.Error(err)) ext.Error.Set(span, true) @@ -7900,7 +7900,7 @@ func (s *OpenTracingLayerRemoteClusterStore) Delete(remoteClusterId string) (boo return result, err } -func (s *OpenTracingLayerRemoteClusterStore) Get(remoteClusterId string, includeDeleted bool) (*model.RemoteCluster, error) { +func (s *OpenTracingLayerRemoteClusterStore) Get(remoteClusterID string, includeDeleted bool) (*model.RemoteCluster, error) { origCtx := s.Root.Store.Context() span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "RemoteClusterStore.Get") s.Root.Store.SetContext(newCtx) @@ -7909,7 +7909,7 @@ func (s *OpenTracingLayerRemoteClusterStore) Get(remoteClusterId string, include }() defer span.Finish() - result, err := s.RemoteClusterStore.Get(remoteClusterId, includeDeleted) + result, err := s.RemoteClusterStore.Get(remoteClusterID, includeDeleted) if err != nil { span.LogFields(spanlog.Error(err)) ext.Error.Set(span, true) @@ -7972,7 +7972,7 @@ func (s *OpenTracingLayerRemoteClusterStore) Save(rc *model.RemoteCluster) (*mod return result, err } -func (s *OpenTracingLayerRemoteClusterStore) SetLastPingAt(remoteClusterId string) error { +func (s *OpenTracingLayerRemoteClusterStore) SetLastPingAt(remoteClusterID string) error { origCtx := s.Root.Store.Context() span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "RemoteClusterStore.SetLastPingAt") s.Root.Store.SetContext(newCtx) @@ -7981,7 +7981,7 @@ func (s *OpenTracingLayerRemoteClusterStore) SetLastPingAt(remoteClusterId strin }() defer span.Finish() - err := s.RemoteClusterStore.SetLastPingAt(remoteClusterId) + err := s.RemoteClusterStore.SetLastPingAt(remoteClusterID) if err != nil { span.LogFields(spanlog.Error(err)) ext.Error.Set(span, true) @@ -8008,7 +8008,7 @@ func (s *OpenTracingLayerRemoteClusterStore) Update(rc *model.RemoteCluster) (*m return result, err } -func (s *OpenTracingLayerRemoteClusterStore) UpdateTopics(remoteClusterId string, topics string) (*model.RemoteCluster, error) { +func (s *OpenTracingLayerRemoteClusterStore) UpdateTopics(remoteClusterID string, topics string) (*model.RemoteCluster, error) { origCtx := s.Root.Store.Context() span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "RemoteClusterStore.UpdateTopics") s.Root.Store.SetContext(newCtx) @@ -8017,7 +8017,7 @@ func (s *OpenTracingLayerRemoteClusterStore) UpdateTopics(remoteClusterId string }() defer span.Finish() - result, err := s.RemoteClusterStore.UpdateTopics(remoteClusterId, topics) + result, err := s.RemoteClusterStore.UpdateTopics(remoteClusterID, topics) if err != nil { span.LogFields(spanlog.Error(err)) ext.Error.Set(span, true) @@ -8026,7 +8026,7 @@ func (s *OpenTracingLayerRemoteClusterStore) UpdateTopics(remoteClusterId string return result, err } -func (s *OpenTracingLayerRetentionPolicyStore) AddChannels(policyId string, channelIds []string) error { +func (s *OpenTracingLayerRetentionPolicyStore) AddChannels(policyID string, channelIds []string) error { origCtx := s.Root.Store.Context() span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "RetentionPolicyStore.AddChannels") s.Root.Store.SetContext(newCtx) @@ -8035,7 +8035,7 @@ func (s *OpenTracingLayerRetentionPolicyStore) AddChannels(policyId string, chan }() defer span.Finish() - err := s.RetentionPolicyStore.AddChannels(policyId, channelIds) + err := s.RetentionPolicyStore.AddChannels(policyID, channelIds) if err != nil { span.LogFields(spanlog.Error(err)) ext.Error.Set(span, true) @@ -8044,7 +8044,7 @@ func (s *OpenTracingLayerRetentionPolicyStore) AddChannels(policyId string, chan return err } -func (s *OpenTracingLayerRetentionPolicyStore) AddTeams(policyId string, teamIds []string) error { +func (s *OpenTracingLayerRetentionPolicyStore) AddTeams(policyID string, teamIds []string) error { origCtx := s.Root.Store.Context() span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "RetentionPolicyStore.AddTeams") s.Root.Store.SetContext(newCtx) @@ -8053,7 +8053,7 @@ func (s *OpenTracingLayerRetentionPolicyStore) AddTeams(policyId string, teamIds }() defer span.Finish() - err := s.RetentionPolicyStore.AddTeams(policyId, teamIds) + err := s.RetentionPolicyStore.AddTeams(policyID, teamIds) if err != nil { span.LogFields(spanlog.Error(err)) ext.Error.Set(span, true) @@ -8170,7 +8170,7 @@ func (s *OpenTracingLayerRetentionPolicyStore) GetChannelPoliciesForUser(userID return result, err } -func (s *OpenTracingLayerRetentionPolicyStore) GetChannels(policyId string, offset int, limit int) (model.ChannelListWithTeamData, error) { +func (s *OpenTracingLayerRetentionPolicyStore) GetChannels(policyID string, offset int, limit int) (model.ChannelListWithTeamData, error) { origCtx := s.Root.Store.Context() span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "RetentionPolicyStore.GetChannels") s.Root.Store.SetContext(newCtx) @@ -8179,7 +8179,7 @@ func (s *OpenTracingLayerRetentionPolicyStore) GetChannels(policyId string, offs }() defer span.Finish() - result, err := s.RetentionPolicyStore.GetChannels(policyId, offset, limit) + result, err := s.RetentionPolicyStore.GetChannels(policyID, offset, limit) if err != nil { span.LogFields(spanlog.Error(err)) ext.Error.Set(span, true) @@ -8188,7 +8188,7 @@ func (s *OpenTracingLayerRetentionPolicyStore) GetChannels(policyId string, offs return result, err } -func (s *OpenTracingLayerRetentionPolicyStore) GetChannelsCount(policyId string) (int64, error) { +func (s *OpenTracingLayerRetentionPolicyStore) GetChannelsCount(policyID string) (int64, error) { origCtx := s.Root.Store.Context() span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "RetentionPolicyStore.GetChannelsCount") s.Root.Store.SetContext(newCtx) @@ -8197,7 +8197,7 @@ func (s *OpenTracingLayerRetentionPolicyStore) GetChannelsCount(policyId string) }() defer span.Finish() - result, err := s.RetentionPolicyStore.GetChannelsCount(policyId) + result, err := s.RetentionPolicyStore.GetChannelsCount(policyID) if err != nil { span.LogFields(spanlog.Error(err)) ext.Error.Set(span, true) @@ -8278,7 +8278,7 @@ func (s *OpenTracingLayerRetentionPolicyStore) GetTeamPoliciesForUser(userID str return result, err } -func (s *OpenTracingLayerRetentionPolicyStore) GetTeams(policyId string, offset int, limit int) ([]*model.Team, error) { +func (s *OpenTracingLayerRetentionPolicyStore) GetTeams(policyID string, offset int, limit int) ([]*model.Team, error) { origCtx := s.Root.Store.Context() span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "RetentionPolicyStore.GetTeams") s.Root.Store.SetContext(newCtx) @@ -8287,7 +8287,7 @@ func (s *OpenTracingLayerRetentionPolicyStore) GetTeams(policyId string, offset }() defer span.Finish() - result, err := s.RetentionPolicyStore.GetTeams(policyId, offset, limit) + result, err := s.RetentionPolicyStore.GetTeams(policyID, offset, limit) if err != nil { span.LogFields(spanlog.Error(err)) ext.Error.Set(span, true) @@ -8296,7 +8296,7 @@ func (s *OpenTracingLayerRetentionPolicyStore) GetTeams(policyId string, offset return result, err } -func (s *OpenTracingLayerRetentionPolicyStore) GetTeamsCount(policyId string) (int64, error) { +func (s *OpenTracingLayerRetentionPolicyStore) GetTeamsCount(policyID string) (int64, error) { origCtx := s.Root.Store.Context() span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "RetentionPolicyStore.GetTeamsCount") s.Root.Store.SetContext(newCtx) @@ -8305,7 +8305,7 @@ func (s *OpenTracingLayerRetentionPolicyStore) GetTeamsCount(policyId string) (i }() defer span.Finish() - result, err := s.RetentionPolicyStore.GetTeamsCount(policyId) + result, err := s.RetentionPolicyStore.GetTeamsCount(policyID) if err != nil { span.LogFields(spanlog.Error(err)) ext.Error.Set(span, true) @@ -8332,7 +8332,7 @@ func (s *OpenTracingLayerRetentionPolicyStore) Patch(patch *model.RetentionPolic return result, err } -func (s *OpenTracingLayerRetentionPolicyStore) RemoveChannels(policyId string, channelIds []string) error { +func (s *OpenTracingLayerRetentionPolicyStore) RemoveChannels(policyID string, channelIds []string) error { origCtx := s.Root.Store.Context() span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "RetentionPolicyStore.RemoveChannels") s.Root.Store.SetContext(newCtx) @@ -8341,7 +8341,7 @@ func (s *OpenTracingLayerRetentionPolicyStore) RemoveChannels(policyId string, c }() defer span.Finish() - err := s.RetentionPolicyStore.RemoveChannels(policyId, channelIds) + err := s.RetentionPolicyStore.RemoveChannels(policyID, channelIds) if err != nil { span.LogFields(spanlog.Error(err)) ext.Error.Set(span, true) @@ -8350,7 +8350,7 @@ func (s *OpenTracingLayerRetentionPolicyStore) RemoveChannels(policyId string, c return err } -func (s *OpenTracingLayerRetentionPolicyStore) RemoveTeams(policyId string, teamIds []string) error { +func (s *OpenTracingLayerRetentionPolicyStore) RemoveTeams(policyID string, teamIds []string) error { origCtx := s.Root.Store.Context() span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "RetentionPolicyStore.RemoveTeams") s.Root.Store.SetContext(newCtx) @@ -8359,7 +8359,7 @@ func (s *OpenTracingLayerRetentionPolicyStore) RemoveTeams(policyId string, team }() defer span.Finish() - err := s.RetentionPolicyStore.RemoveTeams(policyId, teamIds) + err := s.RetentionPolicyStore.RemoveTeams(policyID, teamIds) if err != nil { span.LogFields(spanlog.Error(err)) ext.Error.Set(span, true) @@ -9034,7 +9034,7 @@ func (s *OpenTracingLayerSessionStore) UpdateRoles(userID string, roles string) return result, err } -func (s *OpenTracingLayerSharedChannelStore) Delete(channelId string) (bool, error) { +func (s *OpenTracingLayerSharedChannelStore) Delete(channelID string) (bool, error) { origCtx := s.Root.Store.Context() span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "SharedChannelStore.Delete") s.Root.Store.SetContext(newCtx) @@ -9043,7 +9043,7 @@ func (s *OpenTracingLayerSharedChannelStore) Delete(channelId string) (bool, err }() defer span.Finish() - result, err := s.SharedChannelStore.Delete(channelId) + result, err := s.SharedChannelStore.Delete(channelID) if err != nil { span.LogFields(spanlog.Error(err)) ext.Error.Set(span, true) @@ -9052,7 +9052,7 @@ func (s *OpenTracingLayerSharedChannelStore) Delete(channelId string) (bool, err return result, err } -func (s *OpenTracingLayerSharedChannelStore) DeleteRemote(remoteId string) (bool, error) { +func (s *OpenTracingLayerSharedChannelStore) DeleteRemote(remoteID string) (bool, error) { origCtx := s.Root.Store.Context() span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "SharedChannelStore.DeleteRemote") s.Root.Store.SetContext(newCtx) @@ -9061,7 +9061,7 @@ func (s *OpenTracingLayerSharedChannelStore) DeleteRemote(remoteId string) (bool }() defer span.Finish() - result, err := s.SharedChannelStore.DeleteRemote(remoteId) + result, err := s.SharedChannelStore.DeleteRemote(remoteID) if err != nil { span.LogFields(spanlog.Error(err)) ext.Error.Set(span, true) @@ -9070,7 +9070,7 @@ func (s *OpenTracingLayerSharedChannelStore) DeleteRemote(remoteId string) (bool return result, err } -func (s *OpenTracingLayerSharedChannelStore) Get(channelId string) (*model.SharedChannel, error) { +func (s *OpenTracingLayerSharedChannelStore) Get(channelID string) (*model.SharedChannel, error) { origCtx := s.Root.Store.Context() span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "SharedChannelStore.Get") s.Root.Store.SetContext(newCtx) @@ -9079,7 +9079,7 @@ func (s *OpenTracingLayerSharedChannelStore) Get(channelId string) (*model.Share }() defer span.Finish() - result, err := s.SharedChannelStore.Get(channelId) + result, err := s.SharedChannelStore.Get(channelID) if err != nil { span.LogFields(spanlog.Error(err)) ext.Error.Set(span, true) @@ -9124,7 +9124,7 @@ func (s *OpenTracingLayerSharedChannelStore) GetAllCount(opts model.SharedChanne return result, err } -func (s *OpenTracingLayerSharedChannelStore) GetAttachment(fileId string, remoteId string) (*model.SharedChannelAttachment, error) { +func (s *OpenTracingLayerSharedChannelStore) GetAttachment(fileID string, remoteID string) (*model.SharedChannelAttachment, error) { origCtx := s.Root.Store.Context() span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "SharedChannelStore.GetAttachment") s.Root.Store.SetContext(newCtx) @@ -9133,7 +9133,7 @@ func (s *OpenTracingLayerSharedChannelStore) GetAttachment(fileId string, remote }() defer span.Finish() - result, err := s.SharedChannelStore.GetAttachment(fileId, remoteId) + result, err := s.SharedChannelStore.GetAttachment(fileID, remoteID) if err != nil { span.LogFields(spanlog.Error(err)) ext.Error.Set(span, true) @@ -9160,7 +9160,7 @@ func (s *OpenTracingLayerSharedChannelStore) GetRemote(id string) (*model.Shared return result, err } -func (s *OpenTracingLayerSharedChannelStore) GetRemoteByIds(channelId string, remoteId string) (*model.SharedChannelRemote, error) { +func (s *OpenTracingLayerSharedChannelStore) GetRemoteByIds(channelID string, remoteID string) (*model.SharedChannelRemote, error) { origCtx := s.Root.Store.Context() span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "SharedChannelStore.GetRemoteByIds") s.Root.Store.SetContext(newCtx) @@ -9169,7 +9169,7 @@ func (s *OpenTracingLayerSharedChannelStore) GetRemoteByIds(channelId string, re }() defer span.Finish() - result, err := s.SharedChannelStore.GetRemoteByIds(channelId, remoteId) + result, err := s.SharedChannelStore.GetRemoteByIds(channelID, remoteID) if err != nil { span.LogFields(spanlog.Error(err)) ext.Error.Set(span, true) @@ -9178,7 +9178,7 @@ func (s *OpenTracingLayerSharedChannelStore) GetRemoteByIds(channelId string, re return result, err } -func (s *OpenTracingLayerSharedChannelStore) GetRemoteForUser(remoteId string, userId string) (*model.RemoteCluster, error) { +func (s *OpenTracingLayerSharedChannelStore) GetRemoteForUser(remoteID string, userID string) (*model.RemoteCluster, error) { origCtx := s.Root.Store.Context() span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "SharedChannelStore.GetRemoteForUser") s.Root.Store.SetContext(newCtx) @@ -9187,7 +9187,7 @@ func (s *OpenTracingLayerSharedChannelStore) GetRemoteForUser(remoteId string, u }() defer span.Finish() - result, err := s.SharedChannelStore.GetRemoteForUser(remoteId, userId) + result, err := s.SharedChannelStore.GetRemoteForUser(remoteID, userID) if err != nil { span.LogFields(spanlog.Error(err)) ext.Error.Set(span, true) @@ -9214,7 +9214,7 @@ func (s *OpenTracingLayerSharedChannelStore) GetRemotes(offset int, limit int, o return result, err } -func (s *OpenTracingLayerSharedChannelStore) GetRemotesStatus(channelId string) ([]*model.SharedChannelRemoteStatus, error) { +func (s *OpenTracingLayerSharedChannelStore) GetRemotesStatus(channelID string) ([]*model.SharedChannelRemoteStatus, error) { origCtx := s.Root.Store.Context() span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "SharedChannelStore.GetRemotesStatus") s.Root.Store.SetContext(newCtx) @@ -9223,7 +9223,7 @@ func (s *OpenTracingLayerSharedChannelStore) GetRemotesStatus(channelId string) }() defer span.Finish() - result, err := s.SharedChannelStore.GetRemotesStatus(channelId) + result, err := s.SharedChannelStore.GetRemotesStatus(channelID) if err != nil { span.LogFields(spanlog.Error(err)) ext.Error.Set(span, true) @@ -9304,7 +9304,7 @@ func (s *OpenTracingLayerSharedChannelStore) HasChannel(channelID string) (bool, return result, err } -func (s *OpenTracingLayerSharedChannelStore) HasRemote(channelID string, remoteId string) (bool, error) { +func (s *OpenTracingLayerSharedChannelStore) HasRemote(channelID string, remoteID string) (bool, error) { origCtx := s.Root.Store.Context() span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "SharedChannelStore.HasRemote") s.Root.Store.SetContext(newCtx) @@ -9313,7 +9313,7 @@ func (s *OpenTracingLayerSharedChannelStore) HasRemote(channelID string, remoteI }() defer span.Finish() - result, err := s.SharedChannelStore.HasRemote(channelID, remoteId) + result, err := s.SharedChannelStore.HasRemote(channelID, remoteID) if err != nil { span.LogFields(spanlog.Error(err)) ext.Error.Set(span, true) @@ -10734,7 +10734,7 @@ func (s *OpenTracingLayerTermsOfServiceStore) Save(termsOfService *model.TermsOf return result, err } -func (s *OpenTracingLayerThreadStore) DeleteMembershipForUser(userId string, postID string) error { +func (s *OpenTracingLayerThreadStore) DeleteMembershipForUser(userID string, postID string) error { origCtx := s.Root.Store.Context() span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "ThreadStore.DeleteMembershipForUser") s.Root.Store.SetContext(newCtx) @@ -10743,7 +10743,7 @@ func (s *OpenTracingLayerThreadStore) DeleteMembershipForUser(userId string, pos }() defer span.Finish() - err := s.ThreadStore.DeleteMembershipForUser(userId, postID) + err := s.ThreadStore.DeleteMembershipForUser(userID, postID) if err != nil { span.LogFields(spanlog.Error(err)) ext.Error.Set(span, true) @@ -10806,7 +10806,7 @@ func (s *OpenTracingLayerThreadStore) Get(id string) (*model.Thread, error) { return result, err } -func (s *OpenTracingLayerThreadStore) GetMembershipForUser(userId string, postID string) (*model.ThreadMembership, error) { +func (s *OpenTracingLayerThreadStore) GetMembershipForUser(userID string, postID string) (*model.ThreadMembership, error) { origCtx := s.Root.Store.Context() span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "ThreadStore.GetMembershipForUser") s.Root.Store.SetContext(newCtx) @@ -10815,7 +10815,7 @@ func (s *OpenTracingLayerThreadStore) GetMembershipForUser(userId string, postID }() defer span.Finish() - result, err := s.ThreadStore.GetMembershipForUser(userId, postID) + result, err := s.ThreadStore.GetMembershipForUser(userID, postID) if err != nil { span.LogFields(spanlog.Error(err)) ext.Error.Set(span, true) @@ -10824,7 +10824,7 @@ func (s *OpenTracingLayerThreadStore) GetMembershipForUser(userId string, postID return result, err } -func (s *OpenTracingLayerThreadStore) GetMembershipsForUser(userId string, teamID string) ([]*model.ThreadMembership, error) { +func (s *OpenTracingLayerThreadStore) GetMembershipsForUser(userID string, teamID string) ([]*model.ThreadMembership, error) { origCtx := s.Root.Store.Context() span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "ThreadStore.GetMembershipsForUser") s.Root.Store.SetContext(newCtx) @@ -10833,7 +10833,7 @@ func (s *OpenTracingLayerThreadStore) GetMembershipsForUser(userId string, teamI }() defer span.Finish() - result, err := s.ThreadStore.GetMembershipsForUser(userId, teamID) + result, err := s.ThreadStore.GetMembershipsForUser(userID, teamID) if err != nil { span.LogFields(spanlog.Error(err)) ext.Error.Set(span, true) @@ -10932,7 +10932,7 @@ func (s *OpenTracingLayerThreadStore) GetThreadUnreadReplyCount(threadMembership return result, err } -func (s *OpenTracingLayerThreadStore) GetThreadsForUser(userId string, teamID string, opts model.GetUserThreadsOpts) ([]*model.ThreadResponse, error) { +func (s *OpenTracingLayerThreadStore) GetThreadsForUser(userID string, teamID string, opts model.GetUserThreadsOpts) ([]*model.ThreadResponse, error) { origCtx := s.Root.Store.Context() span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "ThreadStore.GetThreadsForUser") s.Root.Store.SetContext(newCtx) @@ -10941,7 +10941,7 @@ func (s *OpenTracingLayerThreadStore) GetThreadsForUser(userId string, teamID st }() defer span.Finish() - result, err := s.ThreadStore.GetThreadsForUser(userId, teamID, opts) + result, err := s.ThreadStore.GetThreadsForUser(userID, teamID, opts) if err != nil { span.LogFields(spanlog.Error(err)) ext.Error.Set(span, true) @@ -10950,7 +10950,7 @@ func (s *OpenTracingLayerThreadStore) GetThreadsForUser(userId string, teamID st return result, err } -func (s *OpenTracingLayerThreadStore) GetTotalThreads(userId string, teamID string, opts model.GetUserThreadsOpts) (int64, error) { +func (s *OpenTracingLayerThreadStore) GetTotalThreads(userID string, teamID string, opts model.GetUserThreadsOpts) (int64, error) { origCtx := s.Root.Store.Context() span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "ThreadStore.GetTotalThreads") s.Root.Store.SetContext(newCtx) @@ -10959,7 +10959,7 @@ func (s *OpenTracingLayerThreadStore) GetTotalThreads(userId string, teamID stri }() defer span.Finish() - result, err := s.ThreadStore.GetTotalThreads(userId, teamID, opts) + result, err := s.ThreadStore.GetTotalThreads(userID, teamID, opts) if err != nil { span.LogFields(spanlog.Error(err)) ext.Error.Set(span, true) @@ -10968,7 +10968,7 @@ func (s *OpenTracingLayerThreadStore) GetTotalThreads(userId string, teamID stri return result, err } -func (s *OpenTracingLayerThreadStore) GetTotalUnreadMentions(userId string, teamID string, opts model.GetUserThreadsOpts) (int64, error) { +func (s *OpenTracingLayerThreadStore) GetTotalUnreadMentions(userID string, teamID string, opts model.GetUserThreadsOpts) (int64, error) { origCtx := s.Root.Store.Context() span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "ThreadStore.GetTotalUnreadMentions") s.Root.Store.SetContext(newCtx) @@ -10977,7 +10977,7 @@ func (s *OpenTracingLayerThreadStore) GetTotalUnreadMentions(userId string, team }() defer span.Finish() - result, err := s.ThreadStore.GetTotalUnreadMentions(userId, teamID, opts) + result, err := s.ThreadStore.GetTotalUnreadMentions(userID, teamID, opts) if err != nil { span.LogFields(spanlog.Error(err)) ext.Error.Set(span, true) @@ -10986,7 +10986,7 @@ func (s *OpenTracingLayerThreadStore) GetTotalUnreadMentions(userId string, team return result, err } -func (s *OpenTracingLayerThreadStore) GetTotalUnreadThreads(userId string, teamID string, opts model.GetUserThreadsOpts) (int64, error) { +func (s *OpenTracingLayerThreadStore) GetTotalUnreadThreads(userID string, teamID string, opts model.GetUserThreadsOpts) (int64, error) { origCtx := s.Root.Store.Context() span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "ThreadStore.GetTotalUnreadThreads") s.Root.Store.SetContext(newCtx) @@ -10995,7 +10995,7 @@ func (s *OpenTracingLayerThreadStore) GetTotalUnreadThreads(userId string, teamI }() defer span.Finish() - result, err := s.ThreadStore.GetTotalUnreadThreads(userId, teamID, opts) + result, err := s.ThreadStore.GetTotalUnreadThreads(userID, teamID, opts) if err != nil { span.LogFields(spanlog.Error(err)) ext.Error.Set(span, true) @@ -11004,7 +11004,7 @@ func (s *OpenTracingLayerThreadStore) GetTotalUnreadThreads(userId string, teamI return result, err } -func (s *OpenTracingLayerThreadStore) GetTotalUnreadUrgentMentions(userId string, teamID string, opts model.GetUserThreadsOpts) (int64, error) { +func (s *OpenTracingLayerThreadStore) GetTotalUnreadUrgentMentions(userID string, teamID string, opts model.GetUserThreadsOpts) (int64, error) { origCtx := s.Root.Store.Context() span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "ThreadStore.GetTotalUnreadUrgentMentions") s.Root.Store.SetContext(newCtx) @@ -11013,7 +11013,7 @@ func (s *OpenTracingLayerThreadStore) GetTotalUnreadUrgentMentions(userId string }() defer span.Finish() - result, err := s.ThreadStore.GetTotalUnreadUrgentMentions(userId, teamID, opts) + result, err := s.ThreadStore.GetTotalUnreadUrgentMentions(userID, teamID, opts) if err != nil { span.LogFields(spanlog.Error(err)) ext.Error.Set(span, true) @@ -11696,7 +11696,7 @@ func (s *OpenTracingLayerUserStore) GetAllProfiles(options *model.UserGetOptions return result, err } -func (s *OpenTracingLayerUserStore) GetAllProfilesInChannel(rctx context.Context, channelID string, allowFromCache bool) (map[string]*model.User, error) { +func (s *OpenTracingLayerUserStore) GetAllProfilesInChannel(ctx context.Context, channelID string, allowFromCache bool) (map[string]*model.User, error) { origCtx := s.Root.Store.Context() span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "UserStore.GetAllProfilesInChannel") s.Root.Store.SetContext(newCtx) @@ -11705,7 +11705,7 @@ func (s *OpenTracingLayerUserStore) GetAllProfilesInChannel(rctx context.Context }() defer span.Finish() - result, err := s.UserStore.GetAllProfilesInChannel(rctx, channelID, allowFromCache) + result, err := s.UserStore.GetAllProfilesInChannel(ctx, channelID, allowFromCache) if err != nil { span.LogFields(spanlog.Error(err)) ext.Error.Set(span, true) @@ -12095,7 +12095,7 @@ func (s *OpenTracingLayerUserStore) GetProfilesInChannelByStatus(options *model. return result, err } -func (s *OpenTracingLayerUserStore) GetProfilesNotInChannel(teamID string, channelId string, groupConstrained bool, offset int, limit int, viewRestrictions *model.ViewUsersRestrictions) ([]*model.User, error) { +func (s *OpenTracingLayerUserStore) GetProfilesNotInChannel(teamID string, channelID string, groupConstrained bool, offset int, limit int, viewRestrictions *model.ViewUsersRestrictions) ([]*model.User, error) { origCtx := s.Root.Store.Context() span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "UserStore.GetProfilesNotInChannel") s.Root.Store.SetContext(newCtx) @@ -12104,7 +12104,7 @@ func (s *OpenTracingLayerUserStore) GetProfilesNotInChannel(teamID string, chann }() defer span.Finish() - result, err := s.UserStore.GetProfilesNotInChannel(teamID, channelId, groupConstrained, offset, limit, viewRestrictions) + result, err := s.UserStore.GetProfilesNotInChannel(teamID, channelID, groupConstrained, offset, limit, viewRestrictions) if err != nil { span.LogFields(spanlog.Error(err)) ext.Error.Set(span, true) @@ -13034,7 +13034,7 @@ func (s *OpenTracingLayerUserAccessTokenStore) UpdateTokenEnable(tokenID string) return err } -func (s *OpenTracingLayerUserTermsOfServiceStore) Delete(userID string, termsOfServiceId string) error { +func (s *OpenTracingLayerUserTermsOfServiceStore) Delete(userID string, termsOfServiceID string) error { origCtx := s.Root.Store.Context() span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "UserTermsOfServiceStore.Delete") s.Root.Store.SetContext(newCtx) @@ -13043,7 +13043,7 @@ func (s *OpenTracingLayerUserTermsOfServiceStore) Delete(userID string, termsOfS }() defer span.Finish() - err := s.UserTermsOfServiceStore.Delete(userID, termsOfServiceId) + err := s.UserTermsOfServiceStore.Delete(userID, termsOfServiceID) if err != nil { span.LogFields(spanlog.Error(err)) ext.Error.Set(span, true) diff --git a/server/channels/store/retrylayer/retrylayer.go b/server/channels/store/retrylayer/retrylayer.go index 145c93b991d93..74016b404bfff 100644 --- a/server/channels/store/retrylayer/retrylayer.go +++ b/server/channels/store/retrylayer/retrylayer.go @@ -491,11 +491,11 @@ func isRepeatableError(err error) bool { return false } -func (s *RetryLayerAuditStore) Get(user_id string, offset int, limit int) (model.Audits, error) { +func (s *RetryLayerAuditStore) Get(userID string, offset int, limit int) (model.Audits, error) { tries := 0 for { - result, err := s.AuditStore.Get(user_id, offset, limit) + result, err := s.AuditStore.Get(userID, offset, limit) if err == nil { return result, nil } @@ -1196,11 +1196,11 @@ func (s *RetryLayerChannelStore) GetAllDirectChannelsForExportAfter(limit int, a } -func (s *RetryLayerChannelStore) GetByName(team_id string, name string, allowFromCache bool) (*model.Channel, error) { +func (s *RetryLayerChannelStore) GetByName(teamID string, name string, allowFromCache bool) (*model.Channel, error) { tries := 0 for { - result, err := s.ChannelStore.GetByName(team_id, name, allowFromCache) + result, err := s.ChannelStore.GetByName(teamID, name, allowFromCache) if err == nil { return result, nil } @@ -1217,11 +1217,11 @@ func (s *RetryLayerChannelStore) GetByName(team_id string, name string, allowFro } -func (s *RetryLayerChannelStore) GetByNameIncludeDeleted(team_id string, name string, allowFromCache bool) (*model.Channel, error) { +func (s *RetryLayerChannelStore) GetByNameIncludeDeleted(teamID string, name string, allowFromCache bool) (*model.Channel, error) { tries := 0 for { - result, err := s.ChannelStore.GetByNameIncludeDeleted(team_id, name, allowFromCache) + result, err := s.ChannelStore.GetByNameIncludeDeleted(teamID, name, allowFromCache) if err == nil { return result, nil } @@ -1238,11 +1238,11 @@ func (s *RetryLayerChannelStore) GetByNameIncludeDeleted(team_id string, name st } -func (s *RetryLayerChannelStore) GetByNames(team_id string, names []string, allowFromCache bool) ([]*model.Channel, error) { +func (s *RetryLayerChannelStore) GetByNames(teamID string, names []string, allowFromCache bool) ([]*model.Channel, error) { tries := 0 for { - result, err := s.ChannelStore.GetByNames(team_id, names, allowFromCache) + result, err := s.ChannelStore.GetByNames(teamID, names, allowFromCache) if err == nil { return result, nil } @@ -1259,11 +1259,11 @@ func (s *RetryLayerChannelStore) GetByNames(team_id string, names []string, allo } -func (s *RetryLayerChannelStore) GetByNamesIncludeDeleted(team_id string, names []string, allowFromCache bool) ([]*model.Channel, error) { +func (s *RetryLayerChannelStore) GetByNamesIncludeDeleted(teamID string, names []string, allowFromCache bool) ([]*model.Channel, error) { tries := 0 for { - result, err := s.ChannelStore.GetByNamesIncludeDeleted(team_id, names, allowFromCache) + result, err := s.ChannelStore.GetByNamesIncludeDeleted(teamID, names, allowFromCache) if err == nil { return result, nil } @@ -1532,11 +1532,11 @@ func (s *RetryLayerChannelStore) GetChannelsWithUnreadsAndWithMentions(ctx conte } -func (s *RetryLayerChannelStore) GetDeleted(team_id string, offset int, limit int, userID string) (model.ChannelList, error) { +func (s *RetryLayerChannelStore) GetDeleted(teamID string, offset int, limit int, userID string) (model.ChannelList, error) { tries := 0 for { - result, err := s.ChannelStore.GetDeleted(team_id, offset, limit, userID) + result, err := s.ChannelStore.GetDeleted(teamID, offset, limit, userID) if err == nil { return result, nil } @@ -1553,11 +1553,11 @@ func (s *RetryLayerChannelStore) GetDeleted(team_id string, offset int, limit in } -func (s *RetryLayerChannelStore) GetDeletedByName(team_id string, name string) (*model.Channel, error) { +func (s *RetryLayerChannelStore) GetDeletedByName(teamID string, name string) (*model.Channel, error) { tries := 0 for { - result, err := s.ChannelStore.GetDeletedByName(team_id, name) + result, err := s.ChannelStore.GetDeletedByName(teamID, name) if err == nil { return result, nil } @@ -2756,11 +2756,11 @@ func (s *RetryLayerChannelStore) SetDeleteAt(channelID string, deleteAt int64, u } -func (s *RetryLayerChannelStore) SetShared(channelId string, shared bool) error { +func (s *RetryLayerChannelStore) SetShared(channelID string, shared bool) error { tries := 0 for { - err := s.ChannelStore.SetShared(channelId, shared) + err := s.ChannelStore.SetShared(channelID, shared) if err == nil { return nil } @@ -3029,11 +3029,11 @@ func (s *RetryLayerChannelStore) UserBelongsToChannels(userID string, channelIds } -func (s *RetryLayerChannelBookmarkStore) Delete(bookmarkId string, deleteFile bool) error { +func (s *RetryLayerChannelBookmarkStore) Delete(bookmarkID string, deleteFile bool) error { tries := 0 for { - err := s.ChannelBookmarkStore.Delete(bookmarkId, deleteFile) + err := s.ChannelBookmarkStore.Delete(bookmarkID, deleteFile) if err == nil { return nil } @@ -3050,11 +3050,11 @@ func (s *RetryLayerChannelBookmarkStore) Delete(bookmarkId string, deleteFile bo } -func (s *RetryLayerChannelBookmarkStore) ErrorIfBookmarkFileInfoAlreadyAttached(fileId string) error { +func (s *RetryLayerChannelBookmarkStore) ErrorIfBookmarkFileInfoAlreadyAttached(fileID string) error { tries := 0 for { - err := s.ChannelBookmarkStore.ErrorIfBookmarkFileInfoAlreadyAttached(fileId) + err := s.ChannelBookmarkStore.ErrorIfBookmarkFileInfoAlreadyAttached(fileID) if err == nil { return nil } @@ -3092,11 +3092,11 @@ func (s *RetryLayerChannelBookmarkStore) Get(Id string, includeDeleted bool) (*m } -func (s *RetryLayerChannelBookmarkStore) GetBookmarksForChannelSince(channelId string, since int64) ([]*model.ChannelBookmarkWithFileInfo, error) { +func (s *RetryLayerChannelBookmarkStore) GetBookmarksForChannelSince(channelID string, since int64) ([]*model.ChannelBookmarkWithFileInfo, error) { tries := 0 for { - result, err := s.ChannelBookmarkStore.GetBookmarksForChannelSince(channelId, since) + result, err := s.ChannelBookmarkStore.GetBookmarksForChannelSince(channelID, since) if err == nil { return result, nil } @@ -3155,11 +3155,11 @@ func (s *RetryLayerChannelBookmarkStore) Update(bookmark *model.ChannelBookmark) } -func (s *RetryLayerChannelBookmarkStore) UpdateSortOrder(bookmarkId string, channelId string, newIndex int64) ([]*model.ChannelBookmarkWithFileInfo, error) { +func (s *RetryLayerChannelBookmarkStore) UpdateSortOrder(bookmarkID string, channelID string, newIndex int64) ([]*model.ChannelBookmarkWithFileInfo, error) { tries := 0 for { - result, err := s.ChannelBookmarkStore.UpdateSortOrder(bookmarkId, channelId, newIndex) + result, err := s.ChannelBookmarkStore.UpdateSortOrder(bookmarkID, channelID, newIndex) if err == nil { return result, nil } @@ -3854,11 +3854,11 @@ func (s *RetryLayerDesktopTokensStore) Delete(token string) error { } -func (s *RetryLayerDesktopTokensStore) DeleteByUserId(userId string) error { +func (s *RetryLayerDesktopTokensStore) DeleteByUserId(userID string) error { tries := 0 for { - err := s.DesktopTokensStore.DeleteByUserId(userId) + err := s.DesktopTokensStore.DeleteByUserId(userID) if err == nil { return nil } @@ -3917,11 +3917,11 @@ func (s *RetryLayerDesktopTokensStore) GetUserId(token string, minCreatedAt int6 } -func (s *RetryLayerDesktopTokensStore) Insert(token string, createAt int64, userId string) error { +func (s *RetryLayerDesktopTokensStore) Insert(token string, createAt int64, userID string) error { tries := 0 for { - err := s.DesktopTokensStore.Insert(token, createAt, userId) + err := s.DesktopTokensStore.Insert(token, createAt, userID) if err == nil { return nil } @@ -3980,11 +3980,11 @@ func (s *RetryLayerDraftStore) DeleteDraftsAssociatedWithPost(channelID string, } -func (s *RetryLayerDraftStore) DeleteEmptyDraftsByCreateAtAndUserId(createAt int64, userId string) error { +func (s *RetryLayerDraftStore) DeleteEmptyDraftsByCreateAtAndUserId(createAt int64, userID string) error { tries := 0 for { - err := s.DraftStore.DeleteEmptyDraftsByCreateAtAndUserId(createAt, userId) + err := s.DraftStore.DeleteEmptyDraftsByCreateAtAndUserId(createAt, userID) if err == nil { return nil } @@ -4001,11 +4001,11 @@ func (s *RetryLayerDraftStore) DeleteEmptyDraftsByCreateAtAndUserId(createAt int } -func (s *RetryLayerDraftStore) DeleteOrphanDraftsByCreateAtAndUserId(createAt int64, userId string) error { +func (s *RetryLayerDraftStore) DeleteOrphanDraftsByCreateAtAndUserId(createAt int64, userID string) error { tries := 0 for { - err := s.DraftStore.DeleteOrphanDraftsByCreateAtAndUserId(createAt, userId) + err := s.DraftStore.DeleteOrphanDraftsByCreateAtAndUserId(createAt, userID) if err == nil { return nil } @@ -4064,11 +4064,11 @@ func (s *RetryLayerDraftStore) GetDraftsForUser(userID string, teamID string) ([ } -func (s *RetryLayerDraftStore) GetLastCreateAtAndUserIdValuesForEmptyDraftsMigration(createAt int64, userId string) (int64, string, error) { +func (s *RetryLayerDraftStore) GetLastCreateAtAndUserIdValuesForEmptyDraftsMigration(createAt int64, userID string) (int64, string, error) { tries := 0 for { - result, resultVar1, err := s.DraftStore.GetLastCreateAtAndUserIdValuesForEmptyDraftsMigration(createAt, userId) + result, resultVar1, err := s.DraftStore.GetLastCreateAtAndUserIdValuesForEmptyDraftsMigration(createAt, userID) if err == nil { return result, resultVar1, nil } @@ -6344,11 +6344,11 @@ func (s *RetryLayerNotifyAdminStore) Get(trial bool) ([]*model.NotifyAdminData, } -func (s *RetryLayerNotifyAdminStore) GetDataByUserIdAndFeature(userId string, feature model.MattermostFeature) ([]*model.NotifyAdminData, error) { +func (s *RetryLayerNotifyAdminStore) GetDataByUserIdAndFeature(userID string, feature model.MattermostFeature) ([]*model.NotifyAdminData, error) { tries := 0 for { - result, err := s.NotifyAdminStore.GetDataByUserIdAndFeature(userId, feature) + result, err := s.NotifyAdminStore.GetDataByUserIdAndFeature(userID, feature) if err == nil { return result, nil } @@ -6386,11 +6386,11 @@ func (s *RetryLayerNotifyAdminStore) Save(data *model.NotifyAdminData) (*model.N } -func (s *RetryLayerNotifyAdminStore) Update(userId string, requiredPlan string, requiredFeature model.MattermostFeature, now int64) error { +func (s *RetryLayerNotifyAdminStore) Update(userID string, requiredPlan string, requiredFeature model.MattermostFeature, now int64) error { tries := 0 for { - err := s.NotifyAdminStore.Update(userId, requiredPlan, requiredFeature, now) + err := s.NotifyAdminStore.Update(userID, requiredPlan, requiredFeature, now) if err == nil { return nil } @@ -6470,11 +6470,11 @@ func (s *RetryLayerOAuthStore) GetAccessDataByRefreshToken(token string) (*model } -func (s *RetryLayerOAuthStore) GetAccessDataByUserForApp(userID string, clientId string) ([]*model.AccessData, error) { +func (s *RetryLayerOAuthStore) GetAccessDataByUserForApp(userID string, clientID string) ([]*model.AccessData, error) { tries := 0 for { - result, err := s.OAuthStore.GetAccessDataByUserForApp(userID, clientId) + result, err := s.OAuthStore.GetAccessDataByUserForApp(userID, clientID) if err == nil { return result, nil } @@ -6596,11 +6596,11 @@ func (s *RetryLayerOAuthStore) GetAuthorizedApps(userID string, offset int, limi } -func (s *RetryLayerOAuthStore) GetPreviousAccessData(userID string, clientId string) (*model.AccessData, error) { +func (s *RetryLayerOAuthStore) GetPreviousAccessData(userID string, clientID string) (*model.AccessData, error) { tries := 0 for { - result, err := s.OAuthStore.GetPreviousAccessData(userID, clientId) + result, err := s.OAuthStore.GetPreviousAccessData(userID, clientID) if err == nil { return result, nil } @@ -6701,11 +6701,11 @@ func (s *RetryLayerOAuthStore) RemoveAuthData(code string) error { } -func (s *RetryLayerOAuthStore) RemoveAuthDataByClientId(clientId string, userId string) error { +func (s *RetryLayerOAuthStore) RemoveAuthDataByClientId(clientID string, userID string) error { tries := 0 for { - err := s.OAuthStore.RemoveAuthDataByClientId(clientId, userId) + err := s.OAuthStore.RemoveAuthDataByClientId(clientID, userID) if err == nil { return nil } @@ -6722,11 +6722,11 @@ func (s *RetryLayerOAuthStore) RemoveAuthDataByClientId(clientId string, userId } -func (s *RetryLayerOAuthStore) RemoveAuthDataByUserId(userId string) error { +func (s *RetryLayerOAuthStore) RemoveAuthDataByUserId(userID string) error { tries := 0 for { - err := s.OAuthStore.RemoveAuthDataByUserId(userId) + err := s.OAuthStore.RemoveAuthDataByUserId(userID) if err == nil { return nil } @@ -7274,11 +7274,11 @@ func (s *RetryLayerPostStore) GetDirectPostParentsForExportAfter(limit int, afte } -func (s *RetryLayerPostStore) GetEditHistoryForPost(postId string) ([]*model.Post, error) { +func (s *RetryLayerPostStore) GetEditHistoryForPost(postID string) ([]*model.Post, error) { tries := 0 for { - result, err := s.PostStore.GetEditHistoryForPost(postId) + result, err := s.PostStore.GetEditHistoryForPost(postID) if err == nil { return result, nil } @@ -7790,11 +7790,11 @@ func (s *RetryLayerPostStore) GetSingle(rctx request.CTX, id string, inclDeleted } -func (s *RetryLayerPostStore) HasAutoResponsePostByUserSince(options model.GetPostsSinceOptions, userId string) (bool, error) { +func (s *RetryLayerPostStore) HasAutoResponsePostByUserSince(options model.GetPostsSinceOptions, userID string) (bool, error) { tries := 0 for { - result, err := s.PostStore.HasAutoResponsePostByUserSince(options, userId) + result, err := s.PostStore.HasAutoResponsePostByUserSince(options, userID) if err == nil { return result, nil } @@ -8342,11 +8342,11 @@ func (s *RetryLayerPostPersistentNotificationStore) UpdateLastActivity(postIds [ } -func (s *RetryLayerPostPriorityStore) GetForPost(postId string) (*model.PostPriority, error) { +func (s *RetryLayerPostPriorityStore) GetForPost(postID string) (*model.PostPriority, error) { tries := 0 for { - result, err := s.PostPriorityStore.GetForPost(postId) + result, err := s.PostPriorityStore.GetForPost(postID) if err == nil { return result, nil } @@ -8804,11 +8804,11 @@ func (s *RetryLayerReactionStore) DeleteOrphanedRowsByIds(r *model.RetentionIdsF } -func (s *RetryLayerReactionStore) ExistsOnPost(postId string, emojiName string) (bool, error) { +func (s *RetryLayerReactionStore) ExistsOnPost(postID string, emojiName string) (bool, error) { tries := 0 for { - result, err := s.ReactionStore.ExistsOnPost(postId, emojiName) + result, err := s.ReactionStore.ExistsOnPost(postID, emojiName) if err == nil { return result, nil } @@ -8846,11 +8846,11 @@ func (s *RetryLayerReactionStore) GetForPost(postID string, allowFromCache bool) } -func (s *RetryLayerReactionStore) GetForPostSince(postId string, since int64, excludeRemoteId string, inclDeleted bool) ([]*model.Reaction, error) { +func (s *RetryLayerReactionStore) GetForPostSince(postID string, since int64, excludeRemoteID string, inclDeleted bool) ([]*model.Reaction, error) { tries := 0 for { - result, err := s.ReactionStore.GetForPostSince(postId, since, excludeRemoteId, inclDeleted) + result, err := s.ReactionStore.GetForPostSince(postID, since, excludeRemoteID, inclDeleted) if err == nil { return result, nil } @@ -8888,11 +8888,11 @@ func (s *RetryLayerReactionStore) GetSingle(userID string, postID string, remote } -func (s *RetryLayerReactionStore) GetUniqueCountForPost(postId string) (int, error) { +func (s *RetryLayerReactionStore) GetUniqueCountForPost(postID string) (int, error) { tries := 0 for { - result, err := s.ReactionStore.GetUniqueCountForPost(postId) + result, err := s.ReactionStore.GetUniqueCountForPost(postID) if err == nil { return result, nil } @@ -8972,11 +8972,11 @@ func (s *RetryLayerReactionStore) Save(reaction *model.Reaction) (*model.Reactio } -func (s *RetryLayerRemoteClusterStore) Delete(remoteClusterId string) (bool, error) { +func (s *RetryLayerRemoteClusterStore) Delete(remoteClusterID string) (bool, error) { tries := 0 for { - result, err := s.RemoteClusterStore.Delete(remoteClusterId) + result, err := s.RemoteClusterStore.Delete(remoteClusterID) if err == nil { return result, nil } @@ -8993,11 +8993,11 @@ func (s *RetryLayerRemoteClusterStore) Delete(remoteClusterId string) (bool, err } -func (s *RetryLayerRemoteClusterStore) Get(remoteClusterId string, includeDeleted bool) (*model.RemoteCluster, error) { +func (s *RetryLayerRemoteClusterStore) Get(remoteClusterID string, includeDeleted bool) (*model.RemoteCluster, error) { tries := 0 for { - result, err := s.RemoteClusterStore.Get(remoteClusterId, includeDeleted) + result, err := s.RemoteClusterStore.Get(remoteClusterID, includeDeleted) if err == nil { return result, nil } @@ -9077,11 +9077,11 @@ func (s *RetryLayerRemoteClusterStore) Save(rc *model.RemoteCluster) (*model.Rem } -func (s *RetryLayerRemoteClusterStore) SetLastPingAt(remoteClusterId string) error { +func (s *RetryLayerRemoteClusterStore) SetLastPingAt(remoteClusterID string) error { tries := 0 for { - err := s.RemoteClusterStore.SetLastPingAt(remoteClusterId) + err := s.RemoteClusterStore.SetLastPingAt(remoteClusterID) if err == nil { return nil } @@ -9119,11 +9119,11 @@ func (s *RetryLayerRemoteClusterStore) Update(rc *model.RemoteCluster) (*model.R } -func (s *RetryLayerRemoteClusterStore) UpdateTopics(remoteClusterId string, topics string) (*model.RemoteCluster, error) { +func (s *RetryLayerRemoteClusterStore) UpdateTopics(remoteClusterID string, topics string) (*model.RemoteCluster, error) { tries := 0 for { - result, err := s.RemoteClusterStore.UpdateTopics(remoteClusterId, topics) + result, err := s.RemoteClusterStore.UpdateTopics(remoteClusterID, topics) if err == nil { return result, nil } @@ -9140,11 +9140,11 @@ func (s *RetryLayerRemoteClusterStore) UpdateTopics(remoteClusterId string, topi } -func (s *RetryLayerRetentionPolicyStore) AddChannels(policyId string, channelIds []string) error { +func (s *RetryLayerRetentionPolicyStore) AddChannels(policyID string, channelIds []string) error { tries := 0 for { - err := s.RetentionPolicyStore.AddChannels(policyId, channelIds) + err := s.RetentionPolicyStore.AddChannels(policyID, channelIds) if err == nil { return nil } @@ -9161,11 +9161,11 @@ func (s *RetryLayerRetentionPolicyStore) AddChannels(policyId string, channelIds } -func (s *RetryLayerRetentionPolicyStore) AddTeams(policyId string, teamIds []string) error { +func (s *RetryLayerRetentionPolicyStore) AddTeams(policyID string, teamIds []string) error { tries := 0 for { - err := s.RetentionPolicyStore.AddTeams(policyId, teamIds) + err := s.RetentionPolicyStore.AddTeams(policyID, teamIds) if err == nil { return nil } @@ -9308,11 +9308,11 @@ func (s *RetryLayerRetentionPolicyStore) GetChannelPoliciesForUser(userID string } -func (s *RetryLayerRetentionPolicyStore) GetChannels(policyId string, offset int, limit int) (model.ChannelListWithTeamData, error) { +func (s *RetryLayerRetentionPolicyStore) GetChannels(policyID string, offset int, limit int) (model.ChannelListWithTeamData, error) { tries := 0 for { - result, err := s.RetentionPolicyStore.GetChannels(policyId, offset, limit) + result, err := s.RetentionPolicyStore.GetChannels(policyID, offset, limit) if err == nil { return result, nil } @@ -9329,11 +9329,11 @@ func (s *RetryLayerRetentionPolicyStore) GetChannels(policyId string, offset int } -func (s *RetryLayerRetentionPolicyStore) GetChannelsCount(policyId string) (int64, error) { +func (s *RetryLayerRetentionPolicyStore) GetChannelsCount(policyID string) (int64, error) { tries := 0 for { - result, err := s.RetentionPolicyStore.GetChannelsCount(policyId) + result, err := s.RetentionPolicyStore.GetChannelsCount(policyID) if err == nil { return result, nil } @@ -9434,11 +9434,11 @@ func (s *RetryLayerRetentionPolicyStore) GetTeamPoliciesForUser(userID string, o } -func (s *RetryLayerRetentionPolicyStore) GetTeams(policyId string, offset int, limit int) ([]*model.Team, error) { +func (s *RetryLayerRetentionPolicyStore) GetTeams(policyID string, offset int, limit int) ([]*model.Team, error) { tries := 0 for { - result, err := s.RetentionPolicyStore.GetTeams(policyId, offset, limit) + result, err := s.RetentionPolicyStore.GetTeams(policyID, offset, limit) if err == nil { return result, nil } @@ -9455,11 +9455,11 @@ func (s *RetryLayerRetentionPolicyStore) GetTeams(policyId string, offset int, l } -func (s *RetryLayerRetentionPolicyStore) GetTeamsCount(policyId string) (int64, error) { +func (s *RetryLayerRetentionPolicyStore) GetTeamsCount(policyID string) (int64, error) { tries := 0 for { - result, err := s.RetentionPolicyStore.GetTeamsCount(policyId) + result, err := s.RetentionPolicyStore.GetTeamsCount(policyID) if err == nil { return result, nil } @@ -9497,11 +9497,11 @@ func (s *RetryLayerRetentionPolicyStore) Patch(patch *model.RetentionPolicyWithT } -func (s *RetryLayerRetentionPolicyStore) RemoveChannels(policyId string, channelIds []string) error { +func (s *RetryLayerRetentionPolicyStore) RemoveChannels(policyID string, channelIds []string) error { tries := 0 for { - err := s.RetentionPolicyStore.RemoveChannels(policyId, channelIds) + err := s.RetentionPolicyStore.RemoveChannels(policyID, channelIds) if err == nil { return nil } @@ -9518,11 +9518,11 @@ func (s *RetryLayerRetentionPolicyStore) RemoveChannels(policyId string, channel } -func (s *RetryLayerRetentionPolicyStore) RemoveTeams(policyId string, teamIds []string) error { +func (s *RetryLayerRetentionPolicyStore) RemoveTeams(policyID string, teamIds []string) error { tries := 0 for { - err := s.RetentionPolicyStore.RemoveTeams(policyId, teamIds) + err := s.RetentionPolicyStore.RemoveTeams(policyID, teamIds) if err == nil { return nil } @@ -10316,11 +10316,11 @@ func (s *RetryLayerSessionStore) UpdateRoles(userID string, roles string) (strin } -func (s *RetryLayerSharedChannelStore) Delete(channelId string) (bool, error) { +func (s *RetryLayerSharedChannelStore) Delete(channelID string) (bool, error) { tries := 0 for { - result, err := s.SharedChannelStore.Delete(channelId) + result, err := s.SharedChannelStore.Delete(channelID) if err == nil { return result, nil } @@ -10337,11 +10337,11 @@ func (s *RetryLayerSharedChannelStore) Delete(channelId string) (bool, error) { } -func (s *RetryLayerSharedChannelStore) DeleteRemote(remoteId string) (bool, error) { +func (s *RetryLayerSharedChannelStore) DeleteRemote(remoteID string) (bool, error) { tries := 0 for { - result, err := s.SharedChannelStore.DeleteRemote(remoteId) + result, err := s.SharedChannelStore.DeleteRemote(remoteID) if err == nil { return result, nil } @@ -10358,11 +10358,11 @@ func (s *RetryLayerSharedChannelStore) DeleteRemote(remoteId string) (bool, erro } -func (s *RetryLayerSharedChannelStore) Get(channelId string) (*model.SharedChannel, error) { +func (s *RetryLayerSharedChannelStore) Get(channelID string) (*model.SharedChannel, error) { tries := 0 for { - result, err := s.SharedChannelStore.Get(channelId) + result, err := s.SharedChannelStore.Get(channelID) if err == nil { return result, nil } @@ -10421,11 +10421,11 @@ func (s *RetryLayerSharedChannelStore) GetAllCount(opts model.SharedChannelFilte } -func (s *RetryLayerSharedChannelStore) GetAttachment(fileId string, remoteId string) (*model.SharedChannelAttachment, error) { +func (s *RetryLayerSharedChannelStore) GetAttachment(fileID string, remoteID string) (*model.SharedChannelAttachment, error) { tries := 0 for { - result, err := s.SharedChannelStore.GetAttachment(fileId, remoteId) + result, err := s.SharedChannelStore.GetAttachment(fileID, remoteID) if err == nil { return result, nil } @@ -10463,11 +10463,11 @@ func (s *RetryLayerSharedChannelStore) GetRemote(id string) (*model.SharedChanne } -func (s *RetryLayerSharedChannelStore) GetRemoteByIds(channelId string, remoteId string) (*model.SharedChannelRemote, error) { +func (s *RetryLayerSharedChannelStore) GetRemoteByIds(channelID string, remoteID string) (*model.SharedChannelRemote, error) { tries := 0 for { - result, err := s.SharedChannelStore.GetRemoteByIds(channelId, remoteId) + result, err := s.SharedChannelStore.GetRemoteByIds(channelID, remoteID) if err == nil { return result, nil } @@ -10484,11 +10484,11 @@ func (s *RetryLayerSharedChannelStore) GetRemoteByIds(channelId string, remoteId } -func (s *RetryLayerSharedChannelStore) GetRemoteForUser(remoteId string, userId string) (*model.RemoteCluster, error) { +func (s *RetryLayerSharedChannelStore) GetRemoteForUser(remoteID string, userID string) (*model.RemoteCluster, error) { tries := 0 for { - result, err := s.SharedChannelStore.GetRemoteForUser(remoteId, userId) + result, err := s.SharedChannelStore.GetRemoteForUser(remoteID, userID) if err == nil { return result, nil } @@ -10526,11 +10526,11 @@ func (s *RetryLayerSharedChannelStore) GetRemotes(offset int, limit int, opts mo } -func (s *RetryLayerSharedChannelStore) GetRemotesStatus(channelId string) ([]*model.SharedChannelRemoteStatus, error) { +func (s *RetryLayerSharedChannelStore) GetRemotesStatus(channelID string) ([]*model.SharedChannelRemoteStatus, error) { tries := 0 for { - result, err := s.SharedChannelStore.GetRemotesStatus(channelId) + result, err := s.SharedChannelStore.GetRemotesStatus(channelID) if err == nil { return result, nil } @@ -10631,11 +10631,11 @@ func (s *RetryLayerSharedChannelStore) HasChannel(channelID string) (bool, error } -func (s *RetryLayerSharedChannelStore) HasRemote(channelID string, remoteId string) (bool, error) { +func (s *RetryLayerSharedChannelStore) HasRemote(channelID string, remoteID string) (bool, error) { tries := 0 for { - result, err := s.SharedChannelStore.HasRemote(channelID, remoteId) + result, err := s.SharedChannelStore.HasRemote(channelID, remoteID) if err == nil { return result, nil } @@ -12281,11 +12281,11 @@ func (s *RetryLayerTermsOfServiceStore) Save(termsOfService *model.TermsOfServic } -func (s *RetryLayerThreadStore) DeleteMembershipForUser(userId string, postID string) error { +func (s *RetryLayerThreadStore) DeleteMembershipForUser(userID string, postID string) error { tries := 0 for { - err := s.ThreadStore.DeleteMembershipForUser(userId, postID) + err := s.ThreadStore.DeleteMembershipForUser(userID, postID) if err == nil { return nil } @@ -12365,11 +12365,11 @@ func (s *RetryLayerThreadStore) Get(id string) (*model.Thread, error) { } -func (s *RetryLayerThreadStore) GetMembershipForUser(userId string, postID string) (*model.ThreadMembership, error) { +func (s *RetryLayerThreadStore) GetMembershipForUser(userID string, postID string) (*model.ThreadMembership, error) { tries := 0 for { - result, err := s.ThreadStore.GetMembershipForUser(userId, postID) + result, err := s.ThreadStore.GetMembershipForUser(userID, postID) if err == nil { return result, nil } @@ -12386,11 +12386,11 @@ func (s *RetryLayerThreadStore) GetMembershipForUser(userId string, postID strin } -func (s *RetryLayerThreadStore) GetMembershipsForUser(userId string, teamID string) ([]*model.ThreadMembership, error) { +func (s *RetryLayerThreadStore) GetMembershipsForUser(userID string, teamID string) ([]*model.ThreadMembership, error) { tries := 0 for { - result, err := s.ThreadStore.GetMembershipsForUser(userId, teamID) + result, err := s.ThreadStore.GetMembershipsForUser(userID, teamID) if err == nil { return result, nil } @@ -12512,11 +12512,11 @@ func (s *RetryLayerThreadStore) GetThreadUnreadReplyCount(threadMembership *mode } -func (s *RetryLayerThreadStore) GetThreadsForUser(userId string, teamID string, opts model.GetUserThreadsOpts) ([]*model.ThreadResponse, error) { +func (s *RetryLayerThreadStore) GetThreadsForUser(userID string, teamID string, opts model.GetUserThreadsOpts) ([]*model.ThreadResponse, error) { tries := 0 for { - result, err := s.ThreadStore.GetThreadsForUser(userId, teamID, opts) + result, err := s.ThreadStore.GetThreadsForUser(userID, teamID, opts) if err == nil { return result, nil } @@ -12533,11 +12533,11 @@ func (s *RetryLayerThreadStore) GetThreadsForUser(userId string, teamID string, } -func (s *RetryLayerThreadStore) GetTotalThreads(userId string, teamID string, opts model.GetUserThreadsOpts) (int64, error) { +func (s *RetryLayerThreadStore) GetTotalThreads(userID string, teamID string, opts model.GetUserThreadsOpts) (int64, error) { tries := 0 for { - result, err := s.ThreadStore.GetTotalThreads(userId, teamID, opts) + result, err := s.ThreadStore.GetTotalThreads(userID, teamID, opts) if err == nil { return result, nil } @@ -12554,11 +12554,11 @@ func (s *RetryLayerThreadStore) GetTotalThreads(userId string, teamID string, op } -func (s *RetryLayerThreadStore) GetTotalUnreadMentions(userId string, teamID string, opts model.GetUserThreadsOpts) (int64, error) { +func (s *RetryLayerThreadStore) GetTotalUnreadMentions(userID string, teamID string, opts model.GetUserThreadsOpts) (int64, error) { tries := 0 for { - result, err := s.ThreadStore.GetTotalUnreadMentions(userId, teamID, opts) + result, err := s.ThreadStore.GetTotalUnreadMentions(userID, teamID, opts) if err == nil { return result, nil } @@ -12575,11 +12575,11 @@ func (s *RetryLayerThreadStore) GetTotalUnreadMentions(userId string, teamID str } -func (s *RetryLayerThreadStore) GetTotalUnreadThreads(userId string, teamID string, opts model.GetUserThreadsOpts) (int64, error) { +func (s *RetryLayerThreadStore) GetTotalUnreadThreads(userID string, teamID string, opts model.GetUserThreadsOpts) (int64, error) { tries := 0 for { - result, err := s.ThreadStore.GetTotalUnreadThreads(userId, teamID, opts) + result, err := s.ThreadStore.GetTotalUnreadThreads(userID, teamID, opts) if err == nil { return result, nil } @@ -12596,11 +12596,11 @@ func (s *RetryLayerThreadStore) GetTotalUnreadThreads(userId string, teamID stri } -func (s *RetryLayerThreadStore) GetTotalUnreadUrgentMentions(userId string, teamID string, opts model.GetUserThreadsOpts) (int64, error) { +func (s *RetryLayerThreadStore) GetTotalUnreadUrgentMentions(userID string, teamID string, opts model.GetUserThreadsOpts) (int64, error) { tries := 0 for { - result, err := s.ThreadStore.GetTotalUnreadUrgentMentions(userId, teamID, opts) + result, err := s.ThreadStore.GetTotalUnreadUrgentMentions(userID, teamID, opts) if err == nil { return result, nil } @@ -13385,11 +13385,11 @@ func (s *RetryLayerUserStore) GetAllProfiles(options *model.UserGetOptions) ([]* } -func (s *RetryLayerUserStore) GetAllProfilesInChannel(rctx context.Context, channelID string, allowFromCache bool) (map[string]*model.User, error) { +func (s *RetryLayerUserStore) GetAllProfilesInChannel(ctx context.Context, channelID string, allowFromCache bool) (map[string]*model.User, error) { tries := 0 for { - result, err := s.UserStore.GetAllProfilesInChannel(rctx, channelID, allowFromCache) + result, err := s.UserStore.GetAllProfilesInChannel(ctx, channelID, allowFromCache) if err == nil { return result, nil } @@ -13823,11 +13823,11 @@ func (s *RetryLayerUserStore) GetProfilesInChannelByStatus(options *model.UserGe } -func (s *RetryLayerUserStore) GetProfilesNotInChannel(teamID string, channelId string, groupConstrained bool, offset int, limit int, viewRestrictions *model.ViewUsersRestrictions) ([]*model.User, error) { +func (s *RetryLayerUserStore) GetProfilesNotInChannel(teamID string, channelID string, groupConstrained bool, offset int, limit int, viewRestrictions *model.ViewUsersRestrictions) ([]*model.User, error) { tries := 0 for { - result, err := s.UserStore.GetProfilesNotInChannel(teamID, channelId, groupConstrained, offset, limit, viewRestrictions) + result, err := s.UserStore.GetProfilesNotInChannel(teamID, channelID, groupConstrained, offset, limit, viewRestrictions) if err == nil { return result, nil } @@ -14891,11 +14891,11 @@ func (s *RetryLayerUserAccessTokenStore) UpdateTokenEnable(tokenID string) error } -func (s *RetryLayerUserTermsOfServiceStore) Delete(userID string, termsOfServiceId string) error { +func (s *RetryLayerUserTermsOfServiceStore) Delete(userID string, termsOfServiceID string) error { tries := 0 for { - err := s.UserTermsOfServiceStore.Delete(userID, termsOfServiceId) + err := s.UserTermsOfServiceStore.Delete(userID, termsOfServiceID) if err == nil { return nil } diff --git a/server/channels/store/sqlstore/channel_store.go b/server/channels/store/sqlstore/channel_store.go index ac8344145dad3..2861fbde55801 100644 --- a/server/channels/store/sqlstore/channel_store.go +++ b/server/channels/store/sqlstore/channel_store.go @@ -3357,7 +3357,7 @@ func (s SqlChannelStore) channelSearchQuery(opts *store.ChannelSearchOpts) sq.Se } likeFields := "c.Name, c.DisplayName, c.Purpose" - if opts.IncludeSearchById { + if opts.IncludeSearchByID { likeFields = likeFields + ", c.Id" } diff --git a/server/channels/store/sqlstore/post_store.go b/server/channels/store/sqlstore/post_store.go index 14242ddb875f3..b99a15e41b9ea 100644 --- a/server/channels/store/sqlstore/post_store.go +++ b/server/channels/store/sqlstore/post_store.go @@ -3284,7 +3284,7 @@ func (s *SqlPostStore) GetPostReminders(now int64) (_ []*model.PostReminder, err func (s *SqlPostStore) GetPostReminderMetadata(postID string) (*store.PostReminderMetadata, error) { meta := &store.PostReminderMetadata{} - err := s.GetReplicaX().Get(meta, `SELECT c.id as ChannelId, + err := s.GetReplicaX().Get(meta, `SELECT c.id as ChannelID, COALESCE(t.name, '') as TeamName, u.locale as UserLocale, u.username as Username FROM Posts p diff --git a/server/channels/store/store.go b/server/channels/store/store.go index 9f428bc15557f..74250e20a77b2 100644 --- a/server/channels/store/store.go +++ b/server/channels/store/store.go @@ -100,14 +100,14 @@ type RetentionPolicyStore interface { GetAll(offset, limit int) ([]*model.RetentionPolicyWithTeamAndChannelCounts, error) GetCount() (int64, error) Delete(id string) error - GetChannels(policyId string, offset, limit int) (model.ChannelListWithTeamData, error) - GetChannelsCount(policyId string) (int64, error) - AddChannels(policyId string, channelIds []string) error - RemoveChannels(policyId string, channelIds []string) error - GetTeams(policyId string, offset, limit int) ([]*model.Team, error) - GetTeamsCount(policyId string) (int64, error) - AddTeams(policyId string, teamIds []string) error - RemoveTeams(policyId string, teamIds []string) error + GetChannels(policyID string, offset, limit int) (model.ChannelListWithTeamData, error) + GetChannelsCount(policyID string) (int64, error) + AddChannels(policyID string, channelIds []string) error + RemoveChannels(policyID string, channelIds []string) error + GetTeams(policyID string, offset, limit int) ([]*model.Team, error) + GetTeamsCount(policyID string) (int64, error) + AddTeams(policyID string, teamIds []string) error + RemoveTeams(policyID string, teamIds []string) error DeleteOrphanedRows(limit int) (int64, error) GetTeamPoliciesForUser(userID string, offset, limit int) ([]*model.RetentionPolicyForTeam, error) GetTeamPoliciesCountForUser(userID string) (int64, error) @@ -197,12 +197,12 @@ type ChannelStore interface { SetDeleteAt(channelID string, deleteAt int64, updateAt int64) error PermanentDelete(ctx request.CTX, channelID string) error PermanentDeleteByTeam(teamID string) error - GetByName(team_id string, name string, allowFromCache bool) (*model.Channel, error) - GetByNames(team_id string, names []string, allowFromCache bool) ([]*model.Channel, error) - GetByNameIncludeDeleted(team_id string, name string, allowFromCache bool) (*model.Channel, error) - GetByNamesIncludeDeleted(team_id string, names []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) + GetByName(teamID string, name string, allowFromCache bool) (*model.Channel, error) + GetByNames(teamID string, names []string, allowFromCache bool) ([]*model.Channel, error) + GetByNameIncludeDeleted(teamID string, name string, allowFromCache bool) (*model.Channel, error) + GetByNamesIncludeDeleted(teamID string, names []string, allowFromCache bool) ([]*model.Channel, error) + GetDeletedByName(teamID string, name string) (*model.Channel, error) + GetDeleted(teamID string, offset int, limit int, userID string) (model.ChannelList, error) GetChannels(teamID, userID string, opts *model.ChannelSearchOpts) (model.ChannelList, error) GetChannelsByUser(userID string, includeDeleted bool, lastDeleteAt, pageSize int, fromChannelID string) (model.ChannelList, error) GetAllChannelMemberIdsByChannelId(id string) ([]string, error) @@ -307,7 +307,7 @@ type ChannelStore interface { // GroupSyncedChannelCount returns the count of non-deleted group-constrained channels. GroupSyncedChannelCount() (int64, error) - SetShared(channelId string, shared bool) error + SetShared(channelID string, shared bool) error // GetTeamForChannel returns the team for a given channelID. GetTeamForChannel(channelID string) (*model.Team, error) IsReadOnlyChannel(channelID string) (bool, error) @@ -328,11 +328,11 @@ type ThreadStore interface { GetThreadMembershipsForExport(postID string) ([]*model.ThreadMembershipForExport, error) Get(id string) (*model.Thread, error) - GetTotalUnreadThreads(userId, teamID string, opts model.GetUserThreadsOpts) (int64, error) - GetTotalThreads(userId, teamID string, opts model.GetUserThreadsOpts) (int64, error) - GetTotalUnreadMentions(userId, teamID string, opts model.GetUserThreadsOpts) (int64, error) - GetTotalUnreadUrgentMentions(userId, teamID string, opts model.GetUserThreadsOpts) (int64, error) - GetThreadsForUser(userId, teamID string, opts model.GetUserThreadsOpts) ([]*model.ThreadResponse, error) + GetTotalUnreadThreads(userID, teamID string, opts model.GetUserThreadsOpts) (int64, error) + GetTotalThreads(userID, teamID string, opts model.GetUserThreadsOpts) (int64, error) + GetTotalUnreadMentions(userID, teamID string, opts model.GetUserThreadsOpts) (int64, error) + GetTotalUnreadUrgentMentions(userID, teamID string, opts model.GetUserThreadsOpts) (int64, error) + GetThreadsForUser(userID, teamID string, opts model.GetUserThreadsOpts) ([]*model.ThreadResponse, error) GetThreadForUser(threadMembership *model.ThreadMembership, extended, postPriorityIsEnabled bool) (*model.ThreadResponse, error) GetTeamsUnreadForUser(userID string, teamIDs []string, includeUrgentMentionCount bool) (map[string]*model.TeamUnread, error) @@ -342,9 +342,9 @@ type ThreadStore interface { MarkAsRead(userID, threadID string, timestamp int64) error UpdateMembership(membership *model.ThreadMembership) (*model.ThreadMembership, error) - GetMembershipsForUser(userId, teamID string) ([]*model.ThreadMembership, error) - GetMembershipForUser(userId, postID string) (*model.ThreadMembership, error) - DeleteMembershipForUser(userId, postID string) error + GetMembershipsForUser(userID, teamID string) ([]*model.ThreadMembership, error) + GetMembershipForUser(userID, postID string) (*model.ThreadMembership, error) + DeleteMembershipForUser(userID, postID string) error MaintainMembership(userID, postID string, opts ThreadMembershipOpts) (*model.ThreadMembership, error) PermanentDeleteBatchForRetentionPolicies(now, globalPolicyEndTime, limit int64, cursor model.RetentionPolicyCursor) (int64, model.RetentionPolicyCursor, error) PermanentDeleteBatchThreadMembershipsForRetentionPolicies(now, globalPolicyEndTime, limit int64, cursor model.RetentionPolicyCursor) (int64, model.RetentionPolicyCursor, error) @@ -389,7 +389,7 @@ type PostStore interface { Overwrite(rctx request.CTX, post *model.Post) (*model.Post, error) OverwriteMultiple(posts []*model.Post) ([]*model.Post, int, error) GetPostsByIds(postIds []string) ([]*model.Post, error) - GetEditHistoryForPost(postId string) ([]*model.Post, error) + GetEditHistoryForPost(postID string) ([]*model.Post, error) GetPostsBatchForIndexing(startTime int64, startPostID string, limit int) ([]*model.PostForIndexing, error) PermanentDeleteBatchForRetentionPolicies(now, globalPolicyEndTime, limit int64, cursor model.RetentionPolicyCursor) (int64, model.RetentionPolicyCursor, error) PermanentDeleteBatch(endTime int64, limit int64) (int64, error) @@ -400,7 +400,7 @@ type PostStore interface { GetDirectPostParentsForExportAfter(limit int, afterID string, includeArchivedChannels bool) ([]*model.DirectPostForExport, error) SearchPostsForUser(rctx request.CTX, paramsList []*model.SearchParams, userID, teamID string, page, perPage int) (*model.PostSearchResults, error) GetOldestEntityCreationTime() (int64, error) - HasAutoResponsePostByUserSince(options model.GetPostsSinceOptions, userId string) (bool, error) + HasAutoResponsePostByUserSince(options model.GetPostsSinceOptions, userID string) (bool, error) GetPostsSinceForSync(options model.GetPostsSinceForSyncOptions, cursor model.GetPostsSinceForSyncCursor, limit int) ([]*model.Post, model.GetPostsSinceForSyncCursor, error) SetPostReminder(reminder *model.PostReminder) error GetPostReminders(now int64) ([]*model.PostReminder, error) @@ -433,8 +433,8 @@ type UserStore interface { GetProfilesInChannel(options *model.UserGetOptions) ([]*model.User, error) GetProfilesInChannelByStatus(options *model.UserGetOptions) ([]*model.User, error) GetProfilesInChannelByAdmin(options *model.UserGetOptions) ([]*model.User, error) - GetAllProfilesInChannel(rctx context.Context, channelID string, allowFromCache bool) (map[string]*model.User, error) - GetProfilesNotInChannel(teamID string, channelId string, groupConstrained bool, offset int, limit int, viewRestrictions *model.ViewUsersRestrictions) ([]*model.User, error) + GetAllProfilesInChannel(ctx context.Context, channelID string, allowFromCache bool) (map[string]*model.User, error) + GetProfilesNotInChannel(teamID string, channelID string, groupConstrained bool, offset int, limit int, viewRestrictions *model.ViewUsersRestrictions) ([]*model.User, error) GetProfilesWithoutTeam(options *model.UserGetOptions) ([]*model.User, error) GetProfilesByUsernames(usernames []string, viewRestrictions *model.ViewUsersRestrictions) ([]*model.User, error) GetAllProfiles(options *model.UserGetOptions) ([]*model.User, error) @@ -526,7 +526,7 @@ type SessionStore interface { type AuditStore interface { Save(audit *model.Audit) error - Get(user_id string, offset int, limit int) (model.Audits, error) + Get(userID string, offset int, limit int) (model.Audits, error) PermanentDeleteByUser(userID string) error } @@ -542,12 +542,12 @@ type ClusterDiscoveryStore interface { type RemoteClusterStore interface { Save(rc *model.RemoteCluster) (*model.RemoteCluster, error) Update(rc *model.RemoteCluster) (*model.RemoteCluster, error) - Delete(remoteClusterId string) (bool, error) - Get(remoteClusterId string, includeDeleted bool) (*model.RemoteCluster, error) + Delete(remoteClusterID string) (bool, error) + Get(remoteClusterID string, includeDeleted bool) (*model.RemoteCluster, error) GetByPluginID(pluginID string) (*model.RemoteCluster, error) GetAll(offset, limit int, filter model.RemoteClusterQueryFilter) ([]*model.RemoteCluster, error) - UpdateTopics(remoteClusterId string, topics string) (*model.RemoteCluster, error) - SetLastPingAt(remoteClusterId string) error + UpdateTopics(remoteClusterID string, topics string) (*model.RemoteCluster, error) + SetLastPingAt(remoteClusterID string) error } type ComplianceStore interface { @@ -570,15 +570,15 @@ type OAuthStore interface { SaveAuthData(authData *model.AuthData) (*model.AuthData, error) GetAuthData(code string) (*model.AuthData, error) RemoveAuthData(code string) error - RemoveAuthDataByClientId(clientId string, userId string) error - RemoveAuthDataByUserId(userId string) error + RemoveAuthDataByClientId(clientID string, userID string) error + RemoveAuthDataByUserId(userID string) error PermanentDeleteAuthDataByUser(userID string) error SaveAccessData(accessData *model.AccessData) (*model.AccessData, error) UpdateAccessData(accessData *model.AccessData) (*model.AccessData, error) GetAccessData(token string) (*model.AccessData, error) - GetAccessDataByUserForApp(userID, clientId string) ([]*model.AccessData, error) + GetAccessDataByUserForApp(userID, clientID string) ([]*model.AccessData, error) GetAccessDataByRefreshToken(token string) (*model.AccessData, error) - GetPreviousAccessData(userID, clientId string) (*model.AccessData, error) + GetPreviousAccessData(userID, clientID string) (*model.AccessData, error) RemoveAccessData(token string) error RemoveAllAccessData() error } @@ -684,9 +684,9 @@ type TokenStore interface { type DesktopTokensStore interface { GetUserId(token string, minCreatedAt int64) (*string, error) - Insert(token string, createAt int64, userId string) error + Insert(token string, createAt int64, userID string) error Delete(token string) error - DeleteByUserId(userId string) error + DeleteByUserId(userID string) error DeleteOlderThan(minCreatedAt int64) error } @@ -749,9 +749,9 @@ type ReactionStore interface { Save(reaction *model.Reaction) (*model.Reaction, error) Delete(reaction *model.Reaction) (*model.Reaction, error) GetForPost(postID string, allowFromCache bool) ([]*model.Reaction, error) - GetForPostSince(postId string, since int64, excludeRemoteId string, inclDeleted bool) ([]*model.Reaction, error) - GetUniqueCountForPost(postId string) (int, error) - ExistsOnPost(postId string, emojiName string) (bool, error) + GetForPostSince(postID string, since int64, excludeRemoteID string, inclDeleted bool) ([]*model.Reaction, error) + GetUniqueCountForPost(postID string) (int, error) + ExistsOnPost(postID string, emojiName string) (bool, error) DeleteAllWithEmojiName(emojiName string) error BulkGetForPosts(postIds []string) ([]*model.Reaction, error) GetSingle(userID, postID, remoteID, emojiName string) (*model.Reaction, error) @@ -856,7 +856,7 @@ type ProductNoticesStore interface { type UserTermsOfServiceStore interface { GetByUser(userID string) (*model.UserTermsOfService, error) Save(userTermsOfService *model.UserTermsOfService) (*model.UserTermsOfService, error) - Delete(userID, termsOfServiceId string) error + Delete(userID, termsOfServiceID string) error } type GroupStore interface { @@ -972,31 +972,31 @@ type LinkMetadataStore interface { type NotifyAdminStore interface { Save(data *model.NotifyAdminData) (*model.NotifyAdminData, error) - GetDataByUserIdAndFeature(userId string, feature model.MattermostFeature) ([]*model.NotifyAdminData, error) + GetDataByUserIdAndFeature(userID string, feature model.MattermostFeature) ([]*model.NotifyAdminData, error) Get(trial bool) ([]*model.NotifyAdminData, error) DeleteBefore(trial bool, now int64) error - Update(userId string, requiredPlan string, requiredFeature model.MattermostFeature, now int64) error + Update(userID string, requiredPlan string, requiredFeature model.MattermostFeature, now int64) error } type SharedChannelStore interface { Save(sc *model.SharedChannel) (*model.SharedChannel, error) - Get(channelId string) (*model.SharedChannel, error) + Get(channelID string) (*model.SharedChannel, error) HasChannel(channelID string) (bool, error) GetAll(offset, limit int, opts model.SharedChannelFilterOpts) ([]*model.SharedChannel, error) GetAllCount(opts model.SharedChannelFilterOpts) (int64, error) Update(sc *model.SharedChannel) (*model.SharedChannel, error) - Delete(channelId string) (bool, error) + Delete(channelID string) (bool, error) SaveRemote(remote *model.SharedChannelRemote) (*model.SharedChannelRemote, error) UpdateRemote(remote *model.SharedChannelRemote) (*model.SharedChannelRemote, error) GetRemote(id string) (*model.SharedChannelRemote, error) - HasRemote(channelID string, remoteId string) (bool, error) - GetRemoteForUser(remoteId string, userId string) (*model.RemoteCluster, error) - GetRemoteByIds(channelId string, remoteId string) (*model.SharedChannelRemote, error) + HasRemote(channelID string, remoteID string) (bool, error) + GetRemoteForUser(remoteID string, userID string) (*model.RemoteCluster, error) + GetRemoteByIds(channelID string, remoteID string) (*model.SharedChannelRemote, error) GetRemotes(offset, limit int, opts model.SharedChannelRemoteFilterOpts) ([]*model.SharedChannelRemote, error) UpdateRemoteCursor(id string, cursor model.GetPostsSinceForSyncCursor) error - DeleteRemote(remoteId string) (bool, error) - GetRemotesStatus(channelId string) ([]*model.SharedChannelRemoteStatus, error) + DeleteRemote(remoteID string) (bool, error) + GetRemotesStatus(channelID string) ([]*model.SharedChannelRemoteStatus, error) SaveUser(remote *model.SharedChannelUser) (*model.SharedChannelUser, error) GetSingleUser(userID string, channelID string, remoteID string) (*model.SharedChannelUser, error) @@ -1006,12 +1006,12 @@ type SharedChannelStore interface { SaveAttachment(remote *model.SharedChannelAttachment) (*model.SharedChannelAttachment, error) UpsertAttachment(remote *model.SharedChannelAttachment) (string, error) - GetAttachment(fileId string, remoteId string) (*model.SharedChannelAttachment, error) + GetAttachment(fileID string, remoteID string) (*model.SharedChannelAttachment, error) UpdateAttachmentLastSyncAt(id string, syncTime int64) error } type PostPriorityStore interface { - GetForPost(postId string) (*model.PostPriority, error) + GetForPost(postID string) (*model.PostPriority, error) GetForPosts(ids []string) ([]*model.PostPriority, error) } @@ -1021,9 +1021,9 @@ type DraftStore interface { Delete(userID, channelID, rootID string) error DeleteDraftsAssociatedWithPost(channelID, rootID string) error GetDraftsForUser(userID, teamID string) ([]*model.Draft, error) - GetLastCreateAtAndUserIdValuesForEmptyDraftsMigration(createAt int64, userId string) (int64, string, error) - DeleteEmptyDraftsByCreateAtAndUserId(createAt int64, userId string) error - DeleteOrphanDraftsByCreateAtAndUserId(createAt int64, userId string) error + GetLastCreateAtAndUserIdValuesForEmptyDraftsMigration(createAt int64, userID string) (int64, string, error) + DeleteEmptyDraftsByCreateAtAndUserId(createAt int64, userID string) error + DeleteOrphanDraftsByCreateAtAndUserId(createAt int64, userID string) error } type PostAcknowledgementStore interface { @@ -1044,13 +1044,13 @@ type PostPersistentNotificationStore interface { DeleteByTeam(teamIds []string) error } type ChannelBookmarkStore interface { - ErrorIfBookmarkFileInfoAlreadyAttached(fileId string) error + ErrorIfBookmarkFileInfoAlreadyAttached(fileID string) error Get(Id string, includeDeleted bool) (b *model.ChannelBookmarkWithFileInfo, err error) Save(bookmark *model.ChannelBookmark, increaseSortOrder bool) (b *model.ChannelBookmarkWithFileInfo, err error) Update(bookmark *model.ChannelBookmark) error - UpdateSortOrder(bookmarkId, channelId string, newIndex int64) ([]*model.ChannelBookmarkWithFileInfo, error) - Delete(bookmarkId string, deleteFile bool) error - GetBookmarksForChannelSince(channelId string, since int64) ([]*model.ChannelBookmarkWithFileInfo, error) + UpdateSortOrder(bookmarkID, channelID string, newIndex int64) ([]*model.ChannelBookmarkWithFileInfo, error) + Delete(bookmarkID string, deleteFile bool) error + GetBookmarksForChannelSince(channelID string, since int64) ([]*model.ChannelBookmarkWithFileInfo, error) } // ChannelSearchOpts contains options for searching channels. @@ -1058,7 +1058,7 @@ type ChannelBookmarkStore interface { // NotAssociatedToGroup will exclude channels that have associated, active GroupChannels records. // IncludeDeleted will include channel records where DeleteAt != 0. // ExcludeChannelNames will exclude channels from the results by name. -// IncludeSearchById will include searching matches against channel IDs in the results +// IncludeSearchByID will include searching matches against channel IDs in the results // Paginate whether to paginate the results. // Page page requested, if results are paginated. // PerPage number of results per page, if paginated. @@ -1075,7 +1075,7 @@ type ChannelSearchOpts struct { ExcludePolicyConstrained bool IncludePolicyID bool IncludeTeamInfo bool - IncludeSearchById bool + IncludeSearchByID bool ExcludeRemote bool CountOnly bool Public bool @@ -1125,7 +1125,7 @@ type ThreadMembershipOpts struct { // PostReminderMetadata contains some info needed to send // the reminder message to the user. type PostReminderMetadata struct { - ChannelId string + ChannelID string TeamName string UserLocale string Username string diff --git a/server/channels/store/storetest/bot_store.go b/server/channels/store/storetest/bot_store.go index 999747acc8d57..b225326b90ac0 100644 --- a/server/channels/store/storetest/bot_store.go +++ b/server/channels/store/storetest/bot_store.go @@ -119,13 +119,13 @@ func testBotStoreGet(t *testing.T, rctx request.CTX, ss store.Store, s SqlStore) } func testBotStoreGetAll(t *testing.T, rctx request.CTX, ss store.Store, s SqlStore) { - OwnerId1 := model.NewId() - OwnerId2 := model.NewId() + OwnerID1 := model.NewId() + OwnerID2 := model.NewId() deletedBot, _ := makeBotWithUser(t, rctx, ss, &model.Bot{ Username: "deleted_bot", Description: "A deleted bot", - OwnerId: OwnerId1, + OwnerId: OwnerID1, LastIconUpdate: model.GetMillis(), }) deletedBot.DeleteAt = 1 @@ -137,7 +137,7 @@ func testBotStoreGetAll(t *testing.T, rctx request.CTX, ss store.Store, s SqlSto permanentlyDeletedBot, _ := makeBotWithUser(t, rctx, ss, &model.Bot{ Username: "permanently_deleted_bot", Description: "A permanently deleted bot", - OwnerId: OwnerId1, + OwnerId: OwnerID1, LastIconUpdate: model.GetMillis(), DeleteAt: 0, }) @@ -147,7 +147,7 @@ func testBotStoreGetAll(t *testing.T, rctx request.CTX, ss store.Store, s SqlSto b1, _ := makeBotWithUser(t, rctx, ss, &model.Bot{ Username: "b1", Description: "The first bot", - OwnerId: OwnerId1, + OwnerId: OwnerID1, LastIconUpdate: model.GetMillis(), }) defer func() { require.NoError(t, ss.Bot().PermanentDelete(b1.UserId)) }() @@ -156,7 +156,7 @@ func testBotStoreGetAll(t *testing.T, rctx request.CTX, ss store.Store, s SqlSto b2, _ := makeBotWithUser(t, rctx, ss, &model.Bot{ Username: "b2", Description: "The second bot", - OwnerId: OwnerId1, + OwnerId: OwnerID1, LastIconUpdate: 0, }) defer func() { require.NoError(t, ss.Bot().PermanentDelete(b2.UserId)) }() @@ -178,7 +178,7 @@ func testBotStoreGetAll(t *testing.T, rctx request.CTX, ss store.Store, s SqlSto b3, _ := makeBotWithUser(t, rctx, ss, &model.Bot{ Username: "b3", Description: "The third bot", - OwnerId: OwnerId1, + OwnerId: OwnerID1, }) defer func() { require.NoError(t, ss.Bot().PermanentDelete(b3.UserId)) }() defer func() { require.NoError(t, ss.User().PermanentDelete(rctx, b3.UserId)) }() @@ -186,7 +186,7 @@ func testBotStoreGetAll(t *testing.T, rctx request.CTX, ss store.Store, s SqlSto b4, _ := makeBotWithUser(t, rctx, ss, &model.Bot{ Username: "b4", Description: "The fourth bot", - OwnerId: OwnerId2, + OwnerId: OwnerID2, }) defer func() { require.NoError(t, ss.Bot().PermanentDelete(b4.UserId)) }() defer func() { require.NoError(t, ss.User().PermanentDelete(rctx, b4.UserId)) }() @@ -274,7 +274,7 @@ func testBotStoreGetAll(t *testing.T, rctx request.CTX, ss store.Store, s SqlSto }) t.Run("get offset=0, limit=10, creator id 1", func(t *testing.T) { - bots, err := ss.Bot().GetAll(&model.BotGetOptions{Page: 0, PerPage: 10, OwnerId: OwnerId1}) + bots, err := ss.Bot().GetAll(&model.BotGetOptions{Page: 0, PerPage: 10, OwnerId: OwnerID1}) require.NoError(t, err) require.Equal(t, []*model.Bot{ b1, @@ -284,7 +284,7 @@ func testBotStoreGetAll(t *testing.T, rctx request.CTX, ss store.Store, s SqlSto }) t.Run("get offset=0, limit=10, creator id 2", func(t *testing.T) { - bots, err := ss.Bot().GetAll(&model.BotGetOptions{Page: 0, PerPage: 10, OwnerId: OwnerId2}) + bots, err := ss.Bot().GetAll(&model.BotGetOptions{Page: 0, PerPage: 10, OwnerId: OwnerID2}) require.NoError(t, err) require.Equal(t, []*model.Bot{ b4, @@ -292,7 +292,7 @@ func testBotStoreGetAll(t *testing.T, rctx request.CTX, ss store.Store, s SqlSto }) t.Run("get offset=0, limit=10, include deleted, creator id 1", func(t *testing.T) { - bots, err := ss.Bot().GetAll(&model.BotGetOptions{Page: 0, PerPage: 10, IncludeDeleted: true, OwnerId: OwnerId1}) + bots, err := ss.Bot().GetAll(&model.BotGetOptions{Page: 0, PerPage: 10, IncludeDeleted: true, OwnerId: OwnerID1}) require.NoError(t, err) require.Equal(t, []*model.Bot{ deletedBot, @@ -303,7 +303,7 @@ func testBotStoreGetAll(t *testing.T, rctx request.CTX, ss store.Store, s SqlSto }) t.Run("get offset=0, limit=10, include deleted, creator id 2", func(t *testing.T) { - bots, err := ss.Bot().GetAll(&model.BotGetOptions{Page: 0, PerPage: 10, IncludeDeleted: true, OwnerId: OwnerId2}) + bots, err := ss.Bot().GetAll(&model.BotGetOptions{Page: 0, PerPage: 10, IncludeDeleted: true, OwnerId: OwnerID2}) require.NoError(t, err) require.Equal(t, []*model.Bot{ b4, diff --git a/server/channels/store/storetest/channel_bookmark.go b/server/channels/store/storetest/channel_bookmark.go index 221e74e61a000..2638e83f7c33b 100644 --- a/server/channels/store/storetest/channel_bookmark.go +++ b/server/channels/store/storetest/channel_bookmark.go @@ -33,12 +33,12 @@ func TestChannelBookmarkStore(t *testing.T, rctx request.CTX, ss store.Store, s } func testSaveChannelBookmark(t *testing.T, rctx request.CTX, ss store.Store) { - channelId := model.NewId() - userId := model.NewId() + channelID := model.NewId() + userID := model.NewId() bookmark1 := &model.ChannelBookmark{ - ChannelId: channelId, - OwnerId: userId, + ChannelId: channelID, + OwnerId: userID, DisplayName: "Link bookmark test", LinkUrl: "https://mattermost.com", Type: model.ChannelBookmarkLink, @@ -61,8 +61,8 @@ func testSaveChannelBookmark(t *testing.T, rctx request.CTX, ss store.Store) { } bookmark2 := &model.ChannelBookmark{ - ChannelId: channelId, - OwnerId: userId, + ChannelId: channelID, + OwnerId: userID, DisplayName: "file bookmark test", FileId: file.Id, Type: model.ChannelBookmarkFile, @@ -70,8 +70,8 @@ func testSaveChannelBookmark(t *testing.T, rctx request.CTX, ss store.Store) { } bookmark3 := &model.ChannelBookmark{ - ChannelId: channelId, - OwnerId: userId, + ChannelId: channelID, + OwnerId: userID, DisplayName: "file already attached", FileId: file.Id, Type: model.ChannelBookmarkFile, @@ -80,7 +80,7 @@ func testSaveChannelBookmark(t *testing.T, rctx request.CTX, ss store.Store) { file2 := &model.FileInfo{ Id: model.NewId(), - CreatorId: userId, + CreatorId: userID, Path: "somepath", ThumbnailPath: "thumbpath", PreviewPath: "prevPath", @@ -94,8 +94,8 @@ func testSaveChannelBookmark(t *testing.T, rctx request.CTX, ss store.Store) { } bookmark4 := &model.ChannelBookmark{ - ChannelId: channelId, - OwnerId: userId, + ChannelId: channelID, + OwnerId: userID, DisplayName: "file already attached to a post", FileId: file2.Id, Type: model.ChannelBookmarkFile, @@ -110,7 +110,7 @@ func testSaveChannelBookmark(t *testing.T, rctx request.CTX, ss store.Store) { require.NoError(t, err) defer ss.FileInfo().PermanentDelete(rctx, file2.Id) - err = ss.FileInfo().AttachToPost(rctx, file2.Id, model.NewId(), channelId, userId) + err = ss.FileInfo().AttachToPost(rctx, file2.Id, model.NewId(), channelID, userID) require.NoError(t, err) t.Run("save bookmarks", func(t *testing.T) { @@ -128,7 +128,7 @@ func testSaveChannelBookmark(t *testing.T, rctx request.CTX, ss store.Store) { assert.Equal(t, bookmark2.ChannelId, bookmarkResp.ChannelId) assert.NotNil(t, bookmarkResp.FileInfo) - bookmarks, err := ss.ChannelBookmark().GetBookmarksForChannelSince(channelId, 0) + bookmarks, err := ss.ChannelBookmark().GetBookmarksForChannelSince(channelID, 0) assert.NoError(t, err) assert.Len(t, bookmarks, 2) @@ -141,12 +141,12 @@ func testSaveChannelBookmark(t *testing.T, rctx request.CTX, ss store.Store) { } func testUpdateChannelBookmark(t *testing.T, rctx request.CTX, ss store.Store) { - channelId := model.NewId() - userId := model.NewId() + channelID := model.NewId() + userID := model.NewId() bookmark1 := &model.ChannelBookmark{ - ChannelId: channelId, - OwnerId: userId, + ChannelId: channelID, + OwnerId: userID, DisplayName: "Link bookmark test", LinkUrl: "https://mattermost.com", Type: model.ChannelBookmarkLink, @@ -167,7 +167,7 @@ func testUpdateChannelBookmark(t *testing.T, rctx request.CTX, ss store.Store) { err = ss.ChannelBookmark().Update(bookmark2.Clone()) assert.NoError(t, err) - bookmarks, err := ss.ChannelBookmark().GetBookmarksForChannelSince(channelId, now) + bookmarks, err := ss.ChannelBookmark().GetBookmarksForChannelSince(channelID, now) assert.NoError(t, err) assert.Len(t, bookmarks, 1) @@ -190,12 +190,12 @@ func testUpdateChannelBookmark(t *testing.T, rctx request.CTX, ss store.Store) { } func testUpdateSortOrderChannelBookmark(t *testing.T, rctx request.CTX, ss store.Store) { - channelId := model.NewId() - userId := model.NewId() + channelID := model.NewId() + userID := model.NewId() bookmark0 := &model.ChannelBookmark{ - ChannelId: channelId, - OwnerId: userId, + ChannelId: channelID, + OwnerId: userID, DisplayName: "Bookmark 0", LinkUrl: "https://mattermost.com", Type: model.ChannelBookmarkLink, @@ -218,8 +218,8 @@ func testUpdateSortOrderChannelBookmark(t *testing.T, rctx request.CTX, ss store } bookmark1 := &model.ChannelBookmark{ - ChannelId: channelId, - OwnerId: userId, + ChannelId: channelID, + OwnerId: userID, DisplayName: "Bookmark 1", FileId: file.Id, Type: model.ChannelBookmarkFile, @@ -231,24 +231,24 @@ func testUpdateSortOrderChannelBookmark(t *testing.T, rctx request.CTX, ss store defer ss.FileInfo().PermanentDelete(rctx, file.Id) bookmark2 := &model.ChannelBookmark{ - ChannelId: channelId, - OwnerId: userId, + ChannelId: channelID, + OwnerId: userID, DisplayName: "Bookmark 2", LinkUrl: "https://mattermost.com", Type: model.ChannelBookmarkLink, } bookmark3 := &model.ChannelBookmark{ - ChannelId: channelId, - OwnerId: userId, + ChannelId: channelID, + OwnerId: userID, DisplayName: "Bookmark 3", LinkUrl: "https://mattermost.com", Type: model.ChannelBookmarkLink, } bookmark4 := &model.ChannelBookmark{ - ChannelId: channelId, - OwnerId: userId, + ChannelId: channelID, + OwnerId: userID, DisplayName: "Bookmark 4", LinkUrl: "https://mattermost.com", Type: model.ChannelBookmarkLink, @@ -279,7 +279,7 @@ func testUpdateSortOrderChannelBookmark(t *testing.T, rctx request.CTX, ss store bookmark4 = bookmarkResp.ChannelBookmark.Clone() t.Run("change order of bookmarks first to last", func(t *testing.T) { - bookmarks, sortError := ss.ChannelBookmark().UpdateSortOrder(bookmark0.Id, channelId, 4) + bookmarks, sortError := ss.ChannelBookmark().UpdateSortOrder(bookmark0.Id, channelID, 4) assert.NoError(t, sortError) assert.Equal(t, find_bookmark(bookmarks, bookmark1.Id).SortOrder, int64(0)) @@ -290,7 +290,7 @@ func testUpdateSortOrderChannelBookmark(t *testing.T, rctx request.CTX, ss store }) t.Run("change order of bookmarks last to first", func(t *testing.T) { - bookmarks, sortError := ss.ChannelBookmark().UpdateSortOrder(bookmark0.Id, channelId, 0) + bookmarks, sortError := ss.ChannelBookmark().UpdateSortOrder(bookmark0.Id, channelID, 0) assert.NoError(t, sortError) assert.Equal(t, find_bookmark(bookmarks, bookmark0.Id).SortOrder, int64(0)) @@ -301,7 +301,7 @@ func testUpdateSortOrderChannelBookmark(t *testing.T, rctx request.CTX, ss store }) t.Run("change order of bookmarks first to third", func(t *testing.T) { - bookmarks, sortError := ss.ChannelBookmark().UpdateSortOrder(bookmark0.Id, channelId, 2) + bookmarks, sortError := ss.ChannelBookmark().UpdateSortOrder(bookmark0.Id, channelID, 2) assert.NoError(t, sortError) assert.Equal(t, find_bookmark(bookmarks, bookmark1.Id).SortOrder, int64(0)) @@ -311,11 +311,11 @@ func testUpdateSortOrderChannelBookmark(t *testing.T, rctx request.CTX, ss store assert.Equal(t, find_bookmark(bookmarks, bookmark4.Id).SortOrder, int64(4)) // now reset order - ss.ChannelBookmark().UpdateSortOrder(bookmark0.Id, channelId, 0) + ss.ChannelBookmark().UpdateSortOrder(bookmark0.Id, channelID, 0) }) t.Run("change order of bookmarks second to third", func(t *testing.T) { - bookmarks, sortError := ss.ChannelBookmark().UpdateSortOrder(bookmark1.Id, channelId, 2) + bookmarks, sortError := ss.ChannelBookmark().UpdateSortOrder(bookmark1.Id, channelID, 2) assert.NoError(t, sortError) assert.Equal(t, find_bookmark(bookmarks, bookmark0.Id).SortOrder, int64(0)) @@ -326,7 +326,7 @@ func testUpdateSortOrderChannelBookmark(t *testing.T, rctx request.CTX, ss store }) t.Run("change order of bookmarks third to second", func(t *testing.T) { - bookmarks, sortError := ss.ChannelBookmark().UpdateSortOrder(bookmark1.Id, channelId, 1) + bookmarks, sortError := ss.ChannelBookmark().UpdateSortOrder(bookmark1.Id, channelID, 1) assert.NoError(t, sortError) assert.Equal(t, find_bookmark(bookmarks, bookmark0.Id).SortOrder, int64(0)) @@ -337,7 +337,7 @@ func testUpdateSortOrderChannelBookmark(t *testing.T, rctx request.CTX, ss store }) t.Run("change order of bookmarks last to previous last", func(t *testing.T) { - bookmarks, sortError := ss.ChannelBookmark().UpdateSortOrder(bookmark4.Id, channelId, 3) + bookmarks, sortError := ss.ChannelBookmark().UpdateSortOrder(bookmark4.Id, channelID, 3) assert.NoError(t, sortError) assert.Equal(t, find_bookmark(bookmarks, bookmark0.Id).SortOrder, int64(0)) @@ -348,7 +348,7 @@ func testUpdateSortOrderChannelBookmark(t *testing.T, rctx request.CTX, ss store }) t.Run("change order of bookmarks last to second", func(t *testing.T) { - bookmarks, sortError := ss.ChannelBookmark().UpdateSortOrder(bookmark3.Id, channelId, 1) + bookmarks, sortError := ss.ChannelBookmark().UpdateSortOrder(bookmark3.Id, channelID, 1) assert.NoError(t, sortError) assert.Equal(t, find_bookmark(bookmarks, bookmark0.Id).SortOrder, int64(0)) @@ -360,16 +360,16 @@ func testUpdateSortOrderChannelBookmark(t *testing.T, rctx request.CTX, ss store t.Run("change order of bookmarks error when new index is out of bounds", func(t *testing.T) { var iiErr *store.ErrInvalidInput - _, err = ss.ChannelBookmark().UpdateSortOrder(bookmark3.Id, channelId, -1) + _, err = ss.ChannelBookmark().UpdateSortOrder(bookmark3.Id, channelID, -1) assert.Error(t, err) assert.ErrorAs(t, err, &iiErr) - _, err = ss.ChannelBookmark().UpdateSortOrder(bookmark3.Id, channelId, 5) + _, err = ss.ChannelBookmark().UpdateSortOrder(bookmark3.Id, channelID, 5) assert.Error(t, err) assert.ErrorAs(t, err, &iiErr) }) t.Run("change order of bookmarks error when bookmark not found", func(t *testing.T) { - _, err = ss.ChannelBookmark().UpdateSortOrder(model.NewId(), channelId, 0) + _, err = ss.ChannelBookmark().UpdateSortOrder(model.NewId(), channelID, 0) assert.Error(t, err) var nfErr *store.ErrNotFound assert.ErrorAs(t, err, &nfErr) @@ -377,12 +377,12 @@ func testUpdateSortOrderChannelBookmark(t *testing.T, rctx request.CTX, ss store } func testDeleteChannelBookmark(t *testing.T, rctx request.CTX, ss store.Store) { - channelId := model.NewId() - userId := model.NewId() + channelID := model.NewId() + userID := model.NewId() bookmark1 := &model.ChannelBookmark{ - ChannelId: channelId, - OwnerId: userId, + ChannelId: channelID, + OwnerId: userID, DisplayName: "Link bookmark test", LinkUrl: "https://mattermost.com", Type: model.ChannelBookmarkLink, @@ -405,8 +405,8 @@ func testDeleteChannelBookmark(t *testing.T, rctx request.CTX, ss store.Store) { } bookmark2 := &model.ChannelBookmark{ - ChannelId: channelId, - OwnerId: userId, + ChannelId: channelID, + OwnerId: userID, DisplayName: "file bookmark test", FileId: file.Id, Type: model.ChannelBookmarkFile, @@ -439,7 +439,7 @@ func testDeleteChannelBookmark(t *testing.T, rctx request.CTX, ss store.Store) { var nfErr *store.ErrNotFound assert.ErrorAs(t, err, &nfErr) - bookmarks, err := ss.ChannelBookmark().GetBookmarksForChannelSince(channelId, now) + bookmarks, err := ss.ChannelBookmark().GetBookmarksForChannelSince(channelID, now) assert.NoError(t, err) assert.Len(t, bookmarks, 2) // we have two as the deleted record also gets returned for sync'ing purposes @@ -450,12 +450,12 @@ func testDeleteChannelBookmark(t *testing.T, rctx request.CTX, ss store.Store) { } func testGetChannelBookmark(t *testing.T, rctx request.CTX, ss store.Store) { - channelId := model.NewId() - userId := model.NewId() + channelID := model.NewId() + userID := model.NewId() bookmark1 := &model.ChannelBookmark{ - ChannelId: channelId, - OwnerId: userId, + ChannelId: channelID, + OwnerId: userID, DisplayName: "Link bookmark test", LinkUrl: "https://mattermost.com", Type: model.ChannelBookmarkLink, diff --git a/server/channels/store/storetest/channel_member_history_store.go b/server/channels/store/storetest/channel_member_history_store.go index 4d9f7dec66bd3..1c5d44c86a262 100644 --- a/server/channels/store/storetest/channel_member_history_store.go +++ b/server/channels/store/storetest/channel_member_history_store.go @@ -31,7 +31,7 @@ func testLogJoinEvent(t *testing.T, rctx request.CTX, ss store.Store) { ch := model.Channel{ TeamId: model.NewId(), DisplayName: "Display " + model.NewId(), - Name: NewTestId(), + Name: NewTestID(), Type: model.ChannelTypeOpen, } channel, err := ss.Channel().Save(rctx, &ch, -1) @@ -57,7 +57,7 @@ func testLogLeaveEvent(t *testing.T, rctx request.CTX, ss store.Store) { ch := model.Channel{ TeamId: model.NewId(), DisplayName: "Display " + model.NewId(), - Name: NewTestId(), + Name: NewTestID(), Type: model.ChannelTypeOpen, } channel, err := ss.Channel().Save(rctx, &ch, -1) @@ -86,7 +86,7 @@ func testGetUsersInChannelAtChannelMemberHistory(t *testing.T, rctx request.CTX, ch := &model.Channel{ TeamId: model.NewId(), DisplayName: "Display " + model.NewId(), - Name: NewTestId(), + Name: NewTestID(), Type: model.ChannelTypeOpen, } channel, err := ss.Channel().Save(rctx, ch, -1) @@ -182,7 +182,7 @@ func testGetUsersInChannelAtChannelMembers(t *testing.T, rctx request.CTX, ss st channel := &model.Channel{ TeamId: model.NewId(), DisplayName: "Display " + model.NewId(), - Name: NewTestId(), + Name: NewTestID(), Type: model.ChannelTypeOpen, } channel, err := ss.Channel().Save(rctx, channel, -1) @@ -294,7 +294,7 @@ func testPermanentDeleteBatch(t *testing.T, rctx request.CTX, ss store.Store) { channel := &model.Channel{ TeamId: model.NewId(), DisplayName: "Display " + model.NewId(), - Name: NewTestId(), + Name: NewTestID(), Type: model.ChannelTypeOpen, } channel, err := ss.Channel().Save(rctx, channel, -1) diff --git a/server/channels/store/storetest/channel_store.go b/server/channels/store/storetest/channel_store.go index 39c5987d39a2a..c21ace883ba98 100644 --- a/server/channels/store/storetest/channel_store.go +++ b/server/channels/store/storetest/channel_store.go @@ -156,12 +156,12 @@ func TestChannelStore(t *testing.T, rctx request.CTX, ss store.Store, s SqlStore } func testChannelStoreSave(t *testing.T, rctx request.CTX, ss store.Store) { - teamId := model.NewId() + teamID := model.NewId() o1 := model.Channel{} - o1.TeamId = teamId + o1.TeamId = teamID o1.DisplayName = "Name" - o1.Name = NewTestId() + o1.Name = NewTestID() o1.Type = model.ChannelTypeOpen _, nErr := ss.Channel().Save(rctx, &o1, -1) @@ -175,15 +175,15 @@ func testChannelStoreSave(t *testing.T, rctx request.CTX, ss store.Store) { require.Error(t, nErr, "should be unique name") o1.Id = "" - o1.Name = model.GetDMNameFromIds(NewTestId(), NewTestId()) + o1.Name = model.GetDMNameFromIds(NewTestID(), NewTestID()) o1.Type = model.ChannelTypeDirect _, nErr = ss.Channel().Save(rctx, &o1, -1) require.Error(t, nErr, "should not be able to save direct channel") o1 = model.Channel{} - o1.TeamId = teamId + o1.TeamId = teamID o1.DisplayName = "Name" - o1.Name = NewTestId() + o1.Name = NewTestID() o1.Type = model.ChannelTypeOpen _, nErr = ss.Channel().Save(rctx, &o1, -1) @@ -207,12 +207,12 @@ func testChannelStoreSave(t *testing.T, rctx request.CTX, ss store.Store) { } func testChannelStoreSaveDirectChannel(t *testing.T, rctx request.CTX, ss store.Store, s SqlStore) { - teamId := model.NewId() + teamID := model.NewId() o1 := model.Channel{} - o1.TeamId = teamId + o1.TeamId = teamID o1.DisplayName = "Name" - o1.Name = model.GetDMNameFromIds(NewTestId(), NewTestId()) + o1.Name = model.GetDMNameFromIds(NewTestID(), NewTestID()) o1.Type = model.ChannelTypeDirect u1 := &model.User{} @@ -271,7 +271,7 @@ func testChannelStoreSaveDirectChannel(t *testing.T, rctx request.CTX, ss store. // Attempt to save a non-direct channel o1.Id = "" - o1.Name = NewTestId() + o1.Name = NewTestID() o1.Type = model.ChannelTypeOpen _, nErr = ss.Channel().SaveDirectChannel(rctx, &o1, &m1, &m2) require.Error(t, nErr, "Should not be able to save non-direct channel") @@ -279,7 +279,7 @@ func testChannelStoreSaveDirectChannel(t *testing.T, rctx request.CTX, ss store. // Save yourself Direct Message o1.Id = "" o1.DisplayName = "Myself" - o1.Name = model.GetDMNameFromIds(NewTestId(), NewTestId()) + o1.Name = model.GetDMNameFromIds(NewTestID(), NewTestID()) o1.Type = model.ChannelTypeDirect _, nErr = ss.Channel().SaveDirectChannel(rctx, &o1, &m1, &m1) require.NoError(t, nErr, "couldn't save direct channel", nErr) @@ -329,7 +329,7 @@ func testChannelStoreUpdate(t *testing.T, rctx request.CTX, ss store.Store) { o1 := model.Channel{} o1.TeamId = model.NewId() o1.DisplayName = "Name" - o1.Name = NewTestId() + o1.Name = NewTestID() o1.Type = model.ChannelTypeOpen _, nErr := ss.Channel().Save(rctx, &o1, -1) @@ -338,7 +338,7 @@ func testChannelStoreUpdate(t *testing.T, rctx request.CTX, ss store.Store) { o2 := model.Channel{} o2.TeamId = o1.TeamId o2.DisplayName = "Name" - o2.Name = NewTestId() + o2.Name = NewTestID() o2.Type = model.ChannelTypeOpen _, nErr = ss.Channel().Save(rctx, &o2, -1) @@ -370,12 +370,12 @@ func testChannelStoreUpdate(t *testing.T, rctx request.CTX, ss store.Store) { } func testGetChannelUnread(t *testing.T, rctx request.CTX, ss store.Store) { - teamId1 := model.NewId() - teamId2 := model.NewId() + teamID1 := model.NewId() + teamID2 := model.NewId() uid := model.NewId() - m1 := &model.TeamMember{TeamId: teamId1, UserId: uid} - m2 := &model.TeamMember{TeamId: teamId2, UserId: uid} + m1 := &model.TeamMember{TeamId: teamID1, UserId: uid} + m2 := &model.TeamMember{TeamId: teamID2, UserId: uid} _, nErr := ss.Team().SaveMember(rctx, m1, -1) require.NoError(t, nErr) _, nErr = ss.Team().SaveMember(rctx, m2, -1) @@ -405,7 +405,7 @@ func testGetChannelUnread(t *testing.T, rctx request.CTX, ss store.Store) { require.NoError(t, nErr, nErr) require.Equal(t, c1.Id, ch.ChannelId, "Wrong channel id") - require.Equal(t, teamId1, ch.TeamId, "Wrong team id for channel 1") + require.Equal(t, teamID1, ch.TeamId, "Wrong team id for channel 1") require.NotNil(t, ch.NotifyProps, "wrong props for channel 1") require.EqualValues(t, 0, ch.MentionCount, "wrong MentionCount for channel 1") require.EqualValues(t, 10, ch.MsgCount, "wrong MsgCount for channel 1") @@ -415,7 +415,7 @@ func testGetChannelUnread(t *testing.T, rctx request.CTX, ss store.Store) { require.NoError(t, nErr, nErr) require.Equal(t, c2.Id, ch2.ChannelId, "Wrong channel id") - require.Equal(t, teamId2, ch2.TeamId, "Wrong team id") + require.Equal(t, teamID2, ch2.TeamId, "Wrong team id") require.EqualValues(t, 5, ch2.MentionCount, "wrong MentionCount for channel 2") require.EqualValues(t, 1, ch2.MentionCountRoot, "wrong MentionCountRoot for channel 2") require.EqualValues(t, 10, ch2.MsgCount, "wrong MsgCount for channel 2") @@ -425,7 +425,7 @@ func testChannelStoreGet(t *testing.T, rctx request.CTX, ss store.Store, s SqlSt o1 := model.Channel{} o1.TeamId = model.NewId() o1.DisplayName = "Name" - o1.Name = NewTestId() + o1.Name = NewTestID() o1.Type = model.ChannelTypeOpen _, nErr := ss.Channel().Save(rctx, &o1, -1) require.NoError(t, nErr) @@ -456,7 +456,7 @@ func testChannelStoreGet(t *testing.T, rctx request.CTX, ss store.Store, s SqlSt o2 := model.Channel{} o2.TeamId = model.NewId() o2.DisplayName = "Direct Name" - o2.Name = model.GetDMNameFromIds(NewTestId(), NewTestId()) + o2.Name = model.GetDMNameFromIds(NewTestID(), NewTestID()) o2.Type = model.ChannelTypeDirect m1 := model.ChannelMember{} @@ -500,7 +500,7 @@ func testChannelStoreGetMany(t *testing.T, rctx request.CTX, ss store.Store, s S o1, nErr := ss.Channel().Save(rctx, &model.Channel{ TeamId: model.NewId(), DisplayName: "Name", - Name: NewTestId(), + Name: NewTestID(), Type: model.ChannelTypeOpen, }, -1) require.NoError(t, nErr) @@ -508,7 +508,7 @@ func testChannelStoreGetMany(t *testing.T, rctx request.CTX, ss store.Store, s S o2, nErr := ss.Channel().Save(rctx, &model.Channel{ TeamId: model.NewId(), DisplayName: "Name2", - Name: NewTestId(), + Name: NewTestID(), Type: model.ChannelTypeOpen, }, -1) require.NoError(t, nErr) @@ -558,7 +558,7 @@ func testChannelStoreGetChannelsByIds(t *testing.T, rctx request.CTX, ss store.S o2 := model.Channel{} o2.TeamId = model.NewId() o2.DisplayName = "Direct Name" - o2.Name = model.GetDMNameFromIds(NewTestId(), NewTestId()) + o2.Name = model.GetDMNameFromIds(NewTestID(), NewTestID()) o2.Type = model.ChannelTypeDirect o3 := model.Channel{} @@ -594,8 +594,8 @@ func testChannelStoreGetChannelsByIds(t *testing.T, rctx request.CTX, ss store.S }) t.Run("Get 1 existing and 1 not existing channel", func(t *testing.T) { - nonexistentId := "abcd1234" - r2, err := ss.Channel().GetChannelsByIds([]string{o1.Id, nonexistentId}, false) + nonexistentID := "abcd1234" + r2, err := ss.Channel().GetChannelsByIds([]string{o1.Id, nonexistentID}, false) require.NoError(t, err, err) require.Len(t, r2, 1, "invalid returned channels, expected 1 and got "+strconv.Itoa(len(r2))) require.ElementsMatch(t, []*model.Channel{&o1}, r2, "invalid returned channel") @@ -612,7 +612,7 @@ func testChannelStoreGetChannelsByIds(t *testing.T, rctx request.CTX, ss store.S func testGetChannelsWithTeamDataByIds(t *testing.T, rctx request.CTX, ss store.Store) { t1 := &model.Team{ DisplayName: "DisplayName", - Name: NewTestId(), + Name: NewTestID(), Email: MakeEmail(), Type: model.TeamOpen, } @@ -647,7 +647,7 @@ func testGetChannelsWithTeamDataByIds(t *testing.T, rctx request.CTX, ss store.S c2 := model.Channel{} c2.TeamId = t1.Id c2.DisplayName = "Direct Name" - c2.Name = model.GetDMNameFromIds(NewTestId(), NewTestId()) + c2.Name = model.GetDMNameFromIds(NewTestID(), NewTestID()) c2.Type = model.ChannelTypeDirect c3 := model.Channel{} @@ -698,7 +698,7 @@ func testChannelStoreGetForPost(t *testing.T, rctx request.CTX, ss store.Store) ch := &model.Channel{ TeamId: model.NewId(), DisplayName: "Name", - Name: NewTestId(), + Name: NewTestID(), Type: model.ChannelTypeOpen, } o1, nErr := ss.Channel().Save(rctx, ch, -1) @@ -720,7 +720,7 @@ func testChannelStoreRestore(t *testing.T, rctx request.CTX, ss store.Store) { o1 := model.Channel{} o1.TeamId = model.NewId() o1.DisplayName = "Channel1" - o1.Name = NewTestId() + o1.Name = NewTestID() o1.Type = model.ChannelTypeOpen _, nErr := ss.Channel().Save(rctx, &o1, -1) require.NoError(t, nErr) @@ -742,7 +742,7 @@ func testChannelStoreDelete(t *testing.T, rctx request.CTX, ss store.Store) { o1 := model.Channel{} o1.TeamId = model.NewId() o1.DisplayName = "Channel1" - o1.Name = NewTestId() + o1.Name = NewTestID() o1.Type = model.ChannelTypeOpen _, nErr := ss.Channel().Save(rctx, &o1, -1) require.NoError(t, nErr) @@ -750,7 +750,7 @@ func testChannelStoreDelete(t *testing.T, rctx request.CTX, ss store.Store) { o2 := model.Channel{} o2.TeamId = o1.TeamId o2.DisplayName = "Channel2" - o2.Name = NewTestId() + o2.Name = NewTestID() o2.Type = model.ChannelTypeOpen _, nErr = ss.Channel().Save(rctx, &o2, -1) require.NoError(t, nErr) @@ -758,7 +758,7 @@ func testChannelStoreDelete(t *testing.T, rctx request.CTX, ss store.Store) { o3 := model.Channel{} o3.TeamId = o1.TeamId o3.DisplayName = "Channel3" - o3.Name = NewTestId() + o3.Name = NewTestID() o3.Type = model.ChannelTypeOpen _, nErr = ss.Channel().Save(rctx, &o3, -1) require.NoError(t, nErr) @@ -766,7 +766,7 @@ func testChannelStoreDelete(t *testing.T, rctx request.CTX, ss store.Store) { o4 := model.Channel{} o4.TeamId = o1.TeamId o4.DisplayName = "Channel4" - o4.Name = NewTestId() + o4.Name = NewTestID() o4.Type = model.ChannelTypeOpen _, nErr = ss.Channel().Save(rctx, &o4, -1) require.NoError(t, nErr) @@ -827,7 +827,7 @@ func testChannelStoreGetByName(t *testing.T, rctx request.CTX, ss store.Store) { o1 := model.Channel{} o1.TeamId = model.NewId() o1.DisplayName = "Name" - o1.Name = NewTestId() + o1.Name = NewTestID() o1.Type = model.ChannelTypeOpen _, nErr := ss.Channel().Save(rctx, &o1, -1) require.NoError(t, nErr) @@ -859,7 +859,7 @@ func testChannelStoreGetByNames(t *testing.T, rctx request.CTX, ss store.Store) o1 := model.Channel{ TeamId: model.NewId(), DisplayName: "Name", - Name: NewTestId(), + Name: NewTestID(), Type: model.ChannelTypeOpen, } _, nErr := ss.Channel().Save(rctx, &o1, -1) @@ -868,7 +868,7 @@ func testChannelStoreGetByNames(t *testing.T, rctx request.CTX, ss store.Store) o2 := model.Channel{ TeamId: o1.TeamId, DisplayName: "Name", - Name: NewTestId(), + Name: NewTestID(), Type: model.ChannelTypeOpen, } _, nErr = ss.Channel().Save(rctx, &o2, -1) @@ -877,7 +877,7 @@ func testChannelStoreGetByNames(t *testing.T, rctx request.CTX, ss store.Store) o3 := model.Channel{ TeamId: o1.TeamId, DisplayName: "Name", - Name: NewTestId(), + Name: NewTestID(), Type: model.ChannelTypeOpen, } _, nErr = ss.Channel().Save(rctx, &o3, -1) @@ -886,7 +886,7 @@ func testChannelStoreGetByNames(t *testing.T, rctx request.CTX, ss store.Store) require.NoError(t, nErr) for index, tc := range []struct { - TeamId string + TeamID string Names []string ExpectedIds []string }{ @@ -899,7 +899,7 @@ func testChannelStoreGetByNames(t *testing.T, rctx request.CTX, ss store.Store) {"asd", []string{o1.Name, "foo", o2.Name, o2.Name}, nil}, } { var channels []*model.Channel - channels, err := ss.Channel().GetByNames(tc.TeamId, tc.Names, true) + channels, err := ss.Channel().GetByNames(tc.TeamID, tc.Names, true) require.NoError(t, err) var ids []string for _, channel := range channels { @@ -925,7 +925,7 @@ func testChannelStoreGetByNamesIncludeDeleted(t *testing.T, rctx request.CTX, ss o1 := model.Channel{ TeamId: model.NewId(), DisplayName: "Name", - Name: NewTestId(), + Name: NewTestID(), Type: model.ChannelTypeOpen, } _, nErr := ss.Channel().Save(rctx, &o1, -1) @@ -934,7 +934,7 @@ func testChannelStoreGetByNamesIncludeDeleted(t *testing.T, rctx request.CTX, ss o2 := model.Channel{ TeamId: o1.TeamId, DisplayName: "Name", - Name: NewTestId(), + Name: NewTestID(), Type: model.ChannelTypeOpen, } _, nErr = ss.Channel().Save(rctx, &o2, -1) @@ -943,7 +943,7 @@ func testChannelStoreGetByNamesIncludeDeleted(t *testing.T, rctx request.CTX, ss require.NoError(t, nErr, "channel should have been deleted") for index, tc := range []struct { - TeamId string + TeamID string Names []string ExpectedIds []string }{ @@ -956,7 +956,7 @@ func testChannelStoreGetByNamesIncludeDeleted(t *testing.T, rctx request.CTX, ss {"asd", []string{o1.Name, "foo", o2.Name, o2.Name}, nil}, } { var channels []*model.Channel - channels, err := ss.Channel().GetByNamesIncludeDeleted(tc.TeamId, tc.Names, true) + channels, err := ss.Channel().GetByNamesIncludeDeleted(tc.TeamID, tc.Names, true) require.NoError(t, err) var ids []string for _, channel := range channels { @@ -972,7 +972,7 @@ func testChannelStoreGetDeletedByName(t *testing.T, rctx request.CTX, ss store.S o1 := &model.Channel{} o1.TeamId = model.NewId() o1.DisplayName = "Name" - o1.Name = NewTestId() + o1.Name = NewTestID() o1.Type = model.ChannelTypeOpen _, nErr := ss.Channel().Save(rctx, o1, -1) require.NoError(t, nErr) @@ -995,10 +995,10 @@ func testChannelStoreGetDeleted(t *testing.T, rctx request.CTX, ss store.Store) o1 := model.Channel{} o1.TeamId = model.NewId() o1.DisplayName = "Channel1" - o1.Name = NewTestId() + o1.Name = NewTestID() o1.Type = model.ChannelTypeOpen - userId := model.NewId() + userID := model.NewId() _, nErr := ss.Channel().Save(rctx, &o1, -1) require.NoError(t, nErr) @@ -1006,7 +1006,7 @@ func testChannelStoreGetDeleted(t *testing.T, rctx request.CTX, ss store.Store) err := ss.Channel().Delete(o1.Id, model.GetMillis()) require.NoError(t, err, "channel should have been deleted") - list, nErr := ss.Channel().GetDeleted(o1.TeamId, 0, 100, userId) + 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") @@ -1014,19 +1014,19 @@ func testChannelStoreGetDeleted(t *testing.T, rctx request.CTX, ss store.Store) o2 := model.Channel{} o2.TeamId = o1.TeamId o2.DisplayName = "Channel2" - o2.Name = NewTestId() + o2.Name = NewTestID() o2.Type = model.ChannelTypeOpen _, nErr = ss.Channel().Save(rctx, &o2, -1) require.NoError(t, nErr) - list, nErr = ss.Channel().GetDeleted(o1.TeamId, 0, 100, userId) + list, nErr = ss.Channel().GetDeleted(o1.TeamId, 0, 100, userID) require.NoError(t, nErr, nErr) require.Len(t, list, 1, "wrong list") o3 := model.Channel{} o3.TeamId = o1.TeamId o3.DisplayName = "Channel3" - o3.Name = NewTestId() + o3.Name = NewTestID() o3.Type = model.ChannelTypeOpen _, nErr = ss.Channel().Save(rctx, &o3, -1) @@ -1035,15 +1035,15 @@ func testChannelStoreGetDeleted(t *testing.T, rctx request.CTX, ss store.Store) err = ss.Channel().Delete(o3.Id, model.GetMillis()) require.NoError(t, err, "channel should have been deleted") - list, nErr = ss.Channel().GetDeleted(o1.TeamId, 0, 100, userId) + list, nErr = ss.Channel().GetDeleted(o1.TeamId, 0, 100, userID) require.NoError(t, nErr, nErr) require.Len(t, list, 2, "wrong list length") - list, nErr = ss.Channel().GetDeleted(o1.TeamId, 0, 1, userId) + list, nErr = ss.Channel().GetDeleted(o1.TeamId, 0, 1, userID) require.NoError(t, nErr, nErr) require.Len(t, list, 1, "wrong list length") - list, nErr = ss.Channel().GetDeleted(o1.TeamId, 1, 1, userId) + list, nErr = ss.Channel().GetDeleted(o1.TeamId, 1, 1, userID) require.NoError(t, nErr, nErr) require.Len(t, list, 1, "wrong list length") } @@ -1052,7 +1052,7 @@ func testChannelMemberStore(t *testing.T, rctx request.CTX, ss store.Store) { c1 := &model.Channel{} c1.TeamId = model.NewId() c1.DisplayName = "NameName" - c1.Name = NewTestId() + c1.Name = NewTestID() c1.Type = model.ChannelTypeOpen c1, nErr := ss.Channel().Save(rctx, c1, -1) require.NoError(t, nErr) @@ -1173,7 +1173,7 @@ func testChannelSaveMember(t *testing.T, rctx request.CTX, ss store.Store) { t.Run("insert member correctly (in channel without channel scheme and team without scheme)", func(t *testing.T) { team := &model.Team{ DisplayName: "Name", - Name: NewTestId(), + Name: NewTestID(), Email: MakeEmail(), Type: model.TeamOpen, } @@ -1333,7 +1333,7 @@ func testChannelSaveMember(t *testing.T, rctx request.CTX, ss store.Store) { team := &model.Team{ DisplayName: "Name", - Name: NewTestId(), + Name: NewTestID(), Email: MakeEmail(), Type: model.TeamOpen, SchemeId: &ts.Id, @@ -1494,7 +1494,7 @@ func testChannelSaveMember(t *testing.T, rctx request.CTX, ss store.Store) { team := &model.Team{ DisplayName: "Name", - Name: NewTestId(), + Name: NewTestID(), Email: MakeEmail(), Type: model.TeamOpen, } @@ -1681,7 +1681,7 @@ func testChannelSaveMultipleMembers(t *testing.T, rctx request.CTX, ss store.Sto t.Run("insert members correctly (in channel without channel scheme and team without scheme)", func(t *testing.T) { team := &model.Team{ DisplayName: "Name", - Name: NewTestId(), + Name: NewTestID(), Email: MakeEmail(), Type: model.TeamOpen, } @@ -1855,7 +1855,7 @@ func testChannelSaveMultipleMembers(t *testing.T, rctx request.CTX, ss store.Sto team := &model.Team{ DisplayName: "Name", - Name: NewTestId(), + Name: NewTestID(), Email: MakeEmail(), Type: model.TeamOpen, SchemeId: &ts.Id, @@ -2030,7 +2030,7 @@ func testChannelSaveMultipleMembers(t *testing.T, rctx request.CTX, ss store.Sto team := &model.Team{ DisplayName: "Name", - Name: NewTestId(), + Name: NewTestID(), Email: MakeEmail(), Type: model.TeamOpen, } @@ -2221,7 +2221,7 @@ func testChannelUpdateMember(t *testing.T, rctx request.CTX, ss store.Store) { t.Run("insert member correctly (in channel without channel scheme and team without scheme)", func(t *testing.T) { team := &model.Team{ DisplayName: "Name", - Name: NewTestId(), + Name: NewTestID(), Email: MakeEmail(), Type: model.TeamOpen, } @@ -2383,7 +2383,7 @@ func testChannelUpdateMember(t *testing.T, rctx request.CTX, ss store.Store) { team := &model.Team{ DisplayName: "Name", - Name: NewTestId(), + Name: NewTestID(), Email: MakeEmail(), Type: model.TeamOpen, SchemeId: &ts.Id, @@ -2546,7 +2546,7 @@ func testChannelUpdateMember(t *testing.T, rctx request.CTX, ss store.Store) { team := &model.Team{ DisplayName: "Name", - Name: NewTestId(), + Name: NewTestID(), Email: MakeEmail(), Type: model.TeamOpen, } @@ -2738,7 +2738,7 @@ func testChannelUpdateMultipleMembers(t *testing.T, rctx request.CTX, ss store.S t.Run("insert members correctly (in channel without channel scheme and team without scheme)", func(t *testing.T) { team := &model.Team{ DisplayName: "Name", - Name: NewTestId(), + Name: NewTestID(), Email: MakeEmail(), Type: model.TeamOpen, } @@ -2907,7 +2907,7 @@ func testChannelUpdateMultipleMembers(t *testing.T, rctx request.CTX, ss store.S team := &model.Team{ DisplayName: "Name", - Name: NewTestId(), + Name: NewTestID(), Email: MakeEmail(), Type: model.TeamOpen, SchemeId: &ts.Id, @@ -3077,7 +3077,7 @@ func testChannelUpdateMultipleMembers(t *testing.T, rctx request.CTX, ss store.S team := &model.Team{ DisplayName: "Name", - Name: NewTestId(), + Name: NewTestID(), Email: MakeEmail(), Type: model.TeamOpen, } @@ -3240,7 +3240,7 @@ func testChannelUpdateMemberNotifyProps(t *testing.T, rctx request.CTX, ss store team := &model.Team{ DisplayName: "Name", - Name: NewTestId(), + Name: NewTestID(), Email: MakeEmail(), Type: model.TeamOpen, } @@ -3250,7 +3250,7 @@ func testChannelUpdateMemberNotifyProps(t *testing.T, rctx request.CTX, ss store channel := &model.Channel{ DisplayName: "DisplayName", - Name: NewTestId(), + Name: NewTestID(), Type: model.ChannelTypeOpen, TeamId: team.Id, } @@ -3521,7 +3521,7 @@ func testChannelDeleteMemberStore(t *testing.T, rctx request.CTX, ss store.Store c1 := &model.Channel{} c1.TeamId = model.NewId() c1.DisplayName = "NameName" - c1.Name = NewTestId() + c1.Name = NewTestID() c1.Type = model.ChannelTypeOpen c1, nErr := ss.Channel().Save(rctx, c1, -1) require.NoError(t, nErr) @@ -3586,7 +3586,7 @@ func testChannelStoreGetChannels(t *testing.T, rctx request.CTX, ss store.Store) o1 := &model.Channel{} o1.TeamId = team o1.DisplayName = "Channel1" - o1.Name = NewTestId() + o1.Name = NewTestID() o1.Type = model.ChannelTypeOpen var nErr error o1, nErr = ss.Channel().Save(rctx, o1, -1) @@ -3595,7 +3595,7 @@ func testChannelStoreGetChannels(t *testing.T, rctx request.CTX, ss store.Store) o2 := model.Channel{} o2.TeamId = team o2.DisplayName = "Channel2" - o2.Name = NewTestId() + o2.Name = NewTestID() o2.Type = model.ChannelTypeOpen _, nErr = ss.Channel().Save(rctx, &o2, -1) require.NoError(t, nErr) @@ -3603,7 +3603,7 @@ func testChannelStoreGetChannels(t *testing.T, rctx request.CTX, ss store.Store) o3 := model.Channel{} o3.TeamId = team o3.DisplayName = "Channel3" - o3.Name = NewTestId() + o3.Name = NewTestID() o3.Type = model.ChannelTypeOpen _, nErr = ss.Channel().Save(rctx, &o3, -1) require.NoError(t, nErr) @@ -3745,7 +3745,7 @@ func testChannelStoreGetChannelsByUser(t *testing.T, rctx request.CTX, ss store. o1 := model.Channel{} o1.TeamId = team o1.DisplayName = "Channel1" - o1.Name = NewTestId() + o1.Name = NewTestID() o1.Type = model.ChannelTypeOpen _, nErr := ss.Channel().Save(rctx, &o1, -1) require.NoError(t, nErr) @@ -3753,7 +3753,7 @@ func testChannelStoreGetChannelsByUser(t *testing.T, rctx request.CTX, ss store. o2 := model.Channel{} o2.TeamId = team o2.DisplayName = "Channel2" - o2.Name = NewTestId() + o2.Name = NewTestID() o2.Type = model.ChannelTypeOpen _, nErr = ss.Channel().Save(rctx, &o2, -1) require.NoError(t, nErr) @@ -3761,7 +3761,7 @@ func testChannelStoreGetChannelsByUser(t *testing.T, rctx request.CTX, ss store. o3 := model.Channel{} o3.TeamId = team2 o3.DisplayName = "Channel3" - o3.Name = NewTestId() + o3.Name = NewTestID() o3.Type = model.ChannelTypeOpen _, nErr = ss.Channel().Save(rctx, &o3, -1) require.NoError(t, nErr) @@ -3835,7 +3835,7 @@ func testChannelStoreGetAllChannels(t *testing.T, rctx request.CTX, ss store.Sto t1 := model.Team{} t1.DisplayName = "Name" - t1.Name = NewTestId() + t1.Name = NewTestID() t1.Email = MakeEmail() t1.Type = model.TeamOpen _, err := ss.Team().Save(&t1) @@ -3843,7 +3843,7 @@ func testChannelStoreGetAllChannels(t *testing.T, rctx request.CTX, ss store.Sto t2 := model.Team{} t2.DisplayName = "Name2" - t2.Name = NewTestId() + t2.Name = NewTestID() t2.Email = MakeEmail() t2.Type = model.TeamOpen _, err = ss.Team().Save(&t2) @@ -3852,7 +3852,7 @@ func testChannelStoreGetAllChannels(t *testing.T, rctx request.CTX, ss store.Sto c1 := model.Channel{} c1.TeamId = t1.Id c1.DisplayName = "Channel1" + model.NewId() - c1.Name = NewTestId() + c1.Name = NewTestID() c1.Type = model.ChannelTypeOpen c1.GroupConstrained = model.NewPointer(true) _, nErr := ss.Channel().Save(rctx, &c1, -1) @@ -3873,7 +3873,7 @@ func testChannelStoreGetAllChannels(t *testing.T, rctx request.CTX, ss store.Sto c2 := model.Channel{} c2.TeamId = t1.Id c2.DisplayName = "Channel2" + model.NewId() - c2.Name = NewTestId() + c2.Name = NewTestID() c2.Type = model.ChannelTypeOpen _, nErr = ss.Channel().Save(rctx, &c2, -1) require.NoError(t, nErr) @@ -3885,7 +3885,7 @@ func testChannelStoreGetAllChannels(t *testing.T, rctx request.CTX, ss store.Sto c3 := model.Channel{} c3.TeamId = t2.Id c3.DisplayName = "Channel3" + model.NewId() - c3.Name = NewTestId() + c3.Name = NewTestID() c3.Type = model.ChannelTypePrivate _, nErr = ss.Channel().Save(rctx, &c3, -1) require.NoError(t, nErr) @@ -3900,7 +3900,7 @@ func testChannelStoreGetAllChannels(t *testing.T, rctx request.CTX, ss store.Sto c5 := model.Channel{} c5.Name = model.GetGroupNameFromUserIds(userIds) c5.DisplayName = "GroupChannel" + model.NewId() - c5.Name = NewTestId() + c5.Name = NewTestID() c5.Type = model.ChannelTypeGroup _, nErr = ss.Channel().Save(rctx, &c5, -1) require.NoError(t, nErr) @@ -3991,17 +3991,17 @@ func testChannelStoreGetAllChannels(t *testing.T, rctx request.CTX, ss store.Sto } func testChannelStoreGetMoreChannels(t *testing.T, rctx request.CTX, ss store.Store) { - teamId := model.NewId() - otherTeamId := model.NewId() - userId := model.NewId() - otherUserId1 := model.NewId() - otherUserId2 := model.NewId() + teamID := model.NewId() + otherTeamID := model.NewId() + userID := model.NewId() + otherUserID1 := model.NewId() + otherUserID2 := model.NewId() // o1 is a channel on the team to which the user (and the other user 1) belongs o1 := model.Channel{ - TeamId: teamId, + TeamId: teamID, DisplayName: "Channel1", - Name: NewTestId(), + Name: NewTestID(), Type: model.ChannelTypeOpen, } _, nErr := ss.Channel().Save(rctx, &o1, -1) @@ -4009,23 +4009,23 @@ func testChannelStoreGetMoreChannels(t *testing.T, rctx request.CTX, ss store.St _, err := ss.Channel().SaveMember(rctx, &model.ChannelMember{ ChannelId: o1.Id, - UserId: userId, + UserId: userID, NotifyProps: model.GetDefaultChannelNotifyProps(), }) require.NoError(t, err) _, err = ss.Channel().SaveMember(rctx, &model.ChannelMember{ ChannelId: o1.Id, - UserId: otherUserId1, + UserId: otherUserID1, NotifyProps: model.GetDefaultChannelNotifyProps(), }) require.NoError(t, err) // o2 is a channel on the other team to which the user belongs o2 := model.Channel{ - TeamId: otherTeamId, + TeamId: otherTeamID, DisplayName: "Channel2", - Name: NewTestId(), + Name: NewTestID(), Type: model.ChannelTypeOpen, } _, nErr = ss.Channel().Save(rctx, &o2, -1) @@ -4033,7 +4033,7 @@ func testChannelStoreGetMoreChannels(t *testing.T, rctx request.CTX, ss store.St _, err = ss.Channel().SaveMember(rctx, &model.ChannelMember{ ChannelId: o2.Id, - UserId: otherUserId2, + UserId: otherUserID2, NotifyProps: model.GetDefaultChannelNotifyProps(), }) require.NoError(t, err) @@ -4041,9 +4041,9 @@ func testChannelStoreGetMoreChannels(t *testing.T, rctx request.CTX, ss store.St // o3 is a channel on the team to which the user does not belong, and thus should show up // in "more channels" o3 := model.Channel{ - TeamId: teamId, + TeamId: teamID, DisplayName: "ChannelA", - Name: NewTestId(), + Name: NewTestID(), Type: model.ChannelTypeOpen, } _, nErr = ss.Channel().Save(rctx, &o3, -1) @@ -4051,9 +4051,9 @@ func testChannelStoreGetMoreChannels(t *testing.T, rctx request.CTX, ss store.St // o4 is a private channel on the team to which the user does not belong o4 := model.Channel{ - TeamId: teamId, + TeamId: teamID, DisplayName: "ChannelB", - Name: NewTestId(), + Name: NewTestID(), Type: model.ChannelTypePrivate, } _, nErr = ss.Channel().Save(rctx, &o4, -1) @@ -4061,9 +4061,9 @@ func testChannelStoreGetMoreChannels(t *testing.T, rctx request.CTX, ss store.St // o5 is another private channel on the team to which the user does belong o5 := model.Channel{ - TeamId: teamId, + TeamId: teamID, DisplayName: "ChannelC", - Name: NewTestId(), + Name: NewTestID(), Type: model.ChannelTypePrivate, } _, nErr = ss.Channel().Save(rctx, &o5, -1) @@ -4071,13 +4071,13 @@ func testChannelStoreGetMoreChannels(t *testing.T, rctx request.CTX, ss store.St _, err = ss.Channel().SaveMember(rctx, &model.ChannelMember{ ChannelId: o5.Id, - UserId: userId, + UserId: userID, NotifyProps: model.GetDefaultChannelNotifyProps(), }) require.NoError(t, err) t.Run("only o3 listed in more channels", func(t *testing.T) { - list, channelErr := ss.Channel().GetMoreChannels(teamId, userId, 0, 100) + list, channelErr := ss.Channel().GetMoreChannels(teamID, userID, 0, 100) require.NoError(t, channelErr) require.Equal(t, model.ChannelList{&o3}, list) }) @@ -4085,9 +4085,9 @@ func testChannelStoreGetMoreChannels(t *testing.T, rctx request.CTX, ss store.St // o6 is another channel on the team to which the user does not belong, and would thus // start showing up in "more channels". o6 := model.Channel{ - TeamId: teamId, + TeamId: teamID, DisplayName: "ChannelD", - Name: NewTestId(), + Name: NewTestID(), Type: model.ChannelTypeOpen, } _, nErr = ss.Channel().Save(rctx, &o6, -1) @@ -4096,9 +4096,9 @@ func testChannelStoreGetMoreChannels(t *testing.T, rctx request.CTX, ss store.St // o7 is another channel on the team to which the user does not belong, but is deleted, // and thus would not start showing up in "more channels" o7 := model.Channel{ - TeamId: teamId, + TeamId: teamID, DisplayName: "ChannelD", - Name: NewTestId(), + Name: NewTestID(), Type: model.ChannelTypeOpen, } _, nErr = ss.Channel().Save(rctx, &o7, -1) @@ -4108,50 +4108,50 @@ func testChannelStoreGetMoreChannels(t *testing.T, rctx request.CTX, ss store.St require.NoError(t, nErr, "channel should have been deleted") t.Run("both o3 and o6 listed in more channels", func(t *testing.T) { - list, err := ss.Channel().GetMoreChannels(teamId, userId, 0, 100) + list, err := ss.Channel().GetMoreChannels(teamID, userID, 0, 100) require.NoError(t, err) 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) + list, err := ss.Channel().GetMoreChannels(teamID, userID, 0, 1) require.NoError(t, err) 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) + list, err := ss.Channel().GetMoreChannels(teamID, userID, 1, 1) require.NoError(t, err) require.Equal(t, model.ChannelList{&o6}, list) }) t.Run("verify analytics for open channels", func(t *testing.T) { - count, err := ss.Channel().AnalyticsTypeCount(teamId, model.ChannelTypeOpen) + count, err := ss.Channel().AnalyticsTypeCount(teamID, model.ChannelTypeOpen) require.NoError(t, err) require.EqualValues(t, 4, count) }) t.Run("verify analytics for private channels", func(t *testing.T) { - count, err := ss.Channel().AnalyticsTypeCount(teamId, model.ChannelTypePrivate) + count, err := ss.Channel().AnalyticsTypeCount(teamID, model.ChannelTypePrivate) require.NoError(t, err) require.EqualValues(t, 2, count) }) t.Run("verify analytics for all channels", func(t *testing.T) { - count, err := ss.Channel().AnalyticsTypeCount(teamId, "") + count, err := ss.Channel().AnalyticsTypeCount(teamID, "") require.NoError(t, err) require.EqualValues(t, 6, count) }) } func testChannelStoreGetPrivateChannelsForTeam(t *testing.T, rctx request.CTX, ss store.Store) { - teamId := model.NewId() + teamID := model.NewId() // p1 is a private channel on the team p1 := model.Channel{ - TeamId: teamId, + TeamId: teamID, DisplayName: "PrivateChannel1Team1", - Name: NewTestId(), + Name: NewTestID(), Type: model.ChannelTypePrivate, } _, nErr := ss.Channel().Save(rctx, &p1, -1) @@ -4161,7 +4161,7 @@ func testChannelStoreGetPrivateChannelsForTeam(t *testing.T, rctx request.CTX, s p2 := model.Channel{ TeamId: model.NewId(), DisplayName: "PrivateChannel1Team2", - Name: NewTestId(), + Name: NewTestID(), Type: model.ChannelTypePrivate, } _, nErr = ss.Channel().Save(rctx, &p2, -1) @@ -4169,25 +4169,25 @@ func testChannelStoreGetPrivateChannelsForTeam(t *testing.T, rctx request.CTX, s // o1 is a public channel on the team o1 := model.Channel{ - TeamId: teamId, + TeamId: teamID, DisplayName: "OpenChannel1Team1", - Name: NewTestId(), + Name: NewTestID(), Type: model.ChannelTypeOpen, } _, nErr = ss.Channel().Save(rctx, &o1, -1) require.NoError(t, nErr) t.Run("only p1 initially listed in private channels", func(t *testing.T) { - list, channelErr := ss.Channel().GetPrivateChannelsForTeam(teamId, 0, 100) + list, channelErr := ss.Channel().GetPrivateChannelsForTeam(teamID, 0, 100) require.NoError(t, channelErr) require.Equal(t, model.ChannelList{&p1}, list) }) // p3 is another private channel on the team p3 := model.Channel{ - TeamId: teamId, + TeamId: teamID, DisplayName: "PrivateChannel2Team1", - Name: NewTestId(), + Name: NewTestID(), Type: model.ChannelTypePrivate, } _, nErr = ss.Channel().Save(rctx, &p3, -1) @@ -4195,9 +4195,9 @@ func testChannelStoreGetPrivateChannelsForTeam(t *testing.T, rctx request.CTX, s // p4 is another private, but deleted channel on the team p4 := model.Channel{ - TeamId: teamId, + TeamId: teamID, DisplayName: "PrivateChannel3Team1", - Name: NewTestId(), + Name: NewTestID(), Type: model.ChannelTypePrivate, } _, nErr = ss.Channel().Save(rctx, &p4, -1) @@ -4206,44 +4206,44 @@ func testChannelStoreGetPrivateChannelsForTeam(t *testing.T, rctx request.CTX, s require.NoError(t, err, "channel should have been deleted") t.Run("both p1 and p3 listed in private channels", func(t *testing.T) { - list, err := ss.Channel().GetPrivateChannelsForTeam(teamId, 0, 100) + list, err := ss.Channel().GetPrivateChannelsForTeam(teamID, 0, 100) require.NoError(t, err) 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) + list, err := ss.Channel().GetPrivateChannelsForTeam(teamID, 0, 1) require.NoError(t, err) 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) + list, err := ss.Channel().GetPrivateChannelsForTeam(teamID, 1, 1) require.NoError(t, err) require.Equal(t, model.ChannelList{&p3}, list) }) t.Run("verify analytics for private channels", func(t *testing.T) { - count, err := ss.Channel().AnalyticsTypeCount(teamId, model.ChannelTypePrivate) + count, err := ss.Channel().AnalyticsTypeCount(teamID, model.ChannelTypePrivate) require.NoError(t, err) require.EqualValues(t, 3, count) }) t.Run("verify analytics for open open channels", func(t *testing.T) { - count, err := ss.Channel().AnalyticsTypeCount(teamId, model.ChannelTypeOpen) + count, err := ss.Channel().AnalyticsTypeCount(teamID, model.ChannelTypeOpen) require.NoError(t, err) require.EqualValues(t, 1, count) }) } func testChannelStoreGetPublicChannelsForTeam(t *testing.T, rctx request.CTX, ss store.Store) { - teamId := model.NewId() + teamID := model.NewId() // o1 is a public channel on the team o1 := model.Channel{ - TeamId: teamId, + TeamId: teamID, DisplayName: "OpenChannel1Team1", - Name: NewTestId(), + Name: NewTestID(), Type: model.ChannelTypeOpen, } _, nErr := ss.Channel().Save(rctx, &o1, -1) @@ -4253,7 +4253,7 @@ func testChannelStoreGetPublicChannelsForTeam(t *testing.T, rctx request.CTX, ss o2 := model.Channel{ TeamId: model.NewId(), DisplayName: "OpenChannel1Team2", - Name: NewTestId(), + Name: NewTestID(), Type: model.ChannelTypeOpen, } _, nErr = ss.Channel().Save(rctx, &o2, -1) @@ -4261,25 +4261,25 @@ func testChannelStoreGetPublicChannelsForTeam(t *testing.T, rctx request.CTX, ss // o3 is a private channel on the team o3 := model.Channel{ - TeamId: teamId, + TeamId: teamID, DisplayName: "PrivateChannel1Team1", - Name: NewTestId(), + Name: NewTestID(), Type: model.ChannelTypePrivate, } _, nErr = ss.Channel().Save(rctx, &o3, -1) require.NoError(t, nErr) t.Run("only o1 initially listed in public channels", func(t *testing.T) { - list, channelErr := ss.Channel().GetPublicChannelsForTeam(teamId, 0, 100) + list, channelErr := ss.Channel().GetPublicChannelsForTeam(teamID, 0, 100) require.NoError(t, channelErr) require.Equal(t, model.ChannelList{&o1}, list) }) // o4 is another public channel on the team o4 := model.Channel{ - TeamId: teamId, + TeamId: teamID, DisplayName: "OpenChannel2Team1", - Name: NewTestId(), + Name: NewTestID(), Type: model.ChannelTypeOpen, } _, nErr = ss.Channel().Save(rctx, &o4, -1) @@ -4287,9 +4287,9 @@ func testChannelStoreGetPublicChannelsForTeam(t *testing.T, rctx request.CTX, ss // o5 is another public, but deleted channel on the team o5 := model.Channel{ - TeamId: teamId, + TeamId: teamID, DisplayName: "OpenChannel3Team1", - Name: NewTestId(), + Name: NewTestID(), Type: model.ChannelTypeOpen, } _, nErr = ss.Channel().Save(rctx, &o5, -1) @@ -4298,44 +4298,44 @@ func testChannelStoreGetPublicChannelsForTeam(t *testing.T, rctx request.CTX, ss require.NoError(t, err, "channel should have been deleted") t.Run("both o1 and o4 listed in public channels", func(t *testing.T) { - list, err := ss.Channel().GetPublicChannelsForTeam(teamId, 0, 100) + list, err := ss.Channel().GetPublicChannelsForTeam(teamID, 0, 100) require.NoError(t, err) 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) + list, err := ss.Channel().GetPublicChannelsForTeam(teamID, 0, 1) require.NoError(t, err) 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) + list, err := ss.Channel().GetPublicChannelsForTeam(teamID, 1, 1) require.NoError(t, err) require.Equal(t, model.ChannelList{&o4}, list) }) t.Run("verify analytics for open channels", func(t *testing.T) { - count, err := ss.Channel().AnalyticsTypeCount(teamId, model.ChannelTypeOpen) + count, err := ss.Channel().AnalyticsTypeCount(teamID, model.ChannelTypeOpen) require.NoError(t, err) require.EqualValues(t, 3, count) }) t.Run("verify analytics for private channels", func(t *testing.T) { - count, err := ss.Channel().AnalyticsTypeCount(teamId, model.ChannelTypePrivate) + count, err := ss.Channel().AnalyticsTypeCount(teamID, model.ChannelTypePrivate) require.NoError(t, err) require.EqualValues(t, 1, count) }) } func testChannelStoreGetPublicChannelsByIdsForTeam(t *testing.T, rctx request.CTX, ss store.Store) { - teamId := model.NewId() + teamID := model.NewId() // oc1 is a public channel on the team oc1 := model.Channel{ - TeamId: teamId, + TeamId: teamID, DisplayName: "OpenChannel1Team1", - Name: NewTestId(), + Name: NewTestID(), Type: model.ChannelTypeOpen, } _, nErr := ss.Channel().Save(rctx, &oc1, -1) @@ -4345,7 +4345,7 @@ func testChannelStoreGetPublicChannelsByIdsForTeam(t *testing.T, rctx request.CT oc2 := model.Channel{ TeamId: model.NewId(), DisplayName: "OpenChannel2TeamOther", - Name: NewTestId(), + Name: NewTestID(), Type: model.ChannelTypeOpen, } _, nErr = ss.Channel().Save(rctx, &oc2, -1) @@ -4353,31 +4353,31 @@ func testChannelStoreGetPublicChannelsByIdsForTeam(t *testing.T, rctx request.CT // pc3 is a private channel on the team pc3 := model.Channel{ - TeamId: teamId, + TeamId: teamID, DisplayName: "PrivateChannel3Team1", - Name: NewTestId(), + Name: NewTestID(), Type: model.ChannelTypePrivate, } _, nErr = ss.Channel().Save(rctx, &pc3, -1) require.NoError(t, nErr) 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}) + list, channelErr := ss.Channel().GetPublicChannelsByIdsForTeam(teamID, []string{oc1.Id}) require.NoError(t, channelErr) 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}) + 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) }) // oc4 is another public channel on the team oc4 := model.Channel{ - TeamId: teamId, + TeamId: teamID, DisplayName: "OpenChannel4Team1", - Name: NewTestId(), + Name: NewTestID(), Type: model.ChannelTypeOpen, } _, nErr = ss.Channel().Save(rctx, &oc4, -1) @@ -4385,9 +4385,9 @@ func testChannelStoreGetPublicChannelsByIdsForTeam(t *testing.T, rctx request.CT // oc4 is another public, but deleted channel on the team oc5 := model.Channel{ - TeamId: teamId, + TeamId: teamID, DisplayName: "OpenChannel4Team1", - Name: NewTestId(), + Name: NewTestID(), Type: model.ChannelTypeOpen, } _, nErr = ss.Channel().Save(rctx, &oc5, -1) @@ -4397,13 +4397,13 @@ func testChannelStoreGetPublicChannelsByIdsForTeam(t *testing.T, rctx request.CT require.NoError(t, err, "channel should have been deleted") 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}) + 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) }) t.Run("random channel id should not be found as a public channel in the team", func(t *testing.T) { - _, err := ss.Channel().GetPublicChannelsByIdsForTeam(teamId, []string{model.NewId()}) + _, err := ss.Channel().GetPublicChannelsByIdsForTeam(teamID, []string{model.NewId()}) require.Error(t, err) var nfErr *store.ErrNotFound require.True(t, errors.As(err, &nfErr)) @@ -4414,7 +4414,7 @@ func testChannelStoreGetChannelCounts(t *testing.T, rctx request.CTX, ss store.S o2 := model.Channel{} o2.TeamId = model.NewId() o2.DisplayName = "Channel2" - o2.Name = NewTestId() + o2.Name = NewTestID() o2.Type = model.ChannelTypeOpen _, nErr := ss.Channel().Save(rctx, &o2, -1) require.NoError(t, nErr) @@ -4422,7 +4422,7 @@ func testChannelStoreGetChannelCounts(t *testing.T, rctx request.CTX, ss store.S o1 := model.Channel{} o1.TeamId = model.NewId() o1.DisplayName = "Channel1" - o1.Name = NewTestId() + o1.Name = NewTestID() o1.Type = model.ChannelTypeOpen _, nErr = ss.Channel().Save(rctx, &o1, -1) require.NoError(t, nErr) @@ -4457,7 +4457,7 @@ func testChannelStoreGetChannelCounts(t *testing.T, rctx request.CTX, ss store.S func testChannelStoreGetMembersForUser(t *testing.T, rctx request.CTX, ss store.Store) { t1 := model.Team{} t1.DisplayName = "Name" - t1.Name = NewTestId() + t1.Name = NewTestID() t1.Email = MakeEmail() t1.Type = model.TeamOpen _, err := ss.Team().Save(&t1) @@ -4466,7 +4466,7 @@ func testChannelStoreGetMembersForUser(t *testing.T, rctx request.CTX, ss store. o1 := model.Channel{} o1.TeamId = t1.Id o1.DisplayName = "Channel1" - o1.Name = NewTestId() + o1.Name = NewTestID() o1.Type = model.ChannelTypeOpen _, nErr := ss.Channel().Save(rctx, &o1, -1) require.NoError(t, nErr) @@ -4474,7 +4474,7 @@ func testChannelStoreGetMembersForUser(t *testing.T, rctx request.CTX, ss store. o2 := model.Channel{} o2.TeamId = o1.TeamId o2.DisplayName = "Channel2" - o2.Name = NewTestId() + o2.Name = NewTestID() o2.Type = model.ChannelTypeOpen _, nErr = ss.Channel().Save(rctx, &o2, -1) require.NoError(t, nErr) @@ -4532,9 +4532,9 @@ func testChannelStoreGetMembersForUser(t *testing.T, rctx request.CTX, ss store. var channel *model.Channel channel, nErr = ss.Channel().Save(rctx, group, 10000) require.NoError(t, nErr) - for _, userId := range userIds { + for _, userID := range userIds { cm := &model.ChannelMember{ - UserId: userId, + UserId: userID, ChannelId: channel.Id, NotifyProps: model.GetDefaultChannelNotifyProps(), SchemeUser: true, @@ -4554,7 +4554,7 @@ func testChannelStoreGetMembersForUser(t *testing.T, rctx request.CTX, ss store. func testChannelStoreGetMembersForUserWithPagination(t *testing.T, rctx request.CTX, ss store.Store) { t1 := model.Team{ DisplayName: "team1", - Name: NewTestId(), + Name: NewTestID(), Email: MakeEmail(), Type: model.TeamOpen, } @@ -4564,7 +4564,7 @@ func testChannelStoreGetMembersForUserWithPagination(t *testing.T, rctx request. o1 := model.Channel{ TeamId: t1.Id, DisplayName: "Channel1", - Name: NewTestId(), + Name: NewTestID(), Type: model.ChannelTypeOpen, } _, err = ss.Channel().Save(rctx, &o1, -1) @@ -4572,7 +4572,7 @@ func testChannelStoreGetMembersForUserWithPagination(t *testing.T, rctx request. t2 := model.Team{ DisplayName: "team2", - Name: NewTestId(), + Name: NewTestID(), Email: MakeEmail(), Type: model.TeamOpen, } @@ -4582,7 +4582,7 @@ func testChannelStoreGetMembersForUserWithPagination(t *testing.T, rctx request. o2 := model.Channel{ TeamId: t2.Id, DisplayName: "Channel2", - Name: NewTestId(), + Name: NewTestID(), Type: model.ChannelTypeOpen, } _, err = ss.Channel().Save(rctx, &o2, -1) @@ -4618,151 +4618,151 @@ func testChannelStoreGetMembersForUserWithPagination(t *testing.T, rctx request. func testCountPostsAfter(t *testing.T, rctx request.CTX, ss store.Store) { t.Run("should count all posts with or without the given user ID", func(t *testing.T) { - userId1 := model.NewId() - userId2 := model.NewId() - userId3 := model.NewId() + userID1 := model.NewId() + userID2 := model.NewId() + userID3 := model.NewId() - channelId := model.NewId() + channelID := model.NewId() p1, err := ss.Post().Save(rctx, &model.Post{ - UserId: userId1, - ChannelId: channelId, + UserId: userID1, + ChannelId: channelID, CreateAt: 1000, }) require.NoError(t, err) _, err = ss.Post().Save(rctx, &model.Post{ - UserId: userId1, - ChannelId: channelId, + UserId: userID1, + ChannelId: channelID, CreateAt: 1001, }) require.NoError(t, err) _, err = ss.Post().Save(rctx, &model.Post{ - UserId: userId2, - ChannelId: channelId, + UserId: userID2, + ChannelId: channelID, CreateAt: 1002, }) require.NoError(t, err) _, err = ss.Post().Save(rctx, &model.Post{ - UserId: userId3, - ChannelId: channelId, + UserId: userID3, + ChannelId: channelID, CreateAt: 1003, }) require.NoError(t, err) - count, _, err := ss.Channel().CountPostsAfter(channelId, p1.CreateAt-1, "") + count, _, err := ss.Channel().CountPostsAfter(channelID, p1.CreateAt-1, "") require.NoError(t, err) assert.Equal(t, 4, count) - count, _, err = ss.Channel().CountPostsAfter(channelId, p1.CreateAt, "") + count, _, err = ss.Channel().CountPostsAfter(channelID, p1.CreateAt, "") require.NoError(t, err) assert.Equal(t, 3, count) - count, _, err = ss.Channel().CountPostsAfter(channelId, p1.CreateAt-1, userId2) + count, _, err = ss.Channel().CountPostsAfter(channelID, p1.CreateAt-1, userID2) require.NoError(t, err) assert.Equal(t, 3, count) - count, _, err = ss.Channel().CountPostsAfter(channelId, p1.CreateAt, userId2) + count, _, err = ss.Channel().CountPostsAfter(channelID, p1.CreateAt, userID2) require.NoError(t, err) assert.Equal(t, 2, count) }) t.Run("should not count deleted posts", func(t *testing.T) { - userId1 := model.NewId() + userID1 := model.NewId() - channelId := model.NewId() + channelID := model.NewId() p1, err := ss.Post().Save(rctx, &model.Post{ - UserId: userId1, - ChannelId: channelId, + UserId: userID1, + ChannelId: channelID, CreateAt: 1000, }) require.NoError(t, err) _, err = ss.Post().Save(rctx, &model.Post{ - UserId: userId1, - ChannelId: channelId, + UserId: userID1, + ChannelId: channelID, CreateAt: 1001, DeleteAt: 1001, }) require.NoError(t, err) - count, _, err := ss.Channel().CountPostsAfter(channelId, p1.CreateAt-1, "") + count, _, err := ss.Channel().CountPostsAfter(channelID, p1.CreateAt-1, "") require.NoError(t, err) assert.Equal(t, 1, count) - count, _, err = ss.Channel().CountPostsAfter(channelId, p1.CreateAt, "") + count, _, err = ss.Channel().CountPostsAfter(channelID, p1.CreateAt, "") require.NoError(t, err) assert.Equal(t, 0, count) }) t.Run("should count system/bot messages, but not join/leave messages", func(t *testing.T) { - userId1 := model.NewId() + userID1 := model.NewId() - channelId := model.NewId() + channelID := model.NewId() p1, err := ss.Post().Save(rctx, &model.Post{ - UserId: userId1, - ChannelId: channelId, + UserId: userID1, + ChannelId: channelID, CreateAt: 1000, }) require.NoError(t, err) _, err = ss.Post().Save(rctx, &model.Post{ - UserId: userId1, - ChannelId: channelId, + UserId: userID1, + ChannelId: channelID, CreateAt: 1001, Type: model.PostTypeJoinChannel, }) require.NoError(t, err) _, err = ss.Post().Save(rctx, &model.Post{ - UserId: userId1, - ChannelId: channelId, + UserId: userID1, + ChannelId: channelID, CreateAt: 1002, Type: model.PostTypeRemoveFromChannel, }) require.NoError(t, err) _, err = ss.Post().Save(rctx, &model.Post{ - UserId: userId1, - ChannelId: channelId, + UserId: userID1, + ChannelId: channelID, CreateAt: 1003, Type: model.PostTypeLeaveTeam, }) require.NoError(t, err) p5, err := ss.Post().Save(rctx, &model.Post{ - UserId: userId1, - ChannelId: channelId, + UserId: userID1, + ChannelId: channelID, CreateAt: 1004, Type: model.PostTypeHeaderChange, }) require.NoError(t, err) _, err = ss.Post().Save(rctx, &model.Post{ - UserId: userId1, - ChannelId: channelId, + UserId: userID1, + ChannelId: channelID, CreateAt: 1005, Type: "custom_nps_survey", }) require.NoError(t, err) - count, _, err := ss.Channel().CountPostsAfter(channelId, p1.CreateAt-1, "") + count, _, err := ss.Channel().CountPostsAfter(channelID, p1.CreateAt-1, "") require.NoError(t, err) assert.Equal(t, 3, count) - count, _, err = ss.Channel().CountPostsAfter(channelId, p1.CreateAt, "") + count, _, err = ss.Channel().CountPostsAfter(channelID, p1.CreateAt, "") require.NoError(t, err) assert.Equal(t, 2, count) - count, _, err = ss.Channel().CountPostsAfter(channelId, p5.CreateAt-1, "") + count, _, err = ss.Channel().CountPostsAfter(channelID, p5.CreateAt-1, "") require.NoError(t, err) assert.Equal(t, 2, count) - count, _, err = ss.Channel().CountPostsAfter(channelId, p5.CreateAt, "") + count, _, err = ss.Channel().CountPostsAfter(channelID, p5.CreateAt, "") require.NoError(t, err) assert.Equal(t, 1, count) }) @@ -4770,15 +4770,15 @@ func testCountPostsAfter(t *testing.T, rctx request.CTX, ss store.Store) { func testCountUrgentPostsAfter(t *testing.T, rctx request.CTX, ss store.Store) { t.Run("should count all posts with or without the given user ID", func(t *testing.T) { - userId1 := model.NewId() - userId2 := model.NewId() - userId3 := model.NewId() + userID1 := model.NewId() + userID2 := model.NewId() + userID3 := model.NewId() - channelId := model.NewId() + channelID := model.NewId() p1, err := ss.Post().Save(rctx, &model.Post{ - UserId: userId1, - ChannelId: channelId, + UserId: userID1, + ChannelId: channelID, CreateAt: 1000, Metadata: &model.PostMetadata{ Priority: &model.PostPriority{ @@ -4791,8 +4791,8 @@ func testCountUrgentPostsAfter(t *testing.T, rctx request.CTX, ss store.Store) { require.NoError(t, err) _, err = ss.Post().Save(rctx, &model.Post{ - UserId: userId1, - ChannelId: channelId, + UserId: userID1, + ChannelId: channelID, CreateAt: 1001, Metadata: &model.PostMetadata{ Priority: &model.PostPriority{ @@ -4805,15 +4805,15 @@ func testCountUrgentPostsAfter(t *testing.T, rctx request.CTX, ss store.Store) { require.NoError(t, err) _, err = ss.Post().Save(rctx, &model.Post{ - UserId: userId2, - ChannelId: channelId, + UserId: userID2, + ChannelId: channelID, CreateAt: 1002, }) require.NoError(t, err) _, err = ss.Post().Save(rctx, &model.Post{ - UserId: userId3, - ChannelId: channelId, + UserId: userID3, + ChannelId: channelID, CreateAt: 1003, Metadata: &model.PostMetadata{ Priority: &model.PostPriority{ @@ -4825,19 +4825,19 @@ func testCountUrgentPostsAfter(t *testing.T, rctx request.CTX, ss store.Store) { }) require.NoError(t, err) - count, err := ss.Channel().CountUrgentPostsAfter(channelId, p1.CreateAt-1, "") + count, err := ss.Channel().CountUrgentPostsAfter(channelID, p1.CreateAt-1, "") require.NoError(t, err) assert.Equal(t, 2, count) - count, err = ss.Channel().CountUrgentPostsAfter(channelId, p1.CreateAt, "") + count, err = ss.Channel().CountUrgentPostsAfter(channelID, p1.CreateAt, "") require.NoError(t, err) assert.Equal(t, 1, count) - count, err = ss.Channel().CountUrgentPostsAfter(channelId, p1.CreateAt-1, userId3) + count, err = ss.Channel().CountUrgentPostsAfter(channelID, p1.CreateAt-1, userID3) require.NoError(t, err) assert.Equal(t, 1, count) - count, err = ss.Channel().CountUrgentPostsAfter(channelId, p1.CreateAt, userId3) + count, err = ss.Channel().CountUrgentPostsAfter(channelID, p1.CreateAt, userID3) require.NoError(t, err) assert.Equal(t, 0, count) }) @@ -4847,7 +4847,7 @@ func testChannelStoreUpdateLastViewedAt(t *testing.T, rctx request.CTX, ss store o1 := model.Channel{} o1.TeamId = model.NewId() o1.DisplayName = "Channel1" - o1.Name = NewTestId() + o1.Name = NewTestID() o1.Type = model.ChannelTypeOpen o1.TotalMsgCount = 25 o1.LastPostAt = 12345 @@ -4865,7 +4865,7 @@ func testChannelStoreUpdateLastViewedAt(t *testing.T, rctx request.CTX, ss store o2 := model.Channel{} o2.TeamId = model.NewId() o2.DisplayName = "Channel1" - o2.Name = NewTestId() + "c" + o2.Name = NewTestID() + "c" o2.Type = model.ChannelTypeOpen o2.TotalMsgCount = 26 o2.LastPostAt = 123456 @@ -4909,7 +4909,7 @@ func testChannelStoreIncrementMentionCount(t *testing.T, rctx request.CTX, ss st o1 := model.Channel{} o1.TeamId = model.NewId() o1.DisplayName = "Channel1" - o1.Name = NewTestId() + o1.Name = NewTestID() o1.Type = model.ChannelTypeOpen o1.TotalMsgCount = 25 _, nErr := ss.Channel().Save(rctx, &o1, -1) @@ -4936,7 +4936,7 @@ func testChannelStoreIncrementMentionCount(t *testing.T, rctx request.CTX, ss st } func testUpdateChannelMember(t *testing.T, rctx request.CTX, ss store.Store) { - userId := model.NewId() + userID := model.NewId() c1 := &model.Channel{ TeamId: model.NewId(), @@ -4949,7 +4949,7 @@ func testUpdateChannelMember(t *testing.T, rctx request.CTX, ss store.Store) { m1 := &model.ChannelMember{ ChannelId: c1.Id, - UserId: userId, + UserId: userID, NotifyProps: model.GetDefaultChannelNotifyProps(), } _, err := ss.Channel().SaveMember(rctx, m1) @@ -4965,7 +4965,7 @@ func testUpdateChannelMember(t *testing.T, rctx request.CTX, ss store.Store) { } func testGetMember(t *testing.T, rctx request.CTX, ss store.Store) { - userId := model.NewId() + userID := model.NewId() c1 := &model.Channel{ TeamId: model.NewId(), @@ -4987,7 +4987,7 @@ func testGetMember(t *testing.T, rctx request.CTX, ss store.Store) { m1 := &model.ChannelMember{ ChannelId: c1.Id, - UserId: userId, + UserId: userID, NotifyProps: model.GetDefaultChannelNotifyProps(), } _, err := ss.Channel().SaveMember(rctx, m1) @@ -4995,27 +4995,27 @@ func testGetMember(t *testing.T, rctx request.CTX, ss store.Store) { m2 := &model.ChannelMember{ ChannelId: c2.Id, - UserId: userId, + UserId: userID, NotifyProps: model.GetDefaultChannelNotifyProps(), } _, err = ss.Channel().SaveMember(rctx, m2) require.NoError(t, err) - _, err = ss.Channel().GetMember(context.Background(), model.NewId(), userId) + _, err = ss.Channel().GetMember(context.Background(), model.NewId(), userID) require.Error(t, err, "should've failed to get member for non-existent channel") _, err = ss.Channel().GetMember(context.Background(), c1.Id, model.NewId()) require.Error(t, err, "should've failed to get member for non-existent user") - member, err := ss.Channel().GetMember(context.Background(), c1.Id, userId) + member, err := ss.Channel().GetMember(context.Background(), c1.Id, userID) require.NoError(t, err, "shouldn't have errored when getting member", err) require.Equal(t, c1.Id, member.ChannelId, "should've gotten member of channel 1") - require.Equal(t, userId, member.UserId, "should've have gotten member for user") + require.Equal(t, userID, member.UserId, "should've have gotten member for user") - member, err = ss.Channel().GetMember(context.Background(), c2.Id, userId) + member, err = ss.Channel().GetMember(context.Background(), c2.Id, userID) require.NoError(t, err, "shouldn't have errored when getting member", err) require.Equal(t, c2.Id, member.ChannelId, "should've gotten member of channel 2") - require.Equal(t, userId, member.UserId, "should've gotten member for user") + require.Equal(t, userID, member.UserId, "should've gotten member for user") props, err := ss.Channel().GetAllChannelMembersNotifyPropsForChannel(c2.Id, false) require.NoError(t, err, err) @@ -5029,7 +5029,7 @@ func testGetMember(t *testing.T, rctx request.CTX, ss store.Store) { } func testGetMemberLastViewedAt(t *testing.T, rctx request.CTX, ss store.Store) { - userId := model.NewId() + userID := model.NewId() c1 := &model.Channel{ TeamId: model.NewId(), @@ -5051,7 +5051,7 @@ func testGetMemberLastViewedAt(t *testing.T, rctx request.CTX, ss store.Store) { m1 := &model.ChannelMember{ ChannelId: c1.Id, - UserId: userId, + UserId: userID, NotifyProps: model.GetDefaultChannelNotifyProps(), LastViewedAt: int64(100), } @@ -5060,24 +5060,24 @@ func testGetMemberLastViewedAt(t *testing.T, rctx request.CTX, ss store.Store) { m2 := &model.ChannelMember{ ChannelId: c2.Id, - UserId: userId, + UserId: userID, NotifyProps: model.GetDefaultChannelNotifyProps(), LastViewedAt: int64(200), } _, err = ss.Channel().SaveMember(rctx, m2) require.NoError(t, err) - _, err = ss.Channel().GetMemberLastViewedAt(context.Background(), model.NewId(), userId) + _, err = ss.Channel().GetMemberLastViewedAt(context.Background(), model.NewId(), userID) require.Error(t, err, "should've failed to get member for non-existent channel") _, err = ss.Channel().GetMemberLastViewedAt(context.Background(), c1.Id, model.NewId()) require.Error(t, err, "should've failed to get member for non-existent user") - lvAt, err := ss.Channel().GetMemberLastViewedAt(context.Background(), c1.Id, userId) + lvAt, err := ss.Channel().GetMemberLastViewedAt(context.Background(), c1.Id, userID) require.NoError(t, err, "shouldn't have errored when getting member", err) require.Equal(t, m1.LastViewedAt, lvAt, "should've gotten LastViewedAt of channel 1") - lvAt, err = ss.Channel().GetMemberLastViewedAt(context.Background(), c2.Id, userId) + lvAt, err = ss.Channel().GetMemberLastViewedAt(context.Background(), c2.Id, userID) require.NoError(t, err, "shouldn't have errored when getting member", err) require.Equal(t, m2.LastViewedAt, lvAt, "should've gotten gotten LastViewedAt of channel 2") @@ -5088,7 +5088,7 @@ func testChannelStoreGetMemberForPost(t *testing.T, rctx request.CTX, ss store.S ch := &model.Channel{ TeamId: model.NewId(), DisplayName: "Name", - Name: NewTestId(), + Name: NewTestID(), Type: model.ChannelTypeOpen, } @@ -5118,21 +5118,21 @@ func testChannelStoreGetMemberForPost(t *testing.T, rctx request.CTX, ss store.S } func testGetMemberCount(t *testing.T, rctx request.CTX, ss store.Store) { - teamId := model.NewId() + teamID := model.NewId() c1 := model.Channel{ - TeamId: teamId, + TeamId: teamID, DisplayName: "Channel1", - Name: NewTestId(), + Name: NewTestID(), Type: model.ChannelTypeOpen, } _, nErr := ss.Channel().Save(rctx, &c1, -1) require.NoError(t, nErr) c2 := model.Channel{ - TeamId: teamId, + TeamId: teamID, DisplayName: "Channel2", - Name: NewTestId(), + Name: NewTestID(), Type: model.ChannelTypeOpen, } _, nErr = ss.Channel().Save(rctx, &c2, -1) @@ -5144,7 +5144,7 @@ func testGetMemberCount(t *testing.T, rctx request.CTX, ss store.Store) { } _, err := ss.User().Save(rctx, u1) require.NoError(t, err) - _, nErr = ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamId, UserId: u1.Id}, -1) + _, nErr = ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamID, UserId: u1.Id}, -1) require.NoError(t, nErr) m1 := model.ChannelMember{ @@ -5165,7 +5165,7 @@ func testGetMemberCount(t *testing.T, rctx request.CTX, ss store.Store) { } _, err = ss.User().Save(rctx, &u2) require.NoError(t, err) - _, nErr = ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamId, UserId: u2.Id}, -1) + _, nErr = ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamID, UserId: u2.Id}, -1) require.NoError(t, nErr) m2 := model.ChannelMember{ @@ -5187,7 +5187,7 @@ func testGetMemberCount(t *testing.T, rctx request.CTX, ss store.Store) { } _, err = ss.User().Save(rctx, &u3) require.NoError(t, err) - _, nErr = ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamId, UserId: u3.Id}, -1) + _, nErr = ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamID, UserId: u3.Id}, -1) require.NoError(t, nErr) m3 := model.ChannelMember{ @@ -5209,7 +5209,7 @@ func testGetMemberCount(t *testing.T, rctx request.CTX, ss store.Store) { } _, err = ss.User().Save(rctx, u4) require.NoError(t, err) - _, nErr = ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamId, UserId: u4.Id}, -1) + _, nErr = ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamID, UserId: u4.Id}, -1) require.NoError(t, nErr) m4 := model.ChannelMember{ @@ -5227,7 +5227,7 @@ func testGetMemberCount(t *testing.T, rctx request.CTX, ss store.Store) { func testGetMemberCountsByGroup(t *testing.T, rctx request.CTX, ss store.Store) { var memberCounts []*model.ChannelMemberCountByGroup - teamId := model.NewId() + teamID := model.NewId() g1 := &model.Group{ Name: model.NewPointer(model.NewId()), DisplayName: model.NewId(), @@ -5238,9 +5238,9 @@ func testGetMemberCountsByGroup(t *testing.T, rctx request.CTX, ss store.Store) require.NoError(t, err) c1 := model.Channel{ - TeamId: teamId, + TeamId: teamID, DisplayName: "Channel1", - Name: NewTestId(), + Name: NewTestID(), Type: model.ChannelTypeOpen, } _, nErr := ss.Channel().Save(rctx, &c1, -1) @@ -5253,7 +5253,7 @@ func testGetMemberCountsByGroup(t *testing.T, rctx request.CTX, ss store.Store) } _, nErr = ss.User().Save(rctx, u1) require.NoError(t, nErr) - _, nErr = ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamId, UserId: u1.Id}, -1) + _, nErr = ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamID, UserId: u1.Id}, -1) require.NoError(t, nErr) m1 := model.ChannelMember{ @@ -5324,7 +5324,7 @@ func testGetMemberCountsByGroup(t *testing.T, rctx request.CTX, ss store.Store) } _, nErr = ss.User().Save(rctx, u) require.NoError(t, nErr) - _, nErr = ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamId, UserId: u.Id}, -1) + _, nErr = ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamID, UserId: u.Id}, -1) require.NoError(t, nErr) m := model.ChannelMember{ @@ -5378,7 +5378,7 @@ func testGetMemberCountsByGroup(t *testing.T, rctx request.CTX, ss store.Store) } _, nErr = ss.User().Save(rctx, u) require.NoError(t, nErr) - _, nErr = ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamId, UserId: u.Id}, -1) + _, nErr = ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamID, UserId: u.Id}, -1) require.NoError(t, nErr) m := model.ChannelMember{ @@ -5441,21 +5441,21 @@ func testGetMemberCountsByGroup(t *testing.T, rctx request.CTX, ss store.Store) } func testGetGuestCount(t *testing.T, rctx request.CTX, ss store.Store) { - teamId := model.NewId() + teamID := model.NewId() c1 := model.Channel{ - TeamId: teamId, + TeamId: teamID, DisplayName: "Channel1", - Name: NewTestId(), + Name: NewTestID(), Type: model.ChannelTypeOpen, } _, nErr := ss.Channel().Save(rctx, &c1, -1) require.NoError(t, nErr) c2 := model.Channel{ - TeamId: teamId, + TeamId: teamID, DisplayName: "Channel2", - Name: NewTestId(), + Name: NewTestID(), Type: model.ChannelTypeOpen, } _, nErr = ss.Channel().Save(rctx, &c2, -1) @@ -5469,7 +5469,7 @@ func testGetGuestCount(t *testing.T, rctx request.CTX, ss store.Store) { } _, err := ss.User().Save(rctx, u1) require.NoError(t, err) - _, nErr = ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamId, UserId: u1.Id}, -1) + _, nErr = ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamID, UserId: u1.Id}, -1) require.NoError(t, nErr) m1 := model.ChannelMember{ @@ -5494,7 +5494,7 @@ func testGetGuestCount(t *testing.T, rctx request.CTX, ss store.Store) { } _, err := ss.User().Save(rctx, &u2) require.NoError(t, err) - _, nErr = ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamId, UserId: u2.Id}, -1) + _, nErr = ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamID, UserId: u2.Id}, -1) require.NoError(t, nErr) m2 := model.ChannelMember{ @@ -5519,7 +5519,7 @@ func testGetGuestCount(t *testing.T, rctx request.CTX, ss store.Store) { } _, err := ss.User().Save(rctx, &u3) require.NoError(t, err) - _, nErr = ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamId, UserId: u3.Id}, -1) + _, nErr = ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamID, UserId: u3.Id}, -1) require.NoError(t, nErr) m3 := model.ChannelMember{ @@ -5544,7 +5544,7 @@ func testGetGuestCount(t *testing.T, rctx request.CTX, ss store.Store) { } _, err := ss.User().Save(rctx, u4) require.NoError(t, err) - _, nErr = ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamId, UserId: u4.Id}, -1) + _, nErr = ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamID, UserId: u4.Id}, -1) require.NoError(t, nErr) m4 := model.ChannelMember{ @@ -5563,13 +5563,13 @@ func testGetGuestCount(t *testing.T, rctx request.CTX, ss store.Store) { } func testChannelStoreSearchMore(t *testing.T, rctx request.CTX, ss store.Store) { - teamId := model.NewId() - otherTeamId := model.NewId() + teamID := model.NewId() + otherTeamID := model.NewId() o1 := model.Channel{ - TeamId: teamId, + TeamId: teamID, DisplayName: "ChannelA", - Name: NewTestId(), + Name: NewTestID(), Type: model.ChannelTypeOpen, } _, nErr := ss.Channel().Save(rctx, &o1, -1) @@ -5592,9 +5592,9 @@ func testChannelStoreSearchMore(t *testing.T, rctx request.CTX, ss store.Store) require.NoError(t, err) o2 := model.Channel{ - TeamId: otherTeamId, + TeamId: otherTeamID, DisplayName: "Channel2", - Name: NewTestId(), + Name: NewTestID(), Type: model.ChannelTypeOpen, } _, nErr = ss.Channel().Save(rctx, &o2, -1) @@ -5609,34 +5609,34 @@ func testChannelStoreSearchMore(t *testing.T, rctx request.CTX, ss store.Store) require.NoError(t, err) o3 := model.Channel{ - TeamId: teamId, + TeamId: teamID, DisplayName: "ChannelA", - Name: NewTestId(), + Name: NewTestID(), Type: model.ChannelTypeOpen, } _, nErr = ss.Channel().Save(rctx, &o3, -1) require.NoError(t, nErr) o4 := model.Channel{ - TeamId: teamId, + TeamId: teamID, DisplayName: "ChannelB", - Name: NewTestId(), + Name: NewTestID(), Type: model.ChannelTypePrivate, } _, nErr = ss.Channel().Save(rctx, &o4, -1) require.NoError(t, nErr) o5 := model.Channel{ - TeamId: teamId, + TeamId: teamID, DisplayName: "ChannelC", - Name: NewTestId(), + Name: NewTestID(), Type: model.ChannelTypePrivate, } _, nErr = ss.Channel().Save(rctx, &o5, -1) require.NoError(t, nErr) o6 := model.Channel{ - TeamId: teamId, + TeamId: teamID, DisplayName: "Off-Topic", Name: "off-topic", Type: model.ChannelTypeOpen, @@ -5645,7 +5645,7 @@ func testChannelStoreSearchMore(t *testing.T, rctx request.CTX, ss store.Store) require.NoError(t, nErr) o7 := model.Channel{ - TeamId: teamId, + TeamId: teamID, DisplayName: "Off-Set", Name: "off-set", Type: model.ChannelTypeOpen, @@ -5654,7 +5654,7 @@ func testChannelStoreSearchMore(t *testing.T, rctx request.CTX, ss store.Store) require.NoError(t, nErr) o8 := model.Channel{ - TeamId: teamId, + TeamId: teamID, DisplayName: "Off-Limit", Name: "off-limit", Type: model.ChannelTypePrivate, @@ -5663,7 +5663,7 @@ func testChannelStoreSearchMore(t *testing.T, rctx request.CTX, ss store.Store) require.NoError(t, nErr) o9 := model.Channel{ - TeamId: teamId, + TeamId: teamID, DisplayName: "Channel With Purpose", Purpose: "This can now be searchable!", Name: "with-purpose", @@ -5673,7 +5673,7 @@ func testChannelStoreSearchMore(t *testing.T, rctx request.CTX, ss store.Store) require.NoError(t, nErr) o10 := model.Channel{ - TeamId: teamId, + TeamId: teamID, DisplayName: "ChannelA", Name: "channel-a-deleted", Type: model.ChannelTypeOpen, @@ -5687,31 +5687,31 @@ func testChannelStoreSearchMore(t *testing.T, rctx request.CTX, ss store.Store) require.NoError(t, nErr, "channel should have been deleted") 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") + channels, err := ss.Channel().SearchMore(m1.UserId, teamID, "ChannelA") require.NoError(t, err) 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) + channels, err := ss.Channel().SearchMore(m1.UserId, teamID, o4.Name) require.NoError(t, err) 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-") + channels, err := ss.Channel().SearchMore(m1.UserId, teamID, "off-") require.NoError(t, err) 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") + channels, err := ss.Channel().SearchMore(m1.UserId, teamID, "off-topic") require.NoError(t, err) 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") + channels, err := ss.Channel().SearchMore(m1.UserId, teamID, "now searchable") require.NoError(t, err) require.Equal(t, model.ChannelList{&o9}, channels) }) @@ -5732,12 +5732,12 @@ func (s ByChannelDisplayName) Less(i, j int) bool { } func testChannelStoreSearchArchivedInTeam(t *testing.T, rctx request.CTX, ss store.Store, s SqlStore) { - teamId := model.NewId() - userId := model.NewId() + teamID := model.NewId() + userID := model.NewId() o1 := model.Channel{} - o1.TeamId = teamId + o1.TeamId = teamID o1.DisplayName = "Channel1" - o1.Name = NewTestId() + o1.Name = NewTestID() o1.Type = model.ChannelTypeOpen _, nErr := ss.Channel().Save(rctx, &o1, -1) require.NoError(t, nErr) @@ -5747,7 +5747,7 @@ func testChannelStoreSearchArchivedInTeam(t *testing.T, rctx request.CTX, ss sto require.NoError(t, nErr) t.Run("empty result", func(t *testing.T) { - list, err := ss.Channel().SearchArchivedInTeam(teamId, "term", userId) + list, err := ss.Channel().SearchArchivedInTeam(teamID, "term", userID) require.NoError(t, err) require.NotNil(t, list) require.Empty(t, list) @@ -5758,13 +5758,13 @@ func testChannelStoreSearchArchivedInTeam(t *testing.T, rctx request.CTX, ss sto s.GetMasterX().Exec("ALTER TABLE Channels RENAME TO Channels_renamed") defer s.GetMasterX().Exec("ALTER TABLE Channels_renamed RENAME TO Channels") - list, err := ss.Channel().SearchArchivedInTeam(teamId, "term", userId) + list, err := ss.Channel().SearchArchivedInTeam(teamID, "term", userID) require.Error(t, err) require.Nil(t, list) }) t.Run("find term", func(t *testing.T) { - list, err := ss.Channel().SearchArchivedInTeam(teamId, "Channel", userId) + list, err := ss.Channel().SearchArchivedInTeam(teamID, "Channel", userID) require.NoError(t, err) require.NotNil(t, list) require.Equal(t, len(list), 1) @@ -5779,7 +5779,7 @@ func testChannelStoreSearchInTeam(t *testing.T, rctx request.CTX, ss store.Store o1 := model.Channel{ TeamId: teamID, DisplayName: "ChannelA", - Name: NewTestId(), + Name: NewTestID(), Type: model.ChannelTypeOpen, } _, nErr := ss.Channel().Save(rctx, &o1, -1) @@ -5788,7 +5788,7 @@ func testChannelStoreSearchInTeam(t *testing.T, rctx request.CTX, ss store.Store o2 := model.Channel{ TeamId: otherTeamID, DisplayName: "ChannelA", - Name: NewTestId(), + Name: NewTestID(), Type: model.ChannelTypeOpen, } _, nErr = ss.Channel().Save(rctx, &o2, -1) @@ -5821,7 +5821,7 @@ func testChannelStoreSearchInTeam(t *testing.T, rctx request.CTX, ss store.Store o3 := model.Channel{ TeamId: teamID, DisplayName: "ChannelA (alternate)", - Name: NewTestId(), + Name: NewTestID(), Type: model.ChannelTypeOpen, } _, nErr = ss.Channel().Save(rctx, &o3, -1) @@ -5830,7 +5830,7 @@ func testChannelStoreSearchInTeam(t *testing.T, rctx request.CTX, ss store.Store o4 := model.Channel{ TeamId: teamID, DisplayName: "Channel B", - Name: NewTestId(), + Name: NewTestID(), Type: model.ChannelTypePrivate, } _, nErr = ss.Channel().Save(rctx, &o4, -1) @@ -5847,7 +5847,7 @@ func testChannelStoreSearchInTeam(t *testing.T, rctx request.CTX, ss store.Store o5 := model.Channel{ TeamId: teamID, DisplayName: "Channel C", - Name: NewTestId(), + Name: NewTestID(), Type: model.ChannelTypePrivate, } _, nErr = ss.Channel().Save(rctx, &o5, -1) @@ -5994,7 +5994,7 @@ func testChannelStoreSearchInTeam(t *testing.T, rctx request.CTX, ss store.Store func testAutocomplete(t *testing.T, rctx request.CTX, ss store.Store, s SqlStore) { t1 := &model.Team{ DisplayName: "t1", - Name: NewTestId(), + Name: NewTestID(), Email: MakeEmail(), Type: model.TeamOpen, } @@ -6004,7 +6004,7 @@ func testAutocomplete(t *testing.T, rctx request.CTX, ss store.Store, s SqlStore t2 := &model.Team{ DisplayName: "t2", - Name: NewTestId(), + Name: NewTestID(), Email: MakeEmail(), Type: model.TeamOpen, } @@ -6015,7 +6015,7 @@ func testAutocomplete(t *testing.T, rctx request.CTX, ss store.Store, s SqlStore o1 := model.Channel{ TeamId: teamID, DisplayName: "ChannelA1", - Name: NewTestId(), + Name: NewTestID(), Type: model.ChannelTypeOpen, } _, err = ss.Channel().Save(rctx, &o1, -1) @@ -6024,7 +6024,7 @@ func testAutocomplete(t *testing.T, rctx request.CTX, ss store.Store, s SqlStore o2 := model.Channel{ TeamId: otherTeamID, DisplayName: "ChannelA2", - Name: NewTestId(), + Name: NewTestID(), Type: model.ChannelTypeOpen, } _, err = ss.Channel().Save(rctx, &o2, -1) @@ -6033,7 +6033,7 @@ func testAutocomplete(t *testing.T, rctx request.CTX, ss store.Store, s SqlStore o6 := model.Channel{ TeamId: teamID, DisplayName: "ChannelA3", - Name: NewTestId(), + Name: NewTestID(), Type: model.ChannelTypeOpen, } _, err = ss.Channel().Save(rctx, &o6, -1) @@ -6082,7 +6082,7 @@ func testAutocomplete(t *testing.T, rctx request.CTX, ss store.Store, s SqlStore o3 := model.Channel{ TeamId: teamID, DisplayName: "ChannelA private", - Name: NewTestId(), + Name: NewTestID(), Type: model.ChannelTypePrivate, } _, err = ss.Channel().Save(rctx, &o3, -1) @@ -6091,7 +6091,7 @@ func testAutocomplete(t *testing.T, rctx request.CTX, ss store.Store, s SqlStore o4 := model.Channel{ TeamId: otherTeamID, DisplayName: "ChannelB", - Name: NewTestId(), + Name: NewTestID(), Type: model.ChannelTypePrivate, } _, err = ss.Channel().Save(rctx, &o4, -1) @@ -6115,18 +6115,18 @@ func testAutocomplete(t *testing.T, rctx request.CTX, ss store.Store, s SqlStore t3 := &model.Team{ DisplayName: "t3", - Name: NewTestId(), + Name: NewTestID(), Email: MakeEmail(), Type: model.TeamOpen, } t3, err = ss.Team().Save(t3) require.NoError(t, err) - leftTeamId := t3.Id + leftTeamID := t3.Id o5 := model.Channel{ - TeamId: leftTeamId, + TeamId: leftTeamID, DisplayName: "ChannelA3", - Name: NewTestId(), + Name: NewTestID(), Type: model.ChannelTypeOpen, } _, err = ss.Channel().Save(rctx, &o5, -1) @@ -6140,7 +6140,7 @@ func testAutocomplete(t *testing.T, rctx request.CTX, ss store.Store, s SqlStore _, err = ss.Channel().SaveMember(rctx, &m6) require.NoError(t, err) - tm5 := &model.TeamMember{TeamId: leftTeamId, UserId: m1.UserId} + tm5 := &model.TeamMember{TeamId: leftTeamID, UserId: m1.UserId} _, err = ss.Team().SaveMember(rctx, tm5, -1) require.NoError(t, err) @@ -6189,7 +6189,7 @@ func testAutocomplete(t *testing.T, rctx request.CTX, ss store.Store, s SqlStore _, err = ss.Channel().Save(rctx, &model.Channel{ TeamId: teamID, DisplayName: "Channel " + strconv.Itoa(i), - Name: NewTestId(), + Name: NewTestID(), Type: model.ChannelTypeOpen, }, -1) require.NoError(t, err) @@ -6204,51 +6204,51 @@ func testAutocomplete(t *testing.T, rctx request.CTX, ss store.Store, s SqlStore } func testChannelStoreSearchForUserInTeam(t *testing.T, rctx request.CTX, ss store.Store) { - userId := model.NewId() - teamId := model.NewId() - otherTeamId := model.NewId() + userID := model.NewId() + teamID := model.NewId() + otherTeamID := model.NewId() // create 4 channels for the same team and one for other team o1 := model.Channel{ - TeamId: teamId, + TeamId: teamID, DisplayName: "test-dev-1", - Name: NewTestId(), + Name: NewTestID(), Type: model.ChannelTypeOpen, } _, nErr := ss.Channel().Save(rctx, &o1, -1) require.NoError(t, nErr) o2 := model.Channel{ - TeamId: teamId, + TeamId: teamID, DisplayName: "test-dev-2", - Name: NewTestId(), + Name: NewTestID(), Type: model.ChannelTypeOpen, } _, nErr = ss.Channel().Save(rctx, &o2, -1) require.NoError(t, nErr) o3 := model.Channel{ - TeamId: teamId, + TeamId: teamID, DisplayName: "dev-3", - Name: NewTestId(), + Name: NewTestID(), Type: model.ChannelTypeOpen, } _, nErr = ss.Channel().Save(rctx, &o3, -1) require.NoError(t, nErr) o4 := model.Channel{ - TeamId: teamId, + TeamId: teamID, DisplayName: "dev-4", - Name: NewTestId(), + Name: NewTestID(), Type: model.ChannelTypeOpen, } _, nErr = ss.Channel().Save(rctx, &o4, -1) require.NoError(t, nErr) o5 := model.Channel{ - TeamId: otherTeamId, + TeamId: otherTeamID, DisplayName: "other-team-dev-5", - Name: NewTestId(), + Name: NewTestID(), Type: model.ChannelTypeOpen, } _, nErr = ss.Channel().Save(rctx, &o5, -1) @@ -6258,14 +6258,14 @@ func testChannelStoreSearchForUserInTeam(t *testing.T, rctx request.CTX, ss stor for _, c := range []model.Channel{o1, o2, o3, o5} { _, err := ss.Channel().SaveMember(rctx, &model.ChannelMember{ ChannelId: c.Id, - UserId: userId, + UserId: userID, NotifyProps: model.GetDefaultChannelNotifyProps(), }) require.NoError(t, err) } searchAndCheck := func(t *testing.T, term string, includeDeleted bool, expectedDisplayNames []string) { - res, searchErr := ss.Channel().SearchForUserInTeam(userId, teamId, term, includeDeleted) + res, searchErr := ss.Channel().SearchForUserInTeam(userID, teamID, term, includeDeleted) require.NoError(t, searchErr) require.Len(t, res, len(expectedDisplayNames)) @@ -6287,7 +6287,7 @@ func testChannelStoreSearchForUserInTeam(t *testing.T, rctx request.CTX, ss stor t.Run("After adding user to channel 4, search for dev, get channels 1, 2, 3 and 4", func(t *testing.T) { _, err := ss.Channel().SaveMember(rctx, &model.ChannelMember{ ChannelId: o4.Id, - UserId: userId, + UserId: userID, NotifyProps: model.GetDefaultChannelNotifyProps(), }) require.NoError(t, err) @@ -6314,7 +6314,7 @@ func testChannelStoreSearchAllChannels(t *testing.T, rctx request.CTX, ss store. t1 := model.Team{} t1.DisplayName = "Name" - t1.Name = NewTestId() + t1.Name = NewTestID() t1.Email = MakeEmail() t1.Type = model.TeamOpen _, err := ss.Team().Save(&t1) @@ -6322,7 +6322,7 @@ func testChannelStoreSearchAllChannels(t *testing.T, rctx request.CTX, ss store. t2 := model.Team{} t2.DisplayName = "Name2" - t2.Name = NewTestId() + t2.Name = NewTestID() t2.Email = MakeEmail() t2.Type = model.TeamOpen _, err = ss.Team().Save(&t2) @@ -6331,7 +6331,7 @@ func testChannelStoreSearchAllChannels(t *testing.T, rctx request.CTX, ss store. o1 := model.Channel{ TeamId: t1.Id, DisplayName: "A1 ChannelA", - Name: NewTestId(), + Name: NewTestID(), Type: model.ChannelTypeOpen, } _, nErr := ss.Channel().Save(rctx, &o1, -1) @@ -6340,7 +6340,7 @@ func testChannelStoreSearchAllChannels(t *testing.T, rctx request.CTX, ss store. o2 := model.Channel{ TeamId: t2.Id, DisplayName: "A2 ChannelA", - Name: NewTestId(), + Name: NewTestID(), Type: model.ChannelTypeOpen, } _, nErr = ss.Channel().Save(rctx, &o2, -1) @@ -6373,7 +6373,7 @@ func testChannelStoreSearchAllChannels(t *testing.T, rctx request.CTX, ss store. o3 := model.Channel{ TeamId: t1.Id, DisplayName: "A3 ChannelA (alternate)", - Name: NewTestId(), + Name: NewTestID(), Type: model.ChannelTypeOpen, } _, nErr = ss.Channel().Save(rctx, &o3, -1) @@ -6382,7 +6382,7 @@ func testChannelStoreSearchAllChannels(t *testing.T, rctx request.CTX, ss store. o4 := model.Channel{ TeamId: t1.Id, DisplayName: "A4 ChannelB", - Name: NewTestId(), + Name: NewTestID(), Type: model.ChannelTypePrivate, } _, nErr = ss.Channel().Save(rctx, &o4, -1) @@ -6391,7 +6391,7 @@ func testChannelStoreSearchAllChannels(t *testing.T, rctx request.CTX, ss store. o5 := model.Channel{ TeamId: t1.Id, DisplayName: "A5 ChannelC", - Name: NewTestId(), + Name: NewTestID(), Type: model.ChannelTypePrivate, GroupConstrained: model.NewPointer(true), } @@ -6572,7 +6572,7 @@ func testChannelStoreSearchAllChannels(t *testing.T, rctx request.CTX, ss store. {"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.NewPointer(0), PerPage: model.NewPointer(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.NewPointer(0), PerPage: model.NewPointer(5)}, model.ChannelList{&o1, &o2, &o3, &o4, &o6}, 12}, {"Filter deleted returns only deleted channels", "", store.ChannelSearchOpts{Deleted: true, Page: model.NewPointer(0), PerPage: model.NewPointer(5)}, model.ChannelList{&o13}, 1}, - {"Search ChannelA by id", o1.Id, store.ChannelSearchOpts{IncludeDeleted: false, Page: model.NewPointer(0), PerPage: model.NewPointer(5), IncludeSearchById: true}, model.ChannelList{&o1}, 1}, + {"Search ChannelA by id", o1.Id, store.ChannelSearchOpts{IncludeDeleted: false, Page: model.NewPointer(0), PerPage: model.NewPointer(5), IncludeSearchByID: true}, model.ChannelList{&o1}, 1}, {"Filter excluding remote channels", "", store.ChannelSearchOpts{IncludeDeleted: false, ExcludeRemote: true}, model.ChannelList{&o1, &o2, &o3, &o4, &o5, &o6, &o7, &o8, &o9, &o10, &o11, &o12}, 0}, } @@ -6595,7 +6595,7 @@ func testChannelStoreGetMembersByIds(t *testing.T, rctx request.CTX, ss store.St o1 := model.Channel{} o1.TeamId = model.NewId() o1.DisplayName = "ChannelA" - o1.Name = NewTestId() + o1.Name = NewTestID() o1.Type = model.ChannelTypeOpen _, nErr := ss.Channel().Save(rctx, &o1, -1) require.NoError(t, nErr) @@ -6626,7 +6626,7 @@ func testChannelStoreGetMembersByIds(t *testing.T, rctx request.CTX, ss store.St } func testChannelStoreGetMembersByChannelIds(t *testing.T, rctx request.CTX, ss store.Store) { - userId := model.NewId() + userID := model.NewId() // Create a couple channels and add the user to them channel1, err := ss.Channel().Save(rctx, &model.Channel{ @@ -6647,31 +6647,31 @@ func testChannelStoreGetMembersByChannelIds(t *testing.T, rctx request.CTX, ss s _, err = ss.Channel().SaveMember(rctx, &model.ChannelMember{ ChannelId: channel1.Id, - UserId: userId, + UserId: userID, NotifyProps: model.GetDefaultChannelNotifyProps(), }) require.NoError(t, err) _, err = ss.Channel().SaveMember(rctx, &model.ChannelMember{ ChannelId: channel2.Id, - UserId: userId, + UserId: userID, NotifyProps: model.GetDefaultChannelNotifyProps(), }) require.NoError(t, err) 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) + result, nErr := ss.Channel().GetMembersByChannelIds([]string{channel1.Id, channel2.Id}, userID) require.NoError(t, nErr) assert.Len(t, result, 2) - assert.Equal(t, userId, result[0].UserId) + 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.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) + result, nErr := ss.Channel().GetMembersByChannelIds([]string{model.NewId(), model.NewId()}, userID) require.NoError(t, nErr) assert.Len(t, result, 0) }) @@ -6778,10 +6778,10 @@ func testChannelStoreSearchGroupChannels(t *testing.T, rctx request.CTX, ss stor _, nErr := ss.Channel().Save(rctx, &gc1, -1) require.NoError(t, nErr) - for _, userId := range userIds { + for _, userID := range userIds { _, nErr = ss.Channel().SaveMember(rctx, &model.ChannelMember{ ChannelId: gc1.Id, - UserId: userId, + UserId: userID, NotifyProps: model.GetDefaultChannelNotifyProps(), }) require.NoError(t, nErr) @@ -6795,10 +6795,10 @@ func testChannelStoreSearchGroupChannels(t *testing.T, rctx request.CTX, ss stor _, nErr = ss.Channel().Save(rctx, &gc2, -1) require.NoError(t, nErr) - for _, userId := range userIds { + for _, userID := range userIds { _, err := ss.Channel().SaveMember(rctx, &model.ChannelMember{ ChannelId: gc2.Id, - UserId: userId, + UserId: userID, NotifyProps: model.GetDefaultChannelNotifyProps(), }) require.NoError(t, err) @@ -6812,10 +6812,10 @@ func testChannelStoreSearchGroupChannels(t *testing.T, rctx request.CTX, ss stor _, nErr = ss.Channel().Save(rctx, &gc3, -1) require.NoError(t, nErr) - for _, userId := range userIds { + for _, userID := range userIds { _, err := ss.Channel().SaveMember(rctx, &model.ChannelMember{ ChannelId: gc3.Id, - UserId: userId, + UserId: userID, NotifyProps: model.GetDefaultChannelNotifyProps(), }) require.NoError(t, err) @@ -6830,49 +6830,49 @@ func testChannelStoreSearchGroupChannels(t *testing.T, rctx request.CTX, ss stor testCases := []struct { Name string - UserId string + UserID string Term string ExpectedResult []string }{ { Name: "Get all group channels for user1", - UserId: u1.Id, + UserID: u1.Id, Term: "", ExpectedResult: []string{gc1.Id, gc2.Id, gc3.Id}, }, { Name: "Get group channels for user1 and term 'three'", - UserId: u1.Id, + UserID: u1.Id, Term: "three", ExpectedResult: []string{gc1.Id, gc3.Id}, }, { Name: "Get group channels for user1 and term 'four two'", - UserId: u1.Id, + UserID: u1.Id, Term: "four two", ExpectedResult: []string{gc3.Id}, }, { Name: "Get all group channels for user2", - UserId: u2.Id, + UserID: u2.Id, Term: "", ExpectedResult: []string{gc1.Id, gc3.Id}, }, { Name: "Get group channels for user2 and term 'four'", - UserId: u2.Id, + UserID: u2.Id, Term: "four", ExpectedResult: []string{gc3.Id}, }, { Name: "Get all group channels for user4", - UserId: u4.Id, + UserID: u4.Id, Term: "", ExpectedResult: []string{gc2.Id, gc3.Id}, }, { Name: "Get group channels for user4 and term 'one five'", - UserId: u4.Id, + UserID: u4.Id, Term: "one five", ExpectedResult: []string{}, }, @@ -6880,7 +6880,7 @@ func testChannelStoreSearchGroupChannels(t *testing.T, rctx request.CTX, ss stor for _, tc := range testCases { t.Run(tc.Name, func(t *testing.T) { - result, err := ss.Channel().SearchGroupChannels(tc.UserId, tc.Term) + result, err := ss.Channel().SearchGroupChannels(tc.UserID, tc.Term) require.NoError(t, err) resultIds := []string{} @@ -6897,7 +6897,7 @@ func testChannelStoreAnalyticsDeletedTypeCount(t *testing.T, rctx request.CTX, s o1 := model.Channel{} o1.TeamId = model.NewId() o1.DisplayName = "ChannelA" - o1.Name = NewTestId() + o1.Name = NewTestID() o1.Type = model.ChannelTypeOpen _, nErr := ss.Channel().Save(rctx, &o1, -1) require.NoError(t, nErr) @@ -6905,7 +6905,7 @@ func testChannelStoreAnalyticsDeletedTypeCount(t *testing.T, rctx request.CTX, s o2 := model.Channel{} o2.TeamId = model.NewId() o2.DisplayName = "Channel2" - o2.Name = NewTestId() + o2.Name = NewTestID() o2.Type = model.ChannelTypeOpen _, nErr = ss.Channel().Save(rctx, &o2, -1) require.NoError(t, nErr) @@ -6913,7 +6913,7 @@ func testChannelStoreAnalyticsDeletedTypeCount(t *testing.T, rctx request.CTX, s p3 := model.Channel{} p3.TeamId = model.NewId() p3.DisplayName = "Channel3" - p3.Name = NewTestId() + p3.Name = NewTestID() p3.Type = model.ChannelTypePrivate _, nErr = ss.Channel().Save(rctx, &p3, -1) require.NoError(t, nErr) @@ -6977,7 +6977,7 @@ func testChannelStoreGetPinnedPosts(t *testing.T, rctx request.CTX, ss store.Sto ch1 := &model.Channel{ TeamId: model.NewId(), DisplayName: "Name", - Name: NewTestId(), + Name: NewTestID(), Type: model.ChannelTypeOpen, } @@ -6999,7 +6999,7 @@ func testChannelStoreGetPinnedPosts(t *testing.T, rctx request.CTX, ss store.Sto ch2 := &model.Channel{ TeamId: model.NewId(), DisplayName: "Name", - Name: NewTestId(), + Name: NewTestID(), Type: model.ChannelTypeOpen, } @@ -7018,20 +7018,20 @@ func testChannelStoreGetPinnedPosts(t *testing.T, rctx request.CTX, ss store.Sto require.Empty(t, pl.Posts, "wasn't supposed to return posts") t.Run("with correct ReplyCount", func(t *testing.T) { - teamId := model.NewId() + teamID := model.NewId() channel, err := ss.Channel().Save(rctx, &model.Channel{ - TeamId: teamId, + TeamId: teamID, DisplayName: "DisplayName", Name: "channel" + model.NewId(), Type: model.ChannelTypeOpen, }, -1) require.NoError(t, err) - userId := model.NewId() + userID := model.NewId() post1, err := ss.Post().Save(rctx, &model.Post{ ChannelId: channel.Id, - UserId: userId, + UserId: userID, Message: "message", IsPinned: true, }) @@ -7040,7 +7040,7 @@ func testChannelStoreGetPinnedPosts(t *testing.T, rctx request.CTX, ss store.Sto post2, err := ss.Post().Save(rctx, &model.Post{ ChannelId: channel.Id, - UserId: userId, + UserId: userID, Message: "message", IsPinned: true, }) @@ -7049,7 +7049,7 @@ func testChannelStoreGetPinnedPosts(t *testing.T, rctx request.CTX, ss store.Sto post3, err := ss.Post().Save(rctx, &model.Post{ ChannelId: channel.Id, - UserId: userId, + UserId: userID, RootId: post1.Id, Message: "message", IsPinned: true, @@ -7070,7 +7070,7 @@ func testChannelStoreGetPinnedPostCount(t *testing.T, rctx request.CTX, ss store ch1 := &model.Channel{ TeamId: model.NewId(), DisplayName: "Name", - Name: NewTestId(), + Name: NewTestID(), Type: model.ChannelTypeOpen, } @@ -7100,7 +7100,7 @@ func testChannelStoreGetPinnedPostCount(t *testing.T, rctx request.CTX, ss store ch2 := &model.Channel{ TeamId: model.NewId(), DisplayName: "Name", - Name: NewTestId(), + Name: NewTestID(), Type: model.ChannelTypeOpen, } @@ -7242,17 +7242,17 @@ func testChannelStoreMigrateChannelMembers(t *testing.T, rctx request.CTX, ss st cm2, _ = ss.Channel().SaveMember(rctx, cm2) cm3, _ = ss.Channel().SaveMember(rctx, cm3) - lastDoneChannelId := strings.Repeat("0", 26) - lastDoneUserId := strings.Repeat("0", 26) + lastDoneChannelID := strings.Repeat("0", 26) + lastDoneUserID := strings.Repeat("0", 26) for { - data, err := ss.Channel().MigrateChannelMembers(lastDoneChannelId, lastDoneUserId) + data, err := ss.Channel().MigrateChannelMembers(lastDoneChannelID, lastDoneUserID) if assert.NoError(t, err) { if data == nil { break } - lastDoneChannelId = data["ChannelId"] - lastDoneUserId = data["UserId"] + lastDoneChannelID = data["ChannelId"] + lastDoneUserID = data["UserId"] } } @@ -7388,11 +7388,11 @@ func testChannelStoreClearAllCustomRoleAssignments(t *testing.T, rctx request.CT // testMaterializedPublicChannels tests edge cases involving the triggers and stored procedures // that materialize the PublicChannels table. func testMaterializedPublicChannels(t *testing.T, rctx request.CTX, ss store.Store, s SqlStore) { - teamId := model.NewId() + teamID := model.NewId() // o1 is a public channel on the team o1 := model.Channel{ - TeamId: teamId, + TeamId: teamID, DisplayName: "Open Channel", Name: model.NewId(), Type: model.ChannelTypeOpen, @@ -7402,7 +7402,7 @@ func testMaterializedPublicChannels(t *testing.T, rctx request.CTX, ss store.Sto // o2 is another public channel on the team o2 := model.Channel{ - TeamId: teamId, + TeamId: teamID, DisplayName: "Open Channel 2", Name: model.NewId(), Type: model.ChannelTypeOpen, @@ -7411,7 +7411,7 @@ func testMaterializedPublicChannels(t *testing.T, rctx request.CTX, ss store.Sto require.NoError(t, nErr) t.Run("o1 and o2 initially listed in public channels", func(t *testing.T) { - channels, channelErr := ss.Channel().SearchInTeam(teamId, "", true) + channels, channelErr := ss.Channel().SearchInTeam(teamID, "", true) require.NoError(t, channelErr) require.Equal(t, model.ChannelList{&o1, &o2}, channels) }) @@ -7423,7 +7423,7 @@ func testMaterializedPublicChannels(t *testing.T, rctx request.CTX, ss store.Sto require.NoError(t, e, "channel should have been deleted") t.Run("o1 still listed in public channels when marked as deleted", func(t *testing.T) { - channels, channelErr := ss.Channel().SearchInTeam(teamId, "", true) + channels, channelErr := ss.Channel().SearchInTeam(teamID, "", true) require.NoError(t, channelErr) require.Equal(t, model.ChannelList{&o1, &o2}, channels) }) @@ -7431,7 +7431,7 @@ func testMaterializedPublicChannels(t *testing.T, rctx request.CTX, ss store.Sto ss.Channel().PermanentDelete(rctx, o1.Id) t.Run("o1 no longer listed in public channels when permanently deleted", func(t *testing.T) { - channels, channelErr := ss.Channel().SearchInTeam(teamId, "", true) + channels, channelErr := ss.Channel().SearchInTeam(teamID, "", true) require.NoError(t, channelErr) require.Equal(t, model.ChannelList{&o2}, channels) }) @@ -7441,7 +7441,7 @@ func testMaterializedPublicChannels(t *testing.T, rctx request.CTX, ss store.Sto require.NoError(t, err) t.Run("o2 no longer listed since now private", func(t *testing.T) { - channels, channelErr := ss.Channel().SearchInTeam(teamId, "", true) + channels, channelErr := ss.Channel().SearchInTeam(teamID, "", true) require.NoError(t, channelErr) require.Equal(t, model.ChannelList{}, channels) }) @@ -7451,7 +7451,7 @@ func testMaterializedPublicChannels(t *testing.T, rctx request.CTX, ss store.Sto require.NoError(t, err) t.Run("o2 listed once again since now public", func(t *testing.T) { - channels, channelErr := ss.Channel().SearchInTeam(teamId, "", true) + channels, channelErr := ss.Channel().SearchInTeam(teamID, "", true) require.NoError(t, channelErr) require.Equal(t, model.ChannelList{&o2}, channels) }) @@ -7459,7 +7459,7 @@ func testMaterializedPublicChannels(t *testing.T, rctx request.CTX, ss store.Sto // o3 is a public channel on the team that already existed in the PublicChannels table. o3 := model.Channel{ Id: model.NewId(), - TeamId: teamId, + TeamId: teamID, DisplayName: "Open Channel 3", Name: model.NewId(), Type: model.ChannelTypeOpen, @@ -7508,14 +7508,14 @@ func testMaterializedPublicChannels(t *testing.T, rctx request.CTX, ss store.Sto require.NoError(t, execerr) t.Run("verify o3 INSERT converted to UPDATE", func(t *testing.T) { - channels, channelErr := ss.Channel().SearchInTeam(teamId, "", true) + channels, channelErr := ss.Channel().SearchInTeam(teamID, "", true) require.NoError(t, channelErr) 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. o4 := model.Channel{ - TeamId: teamId, + TeamId: teamID, DisplayName: "Open Channel 4", Name: model.NewId(), Type: model.ChannelTypeOpen, @@ -7537,7 +7537,7 @@ func testMaterializedPublicChannels(t *testing.T, rctx request.CTX, ss store.Sto require.NoError(t, err) t.Run("verify o4 UPDATE converted to INSERT", func(t *testing.T) { - channels, err := ss.Channel().SearchInTeam(teamId, "", true) + channels, err := ss.Channel().SearchInTeam(teamID, "", true) require.NoError(t, err) require.Equal(t, model.ChannelList{&o2, &o3, &o4}, channels) }) @@ -7546,7 +7546,7 @@ func testMaterializedPublicChannels(t *testing.T, rctx request.CTX, ss store.Sto func testChannelStoreGetAllChannelsForExportAfter(t *testing.T, rctx request.CTX, ss store.Store) { t1 := model.Team{} t1.DisplayName = "Name" - t1.Name = NewTestId() + t1.Name = NewTestID() t1.Email = MakeEmail() t1.Type = model.TeamOpen _, err := ss.Team().Save(&t1) @@ -7555,7 +7555,7 @@ func testChannelStoreGetAllChannelsForExportAfter(t *testing.T, rctx request.CTX c1 := model.Channel{} c1.TeamId = t1.Id c1.DisplayName = "Channel1" - c1.Name = NewTestId() + c1.Name = NewTestID() c1.Type = model.ChannelTypeOpen _, nErr := ss.Channel().Save(rctx, &c1, -1) require.NoError(t, nErr) @@ -7578,7 +7578,7 @@ func testChannelStoreGetAllChannelsForExportAfter(t *testing.T, rctx request.CTX func testChannelStoreGetChannelMembersForExport(t *testing.T, rctx request.CTX, ss store.Store) { t1 := model.Team{} t1.DisplayName = "Name" - t1.Name = NewTestId() + t1.Name = NewTestID() t1.Email = MakeEmail() t1.Type = model.TeamOpen _, err := ss.Team().Save(&t1) @@ -7587,7 +7587,7 @@ func testChannelStoreGetChannelMembersForExport(t *testing.T, rctx request.CTX, c1 := model.Channel{} c1.TeamId = t1.Id c1.DisplayName = "Channel1" - c1.Name = NewTestId() + c1.Name = NewTestID() c1.Type = model.ChannelTypeOpen _, nErr := ss.Channel().Save(rctx, &c1, -1) require.NoError(t, nErr) @@ -7595,7 +7595,7 @@ func testChannelStoreGetChannelMembersForExport(t *testing.T, rctx request.CTX, c2 := model.Channel{} c2.TeamId = model.NewId() c2.DisplayName = "Channel2" - c2.Name = NewTestId() + c2.Name = NewTestID() c2.Type = model.ChannelTypeOpen _, nErr = ss.Channel().Save(rctx, &c2, -1) require.NoError(t, nErr) @@ -7635,7 +7635,7 @@ func testChannelStoreRemoveAllDeactivatedMembers(t *testing.T, rctx request.CTX, // Set up all the objects needed in the store. t1 := model.Team{} t1.DisplayName = "Name" - t1.Name = NewTestId() + t1.Name = NewTestID() t1.Email = MakeEmail() t1.Type = model.TeamOpen _, err := ss.Team().Save(&t1) @@ -7644,7 +7644,7 @@ func testChannelStoreRemoveAllDeactivatedMembers(t *testing.T, rctx request.CTX, c1 := model.Channel{} c1.TeamId = t1.Id c1.DisplayName = "Channel1" - c1.Name = NewTestId() + c1.Name = NewTestID() c1.Type = model.ChannelTypeOpen _, nErr := ss.Channel().Save(rctx, &c1, -1) require.NoError(t, nErr) @@ -7723,12 +7723,12 @@ func testChannelStoreRemoveAllDeactivatedMembers(t *testing.T, rctx request.CTX, } func testChannelStoreExportAllDirectChannels(t *testing.T, rctx request.CTX, ss store.Store, s SqlStore) { - teamId := model.NewId() + teamID := model.NewId() o1 := model.Channel{} - o1.TeamId = teamId + o1.TeamId = teamID o1.DisplayName = "Name" + model.NewId() - o1.Name = model.GetDMNameFromIds(NewTestId(), NewTestId()) + o1.Name = model.GetDMNameFromIds(NewTestID(), NewTestID()) o1.Type = model.ChannelTypeDirect userIds := []string{model.NewId(), model.NewId(), model.NewId()} @@ -7736,7 +7736,7 @@ func testChannelStoreExportAllDirectChannels(t *testing.T, rctx request.CTX, ss o2 := model.Channel{} o2.Name = model.GetGroupNameFromUserIds(userIds) o2.DisplayName = "GroupChannel" + model.NewId() - o2.Name = NewTestId() + o2.Name = NewTestID() o2.Type = model.ChannelTypeGroup _, nErr := ss.Channel().Save(rctx, &o2, -1) require.NoError(t, nErr) @@ -7780,26 +7780,26 @@ func testChannelStoreExportAllDirectChannels(t *testing.T, rctx request.CTX, ss } func testChannelStoreExportAllDirectChannelsExcludePrivateAndPublic(t *testing.T, rctx request.CTX, ss store.Store, s SqlStore) { - teamId := model.NewId() + teamID := model.NewId() o1 := model.Channel{} - o1.TeamId = teamId + o1.TeamId = teamID o1.DisplayName = "The Direct Channel" + model.NewId() - o1.Name = model.GetDMNameFromIds(NewTestId(), NewTestId()) + o1.Name = model.GetDMNameFromIds(NewTestID(), NewTestID()) o1.Type = model.ChannelTypeDirect o2 := model.Channel{} - o2.TeamId = teamId + o2.TeamId = teamID o2.DisplayName = "Channel2" + model.NewId() - o2.Name = NewTestId() + o2.Name = NewTestID() o2.Type = model.ChannelTypeOpen _, nErr := ss.Channel().Save(rctx, &o2, -1) require.NoError(t, nErr) o3 := model.Channel{} - o3.TeamId = teamId + o3.TeamId = teamID o3.DisplayName = "Channel3" + model.NewId() - o3.Name = NewTestId() + o3.Name = NewTestID() o3.Type = model.ChannelTypePrivate _, nErr = ss.Channel().Save(rctx, &o3, -1) require.NoError(t, nErr) @@ -7842,12 +7842,12 @@ func testChannelStoreExportAllDirectChannelsExcludePrivateAndPublic(t *testing.T } func testChannelStoreExportAllDirectChannelsDeletedChannel(t *testing.T, rctx request.CTX, ss store.Store, s SqlStore) { - teamId := model.NewId() + teamID := model.NewId() o1 := model.Channel{} - o1.TeamId = teamId + o1.TeamId = teamID o1.DisplayName = "Different Name" + model.NewId() - o1.Name = model.GetDMNameFromIds(NewTestId(), NewTestId()) + o1.Name = model.GetDMNameFromIds(NewTestID(), NewTestID()) o1.Type = model.ChannelTypeDirect u1 := &model.User{} @@ -7900,7 +7900,7 @@ func testChannelStoreGetChannelsBatchForIndexing(t *testing.T, rctx request.CTX, // Set up all the objects needed c1 := &model.Channel{} c1.DisplayName = "Channel1" - c1.Name = NewTestId() + c1.Name = NewTestID() c1.Type = model.ChannelTypeOpen _, nErr := ss.Channel().Save(rctx, c1, -1) require.NoError(t, nErr) @@ -7909,7 +7909,7 @@ func testChannelStoreGetChannelsBatchForIndexing(t *testing.T, rctx request.CTX, c2 := &model.Channel{} c2.DisplayName = "Channel2" - c2.Name = NewTestId() + c2.Name = NewTestID() c2.Type = model.ChannelTypeOpen _, nErr = ss.Channel().Save(rctx, c2, -1) require.NoError(t, nErr) @@ -7918,21 +7918,21 @@ func testChannelStoreGetChannelsBatchForIndexing(t *testing.T, rctx request.CTX, c3 := &model.Channel{} c3.DisplayName = "Channel3" - c3.Name = NewTestId() + c3.Name = NewTestID() c3.Type = model.ChannelTypeOpen _, nErr = ss.Channel().Save(rctx, c3, -1) require.NoError(t, nErr) c4 := &model.Channel{} c4.DisplayName = "Channel4" - c4.Name = NewTestId() + c4.Name = NewTestID() c4.Type = model.ChannelTypePrivate _, nErr = ss.Channel().Save(rctx, c4, -1) require.NoError(t, nErr) c5 := &model.Channel{} c5.DisplayName = "Channel5" - c5.Name = NewTestId() + c5.Name = NewTestID() c5.Type = model.ChannelTypeOpen _, nErr = ss.Channel().Save(rctx, c5, -1) require.NoError(t, nErr) @@ -7941,7 +7941,7 @@ func testChannelStoreGetChannelsBatchForIndexing(t *testing.T, rctx request.CTX, c6 := &model.Channel{} c6.DisplayName = "Channel6" - c6.Name = NewTestId() + c6.Name = NewTestID() c6.Type = model.ChannelTypeOpen _, nErr = ss.Channel().Save(rctx, c6, -1) require.NoError(t, nErr) @@ -8059,13 +8059,13 @@ func testGetChannelsWithUnreadsAndWithMentions(t *testing.T, rctx request.CTX, s withUnreads bool, withMentions bool, isDirect bool, - userId string, + userID string, ) (model.Channel, model.ChannelMember) { if !isDirect { o1 := model.Channel{} o1.TeamId = model.NewId() o1.DisplayName = "Channel1" - o1.Name = NewTestId() + o1.Name = NewTestID() o1.Type = model.ChannelTypeOpen o1.TotalMsgCount = 25 o1.LastPostAt = 12345 @@ -8075,7 +8075,7 @@ func testGetChannelsWithUnreadsAndWithMentions(t *testing.T, rctx request.CTX, s m1 := model.ChannelMember{} m1.ChannelId = o1.Id - m1.UserId = userId + m1.UserId = userID m1.NotifyProps = model.GetDefaultChannelNotifyProps() m1.NotifyProps[model.PushNotifyProp] = pushProp if !withUnreads { @@ -8091,14 +8091,14 @@ func testGetChannelsWithUnreadsAndWithMentions(t *testing.T, rctx request.CTX, s return o1, m1 } - o1, err := ss.Channel().CreateDirectChannel(rctx, &model.User{Id: userId}, &model.User{Id: model.NewId()}, func(channel *model.Channel) { + o1, err := ss.Channel().CreateDirectChannel(rctx, &model.User{Id: userID}, &model.User{Id: model.NewId()}, func(channel *model.Channel) { channel.TotalMsgCount = 25 channel.LastPostAt = 12345 channel.LastRootPostAt = 12345 }) require.NoError(t, err) - m1, err := ss.Channel().GetMember(context.Background(), o1.Id, userId) + m1, err := ss.Channel().GetMember(context.Background(), o1.Id, userID) require.NoError(t, err) if !withUnreads { @@ -8186,14 +8186,14 @@ func testGetChannelsWithUnreadsAndWithMentions(t *testing.T, rctx request.CTX, s } t.Run("multiple channels", func(t *testing.T) { - userId := model.NewId() - o1, _ := setupMembership(model.ChannelNotifyDefault, true, true, false, userId) - o2, _ := setupMembership(model.ChannelNotifyDefault, true, true, false, userId) + userID := model.NewId() + o1, _ := setupMembership(model.ChannelNotifyDefault, true, true, false, userID) + o2, _ := setupMembership(model.ChannelNotifyDefault, true, true, false, userID) userNotifyProps := model.GetDefaultChannelNotifyProps() userNotifyProps[model.PushNotifyProp] = model.UserNotifyMention - unreads, mentions, times, err := ss.Channel().GetChannelsWithUnreadsAndWithMentions(context.Background(), []string{o1.Id, o2.Id}, userId, userNotifyProps) + unreads, mentions, times, err := ss.Channel().GetChannelsWithUnreadsAndWithMentions(context.Background(), []string{o1.Id, o2.Id}, userID, userNotifyProps) require.NoError(t, err) require.Contains(t, unreads, o1.Id) diff --git a/server/channels/store/storetest/channel_store_categories.go b/server/channels/store/storetest/channel_store_categories.go index f6f634ae79b90..2bd1ccc85d012 100644 --- a/server/channels/store/storetest/channel_store_categories.go +++ b/server/channels/store/storetest/channel_store_categories.go @@ -32,17 +32,17 @@ func TestChannelStoreCategories(t *testing.T, rctx request.CTX, ss store.Store, func setupTeam(t *testing.T, rctx request.CTX, ss store.Store, userIds ...string) *model.Team { team, err := ss.Team().Save(&model.Team{ DisplayName: "Name", - Name: NewTestId(), + Name: NewTestID(), Email: MakeEmail(), Type: model.TeamOpen, }) assert.NoError(t, err) members := make([]*model.TeamMember, 0, len(userIds)) - for _, userId := range userIds { + for _, userID := range userIds { members = append(members, &model.TeamMember{ TeamId: team.Id, - UserId: userId, + UserId: userID, }) } if len(members) > 0 { @@ -55,64 +55,64 @@ func setupTeam(t *testing.T, rctx request.CTX, ss store.Store, userIds ...string func testCreateInitialSidebarCategories(t *testing.T, rctx request.CTX, ss store.Store) { t.Run("should create initial favorites/channels/DMs categories", func(t *testing.T) { - userId := model.NewId() + userID := model.NewId() - team := setupTeam(t, rctx, ss, userId) + team := setupTeam(t, rctx, ss, userID) opts := &store.SidebarCategorySearchOpts{ TeamID: team.Id, ExcludeTeam: false, } - res, nErr := ss.Channel().CreateInitialSidebarCategories(rctx, userId, opts) + res, nErr := ss.Channel().CreateInitialSidebarCategories(rctx, userID, opts) assert.NoError(t, nErr) require.Len(t, res.Categories, 3) assert.Equal(t, model.SidebarCategoryFavorites, res.Categories[0].Type) assert.Equal(t, model.SidebarCategoryChannels, res.Categories[1].Type) assert.Equal(t, model.SidebarCategoryDirectMessages, res.Categories[2].Type) - res2, err := ss.Channel().GetSidebarCategoriesForTeamForUser(userId, team.Id) + res2, err := ss.Channel().GetSidebarCategoriesForTeamForUser(userID, team.Id) assert.NoError(t, err) assert.Equal(t, res, res2) }) t.Run("should create initial favorites/channels/DMs categories for multiple users", func(t *testing.T) { - userId := model.NewId() - userId2 := model.NewId() + userID := model.NewId() + userID2 := model.NewId() - team := setupTeam(t, rctx, ss, userId, userId2) + team := setupTeam(t, rctx, ss, userID, userID2) opts := &store.SidebarCategorySearchOpts{ TeamID: team.Id, ExcludeTeam: false, } - res, nErr := ss.Channel().CreateInitialSidebarCategories(rctx, userId, opts) + res, nErr := ss.Channel().CreateInitialSidebarCategories(rctx, userID, opts) require.NoError(t, nErr) require.NotEmpty(t, res) - res, nErr = ss.Channel().CreateInitialSidebarCategories(rctx, userId2, opts) + res, nErr = ss.Channel().CreateInitialSidebarCategories(rctx, userID2, opts) assert.NoError(t, nErr) assert.Len(t, res.Categories, 3) assert.Equal(t, model.SidebarCategoryFavorites, res.Categories[0].Type) assert.Equal(t, model.SidebarCategoryChannels, res.Categories[1].Type) assert.Equal(t, model.SidebarCategoryDirectMessages, res.Categories[2].Type) - res2, err := ss.Channel().GetSidebarCategoriesForTeamForUser(userId2, team.Id) + res2, err := ss.Channel().GetSidebarCategoriesForTeamForUser(userID2, team.Id) assert.NoError(t, err) assert.Equal(t, res, res2) }) t.Run("should create initial favorites/channels/DMs categories on different teams", func(t *testing.T) { - userId := model.NewId() + userID := model.NewId() - team := setupTeam(t, rctx, ss, userId) - team2 := setupTeam(t, rctx, ss, userId) + team := setupTeam(t, rctx, ss, userID) + team2 := setupTeam(t, rctx, ss, userID) opts := &store.SidebarCategorySearchOpts{ TeamID: team.Id, ExcludeTeam: false, } - res, nErr := ss.Channel().CreateInitialSidebarCategories(rctx, userId, opts) + res, nErr := ss.Channel().CreateInitialSidebarCategories(rctx, userID, opts) require.NoError(t, nErr) require.NotEmpty(t, res) @@ -120,49 +120,49 @@ func testCreateInitialSidebarCategories(t *testing.T, rctx request.CTX, ss store TeamID: team2.Id, ExcludeTeam: false, } - res, nErr = ss.Channel().CreateInitialSidebarCategories(rctx, userId, opts) + res, nErr = ss.Channel().CreateInitialSidebarCategories(rctx, userID, opts) assert.NoError(t, nErr) assert.Len(t, res.Categories, 3) assert.Equal(t, model.SidebarCategoryFavorites, res.Categories[0].Type) assert.Equal(t, model.SidebarCategoryChannels, res.Categories[1].Type) assert.Equal(t, model.SidebarCategoryDirectMessages, res.Categories[2].Type) - res2, err := ss.Channel().GetSidebarCategoriesForTeamForUser(userId, team2.Id) + res2, err := ss.Channel().GetSidebarCategoriesForTeamForUser(userID, team2.Id) assert.NoError(t, err) assert.Equal(t, res, res2) }) t.Run("shouldn't create additional categories when ones already exist", func(t *testing.T) { - userId := model.NewId() + userID := model.NewId() - team := setupTeam(t, rctx, ss, userId) + team := setupTeam(t, rctx, ss, userID) opts := &store.SidebarCategorySearchOpts{ TeamID: team.Id, ExcludeTeam: false, } - res, nErr := ss.Channel().CreateInitialSidebarCategories(rctx, userId, opts) + res, nErr := ss.Channel().CreateInitialSidebarCategories(rctx, userID, opts) require.NoError(t, nErr) require.NotEmpty(t, res) - initialCategories, err := ss.Channel().GetSidebarCategoriesForTeamForUser(userId, team.Id) + initialCategories, err := ss.Channel().GetSidebarCategoriesForTeamForUser(userID, team.Id) require.NoError(t, err) require.Equal(t, res, initialCategories) // Calling CreateInitialSidebarCategories a second time shouldn't create any new categories - res, nErr = ss.Channel().CreateInitialSidebarCategories(rctx, userId, opts) + res, nErr = ss.Channel().CreateInitialSidebarCategories(rctx, userID, opts) assert.NoError(t, nErr) assert.NotEmpty(t, res) - res, err = ss.Channel().GetSidebarCategoriesForTeamForUser(userId, team.Id) + res, err = ss.Channel().GetSidebarCategoriesForTeamForUser(userID, team.Id) assert.NoError(t, err) assert.Equal(t, initialCategories.Categories, res.Categories) }) t.Run("shouldn't create additional categories when ones already exist even when ran simultaneously", func(t *testing.T) { - userId := model.NewId() + userID := model.NewId() - team := setupTeam(t, rctx, ss, userId) + team := setupTeam(t, rctx, ss, userID) var wg sync.WaitGroup @@ -176,21 +176,21 @@ func testCreateInitialSidebarCategories(t *testing.T, rctx request.CTX, ss store TeamID: team.Id, ExcludeTeam: false, } - _, _ = ss.Channel().CreateInitialSidebarCategories(rctx, userId, opts) + _, _ = ss.Channel().CreateInitialSidebarCategories(rctx, userID, opts) }() } wg.Wait() - res, err := ss.Channel().GetSidebarCategoriesForTeamForUser(userId, team.Id) + res, err := ss.Channel().GetSidebarCategoriesForTeamForUser(userID, team.Id) assert.NoError(t, err) assert.Len(t, res.Categories, 3) }) t.Run("should populate the Favorites category with regular channels", func(t *testing.T) { - userId := model.NewId() + userID := model.NewId() - team := setupTeam(t, rctx, ss, userId) + team := setupTeam(t, rctx, ss, userID) // Set up two channels, one favorited and one not channel1, nErr := ss.Channel().Save(rctx, &model.Channel{ @@ -201,7 +201,7 @@ func testCreateInitialSidebarCategories(t *testing.T, rctx request.CTX, ss store require.NoError(t, nErr) _, err := ss.Channel().SaveMember(rctx, &model.ChannelMember{ ChannelId: channel1.Id, - UserId: userId, + UserId: userID, NotifyProps: model.GetDefaultChannelNotifyProps(), }) require.NoError(t, err) @@ -214,14 +214,14 @@ func testCreateInitialSidebarCategories(t *testing.T, rctx request.CTX, ss store require.NoError(t, nErr) _, err = ss.Channel().SaveMember(rctx, &model.ChannelMember{ ChannelId: channel2.Id, - UserId: userId, + UserId: userID, NotifyProps: model.GetDefaultChannelNotifyProps(), }) require.NoError(t, err) nErr = ss.Preference().Save(model.Preferences{ { - UserId: userId, + UserId: userID, Category: model.PreferenceCategoryFavoriteChannel, Name: channel1.Id, Value: "true", @@ -234,7 +234,7 @@ func testCreateInitialSidebarCategories(t *testing.T, rctx request.CTX, ss store TeamID: team.Id, ExcludeTeam: false, } - categories, nErr := ss.Channel().CreateInitialSidebarCategories(rctx, userId, opts) + categories, nErr := ss.Channel().CreateInitialSidebarCategories(rctx, userID, opts) require.NoError(t, nErr) require.Len(t, categories.Categories, 3) assert.Equal(t, model.SidebarCategoryFavorites, categories.Categories[0].Type) @@ -243,15 +243,15 @@ func testCreateInitialSidebarCategories(t *testing.T, rctx request.CTX, ss store assert.Equal(t, []string{channel2.Id}, categories.Categories[1].Channels) // Get and check the categories for channels - categories2, nErr := ss.Channel().GetSidebarCategoriesForTeamForUser(userId, team.Id) + categories2, nErr := ss.Channel().GetSidebarCategoriesForTeamForUser(userID, team.Id) require.NoError(t, nErr) require.Equal(t, categories, categories2) }) t.Run("should populate the Favorites category in alphabetical order", func(t *testing.T) { - userId := model.NewId() + userID := model.NewId() - team := setupTeam(t, rctx, ss, userId) + team := setupTeam(t, rctx, ss, userID) // Set up two channels channel1, nErr := ss.Channel().Save(rctx, &model.Channel{ @@ -263,7 +263,7 @@ func testCreateInitialSidebarCategories(t *testing.T, rctx request.CTX, ss store require.NoError(t, nErr) _, err := ss.Channel().SaveMember(rctx, &model.ChannelMember{ ChannelId: channel1.Id, - UserId: userId, + UserId: userID, NotifyProps: model.GetDefaultChannelNotifyProps(), }) require.NoError(t, err) @@ -277,20 +277,20 @@ func testCreateInitialSidebarCategories(t *testing.T, rctx request.CTX, ss store require.NoError(t, nErr) _, err = ss.Channel().SaveMember(rctx, &model.ChannelMember{ ChannelId: channel2.Id, - UserId: userId, + UserId: userID, NotifyProps: model.GetDefaultChannelNotifyProps(), }) require.NoError(t, err) nErr = ss.Preference().Save(model.Preferences{ { - UserId: userId, + UserId: userID, Category: model.PreferenceCategoryFavoriteChannel, Name: channel1.Id, Value: "true", }, { - UserId: userId, + UserId: userID, Category: model.PreferenceCategoryFavoriteChannel, Name: channel2.Id, Value: "true", @@ -303,38 +303,38 @@ func testCreateInitialSidebarCategories(t *testing.T, rctx request.CTX, ss store TeamID: team.Id, ExcludeTeam: false, } - categories, nErr := ss.Channel().CreateInitialSidebarCategories(rctx, userId, opts) + categories, nErr := ss.Channel().CreateInitialSidebarCategories(rctx, userID, opts) require.NoError(t, nErr) require.Len(t, categories.Categories, 3) assert.Equal(t, model.SidebarCategoryFavorites, categories.Categories[0].Type) assert.Equal(t, []string{channel2.Id, channel1.Id}, categories.Categories[0].Channels) // Get and check the categories for channels - categories2, nErr := ss.Channel().GetSidebarCategoriesForTeamForUser(userId, team.Id) + categories2, nErr := ss.Channel().GetSidebarCategoriesForTeamForUser(userID, team.Id) require.NoError(t, nErr) require.Equal(t, categories, categories2) }) t.Run("should populate the Favorites category with DMs and GMs", func(t *testing.T) { - userId := model.NewId() + userID := model.NewId() - team := setupTeam(t, rctx, ss, userId) + team := setupTeam(t, rctx, ss, userID) - otherUserId1 := model.NewId() - otherUserId2 := model.NewId() + otherUserID1 := model.NewId() + otherUserID2 := model.NewId() // Set up two direct channels, one favorited and one not dmChannel1, err := ss.Channel().SaveDirectChannel(rctx, &model.Channel{ - Name: model.GetDMNameFromIds(userId, otherUserId1), + Name: model.GetDMNameFromIds(userID, otherUserID1), Type: model.ChannelTypeDirect, }, &model.ChannelMember{ - UserId: userId, + UserId: userID, NotifyProps: model.GetDefaultChannelNotifyProps(), }, &model.ChannelMember{ - UserId: otherUserId1, + UserId: otherUserID1, NotifyProps: model.GetDefaultChannelNotifyProps(), }, ) @@ -342,15 +342,15 @@ func testCreateInitialSidebarCategories(t *testing.T, rctx request.CTX, ss store dmChannel2, err := ss.Channel().SaveDirectChannel(rctx, &model.Channel{ - Name: model.GetDMNameFromIds(userId, otherUserId2), + Name: model.GetDMNameFromIds(userID, otherUserID2), Type: model.ChannelTypeDirect, }, &model.ChannelMember{ - UserId: userId, + UserId: userID, NotifyProps: model.GetDefaultChannelNotifyProps(), }, &model.ChannelMember{ - UserId: otherUserId2, + UserId: otherUserID2, NotifyProps: model.GetDefaultChannelNotifyProps(), }, ) @@ -358,7 +358,7 @@ func testCreateInitialSidebarCategories(t *testing.T, rctx request.CTX, ss store err = ss.Preference().Save(model.Preferences{ { - UserId: userId, + UserId: userID, Category: model.PreferenceCategoryFavoriteChannel, Name: dmChannel1.Id, Value: "true", @@ -371,7 +371,7 @@ func testCreateInitialSidebarCategories(t *testing.T, rctx request.CTX, ss store TeamID: team.Id, ExcludeTeam: false, } - categories, nErr := ss.Channel().CreateInitialSidebarCategories(rctx, userId, opts) + categories, nErr := ss.Channel().CreateInitialSidebarCategories(rctx, userID, opts) require.NoError(t, nErr) require.Len(t, categories.Categories, 3) assert.Equal(t, model.SidebarCategoryFavorites, categories.Categories[0].Type) @@ -380,16 +380,16 @@ func testCreateInitialSidebarCategories(t *testing.T, rctx request.CTX, ss store assert.Equal(t, []string{dmChannel2.Id}, categories.Categories[2].Channels) // Get and check the categories for channels - categories2, err := ss.Channel().GetSidebarCategoriesForTeamForUser(userId, team.Id) + categories2, err := ss.Channel().GetSidebarCategoriesForTeamForUser(userID, team.Id) require.NoError(t, err) require.Equal(t, categories, categories2) }) t.Run("should not populate the Favorites category with channels from other teams", func(t *testing.T) { - userId := model.NewId() + userID := model.NewId() - team := setupTeam(t, rctx, ss, userId) - team2 := setupTeam(t, rctx, ss, userId) + team := setupTeam(t, rctx, ss, userID) + team2 := setupTeam(t, rctx, ss, userID) // Set up a channel on another team and favorite it channel1, nErr := ss.Channel().Save(rctx, &model.Channel{ @@ -400,14 +400,14 @@ func testCreateInitialSidebarCategories(t *testing.T, rctx request.CTX, ss store require.NoError(t, nErr) _, err := ss.Channel().SaveMember(rctx, &model.ChannelMember{ ChannelId: channel1.Id, - UserId: userId, + UserId: userID, NotifyProps: model.GetDefaultChannelNotifyProps(), }) require.NoError(t, err) nErr = ss.Preference().Save(model.Preferences{ { - UserId: userId, + UserId: userID, Category: model.PreferenceCategoryFavoriteChannel, Name: channel1.Id, Value: "true", @@ -420,7 +420,7 @@ func testCreateInitialSidebarCategories(t *testing.T, rctx request.CTX, ss store TeamID: team.Id, ExcludeTeam: false, } - categories, nErr := ss.Channel().CreateInitialSidebarCategories(rctx, userId, opts) + categories, nErr := ss.Channel().CreateInitialSidebarCategories(rctx, userID, opts) require.NoError(t, nErr) require.Len(t, categories.Categories, 3) assert.Equal(t, model.SidebarCategoryFavorites, categories.Categories[0].Type) @@ -429,7 +429,7 @@ func testCreateInitialSidebarCategories(t *testing.T, rctx request.CTX, ss store assert.Equal(t, []string{}, categories.Categories[1].Channels) // Get and check the categories for channels - categories2, nErr := ss.Channel().GetSidebarCategoriesForTeamForUser(userId, team.Id) + categories2, nErr := ss.Channel().GetSidebarCategoriesForTeamForUser(userID, team.Id) require.NoError(t, nErr) require.Equal(t, categories, categories2) }) @@ -437,11 +437,11 @@ func testCreateInitialSidebarCategories(t *testing.T, rctx request.CTX, ss store func testCreateSidebarCategory(t *testing.T, rctx request.CTX, ss store.Store) { t.Run("Creating category without initial categories should fail", func(t *testing.T) { - userId := model.NewId() - teamId := model.NewId() + userID := model.NewId() + teamID := model.NewId() // Create the category - created, err := ss.Channel().CreateSidebarCategory(userId, teamId, &model.SidebarCategoryWithChannels{ + created, err := ss.Channel().CreateSidebarCategory(userID, teamID, &model.SidebarCategoryWithChannels{ SidebarCategory: model.SidebarCategory{ DisplayName: model.NewId(), }, @@ -453,20 +453,20 @@ func testCreateSidebarCategory(t *testing.T, rctx request.CTX, ss store.Store) { }) t.Run("should place the new category second if Favorites comes first", func(t *testing.T) { - userId := model.NewId() + userID := model.NewId() - team := setupTeam(t, rctx, ss, userId) + team := setupTeam(t, rctx, ss, userID) opts := &store.SidebarCategorySearchOpts{ TeamID: team.Id, ExcludeTeam: false, } - res, nErr := ss.Channel().CreateInitialSidebarCategories(rctx, userId, opts) + res, nErr := ss.Channel().CreateInitialSidebarCategories(rctx, userID, opts) require.NoError(t, nErr) require.NotEmpty(t, res) // Create the category - created, err := ss.Channel().CreateSidebarCategory(userId, team.Id, &model.SidebarCategoryWithChannels{ + created, err := ss.Channel().CreateSidebarCategory(userID, team.Id, &model.SidebarCategoryWithChannels{ SidebarCategory: model.SidebarCategory{ DisplayName: model.NewId(), }, @@ -474,7 +474,7 @@ func testCreateSidebarCategory(t *testing.T, rctx request.CTX, ss store.Store) { require.NoError(t, err) // Confirm that it comes second - res, err = ss.Channel().GetSidebarCategoriesForTeamForUser(userId, team.Id) + res, err = ss.Channel().GetSidebarCategoriesForTeamForUser(userID, team.Id) require.NoError(t, err) require.Len(t, res.Categories, 4) assert.Equal(t, model.SidebarCategoryFavorites, res.Categories[0].Type) @@ -483,25 +483,25 @@ func testCreateSidebarCategory(t *testing.T, rctx request.CTX, ss store.Store) { }) t.Run("should place the new category first if Favorites is not first", func(t *testing.T) { - userId := model.NewId() + userID := model.NewId() - team := setupTeam(t, rctx, ss, userId) + team := setupTeam(t, rctx, ss, userID) opts := &store.SidebarCategorySearchOpts{ TeamID: team.Id, ExcludeTeam: false, } - res, nErr := ss.Channel().CreateInitialSidebarCategories(rctx, userId, opts) + res, nErr := ss.Channel().CreateInitialSidebarCategories(rctx, userID, opts) require.NoError(t, nErr) require.NotEmpty(t, res) // Re-arrange the categories so that Favorites comes last - categories, err := ss.Channel().GetSidebarCategoriesForTeamForUser(userId, team.Id) + categories, err := ss.Channel().GetSidebarCategoriesForTeamForUser(userID, team.Id) require.NoError(t, err) require.Len(t, categories.Categories, 3) require.Equal(t, model.SidebarCategoryFavorites, categories.Categories[0].Type) - err = ss.Channel().UpdateSidebarCategoryOrder(userId, team.Id, []string{ + err = ss.Channel().UpdateSidebarCategoryOrder(userID, team.Id, []string{ categories.Categories[1].Id, categories.Categories[2].Id, categories.Categories[0].Id, @@ -509,7 +509,7 @@ func testCreateSidebarCategory(t *testing.T, rctx request.CTX, ss store.Store) { require.NoError(t, err) // Create the category - created, err := ss.Channel().CreateSidebarCategory(userId, team.Id, &model.SidebarCategoryWithChannels{ + created, err := ss.Channel().CreateSidebarCategory(userID, team.Id, &model.SidebarCategoryWithChannels{ SidebarCategory: model.SidebarCategory{ DisplayName: model.NewId(), }, @@ -517,7 +517,7 @@ func testCreateSidebarCategory(t *testing.T, rctx request.CTX, ss store.Store) { require.NoError(t, err) // Confirm that it comes first - res, err = ss.Channel().GetSidebarCategoriesForTeamForUser(userId, team.Id) + res, err = ss.Channel().GetSidebarCategoriesForTeamForUser(userID, team.Id) require.NoError(t, err) require.Len(t, res.Categories, 4) assert.Equal(t, model.SidebarCategoryCustom, res.Categories[0].Type) @@ -525,14 +525,14 @@ func testCreateSidebarCategory(t *testing.T, rctx request.CTX, ss store.Store) { }) t.Run("should create the category with its channels", func(t *testing.T) { - userId := model.NewId() - team := setupTeam(t, rctx, ss, userId) + userID := model.NewId() + team := setupTeam(t, rctx, ss, userID) opts := &store.SidebarCategorySearchOpts{ TeamID: team.Id, ExcludeTeam: false, } - res, nErr := ss.Channel().CreateInitialSidebarCategories(rctx, userId, opts) + res, nErr := ss.Channel().CreateInitialSidebarCategories(rctx, userID, opts) require.NoError(t, nErr) require.NotEmpty(t, res) @@ -551,7 +551,7 @@ func testCreateSidebarCategory(t *testing.T, rctx request.CTX, ss store.Store) { require.NoError(t, err) // Create the category - created, err := ss.Channel().CreateSidebarCategory(userId, team.Id, &model.SidebarCategoryWithChannels{ + created, err := ss.Channel().CreateSidebarCategory(userID, team.Id, &model.SidebarCategoryWithChannels{ SidebarCategory: model.SidebarCategory{ DisplayName: model.NewId(), }, @@ -567,18 +567,18 @@ func testCreateSidebarCategory(t *testing.T, rctx request.CTX, ss store.Store) { }) t.Run("should remove any channels from their previous categories", func(t *testing.T) { - userId := model.NewId() - team := setupTeam(t, rctx, ss, userId) + userID := model.NewId() + team := setupTeam(t, rctx, ss, userID) opts := &store.SidebarCategorySearchOpts{ TeamID: team.Id, ExcludeTeam: false, } - res, nErr := ss.Channel().CreateInitialSidebarCategories(rctx, userId, opts) + res, nErr := ss.Channel().CreateInitialSidebarCategories(rctx, userID, opts) require.NoError(t, nErr) require.NotEmpty(t, res) - categories, err := ss.Channel().GetSidebarCategoriesForTeamForUser(userId, team.Id) + categories, err := ss.Channel().GetSidebarCategoriesForTeamForUser(userID, team.Id) require.NoError(t, err) require.Len(t, categories.Categories, 3) @@ -604,14 +604,14 @@ func testCreateSidebarCategory(t *testing.T, rctx request.CTX, ss store.Store) { // Assign them to categories favoritesCategory.Channels = []string{channel1.Id} channelsCategory.Channels = []string{channel2.Id} - _, _, err = ss.Channel().UpdateSidebarCategories(userId, team.Id, []*model.SidebarCategoryWithChannels{ + _, _, err = ss.Channel().UpdateSidebarCategories(userID, team.Id, []*model.SidebarCategoryWithChannels{ favoritesCategory, channelsCategory, }) require.NoError(t, err) // Create the category - created, err := ss.Channel().CreateSidebarCategory(userId, team.Id, &model.SidebarCategoryWithChannels{ + created, err := ss.Channel().CreateSidebarCategory(userID, team.Id, &model.SidebarCategoryWithChannels{ SidebarCategory: model.SidebarCategory{ DisplayName: model.NewId(), }, @@ -631,19 +631,19 @@ func testCreateSidebarCategory(t *testing.T, rctx request.CTX, ss store.Store) { }) t.Run("should store the correct sorting value", func(t *testing.T) { - userId := model.NewId() + userID := model.NewId() - team := setupTeam(t, rctx, ss, userId) + team := setupTeam(t, rctx, ss, userID) opts := &store.SidebarCategorySearchOpts{ TeamID: team.Id, ExcludeTeam: false, } - res, nErr := ss.Channel().CreateInitialSidebarCategories(rctx, userId, opts) + res, nErr := ss.Channel().CreateInitialSidebarCategories(rctx, userID, opts) require.NoError(t, nErr) require.NotEmpty(t, res) // Create the category - created, err := ss.Channel().CreateSidebarCategory(userId, team.Id, &model.SidebarCategoryWithChannels{ + created, err := ss.Channel().CreateSidebarCategory(userID, team.Id, &model.SidebarCategoryWithChannels{ SidebarCategory: model.SidebarCategory{ DisplayName: model.NewId(), Sorting: model.SidebarCategorySortManual, @@ -652,7 +652,7 @@ func testCreateSidebarCategory(t *testing.T, rctx request.CTX, ss store.Store) { require.NoError(t, err) // Confirm that sorting value is correct - res, err = ss.Channel().GetSidebarCategoriesForTeamForUser(userId, team.Id) + res, err = ss.Channel().GetSidebarCategoriesForTeamForUser(userID, team.Id) require.NoError(t, err) require.Len(t, res.Categories, 4) // first category will be favorites and second will be newly created @@ -665,29 +665,29 @@ func testCreateSidebarCategory(t *testing.T, rctx request.CTX, ss store.Store) { func testGetSidebarCategory(t *testing.T, rctx request.CTX, ss store.Store, s SqlStore) { t.Run("should return a custom category with its Channels field set", func(t *testing.T) { - userId := model.NewId() - team := setupTeam(t, rctx, ss, userId) + userID := model.NewId() + team := setupTeam(t, rctx, ss, userID) - channelId1 := model.NewId() - channelId2 := model.NewId() - channelId3 := model.NewId() + channelID1 := model.NewId() + channelID2 := model.NewId() + channelID3 := model.NewId() opts := &store.SidebarCategorySearchOpts{ TeamID: team.Id, ExcludeTeam: false, } - res, nErr := ss.Channel().CreateInitialSidebarCategories(rctx, userId, opts) + res, nErr := ss.Channel().CreateInitialSidebarCategories(rctx, userID, opts) require.NoError(t, nErr) require.NotEmpty(t, res) // Create a category and assign some channels to it - created, err := ss.Channel().CreateSidebarCategory(userId, team.Id, &model.SidebarCategoryWithChannels{ + created, err := ss.Channel().CreateSidebarCategory(userID, team.Id, &model.SidebarCategoryWithChannels{ SidebarCategory: model.SidebarCategory{ - UserId: userId, + UserId: userID, TeamId: team.Id, DisplayName: model.NewId(), }, - Channels: []string{channelId1, channelId2, channelId3}, + Channels: []string{channelID1, channelID2, channelID3}, }) require.NoError(t, err) require.NotNil(t, created) @@ -698,23 +698,23 @@ func testGetSidebarCategory(t *testing.T, rctx request.CTX, ss store.Store, s Sq assert.Equal(t, created.Id, res2.Id) assert.Equal(t, model.SidebarCategoryCustom, res2.Type) assert.Equal(t, created.DisplayName, res2.DisplayName) - assert.Equal(t, []string{channelId1, channelId2, channelId3}, res2.Channels) + assert.Equal(t, []string{channelID1, channelID2, channelID3}, res2.Channels) }) t.Run("should return any orphaned channels with the Channels category", func(t *testing.T) { - userId := model.NewId() - team := setupTeam(t, rctx, ss, userId) + userID := model.NewId() + team := setupTeam(t, rctx, ss, userID) // Create the initial categories and find the channels category opts := &store.SidebarCategorySearchOpts{ TeamID: team.Id, ExcludeTeam: false, } - res, nErr := ss.Channel().CreateInitialSidebarCategories(rctx, userId, opts) + res, nErr := ss.Channel().CreateInitialSidebarCategories(rctx, userID, opts) require.NoError(t, nErr) require.NotEmpty(t, res) - categories, err := ss.Channel().GetSidebarCategoriesForTeamForUser(userId, team.Id) + categories, err := ss.Channel().GetSidebarCategoriesForTeamForUser(userID, team.Id) require.NoError(t, err) channelsCategory := categories.Categories[1] @@ -729,7 +729,7 @@ func testGetSidebarCategory(t *testing.T, rctx request.CTX, ss store.Store, s Sq }, 10) require.NoError(t, nErr) _, nErr = ss.Channel().SaveMember(rctx, &model.ChannelMember{ - UserId: userId, + UserId: userID, ChannelId: channel1.Id, NotifyProps: model.GetDefaultChannelNotifyProps(), }) @@ -743,7 +743,7 @@ func testGetSidebarCategory(t *testing.T, rctx request.CTX, ss store.Store, s Sq }, 10) require.NoError(t, nErr) _, nErr = ss.Channel().SaveMember(rctx, &model.ChannelMember{ - UserId: userId, + UserId: userID, ChannelId: channel2.Id, NotifyProps: model.GetDefaultChannelNotifyProps(), }) @@ -770,19 +770,19 @@ func testGetSidebarCategory(t *testing.T, rctx request.CTX, ss store.Store, s Sq }) t.Run("shouldn't return orphaned channels on another team with the Channels category", func(t *testing.T) { - userId := model.NewId() - team := setupTeam(t, rctx, ss, userId) + userID := model.NewId() + team := setupTeam(t, rctx, ss, userID) // Create the initial categories and find the channels category opts := &store.SidebarCategorySearchOpts{ TeamID: team.Id, ExcludeTeam: false, } - res, nErr := ss.Channel().CreateInitialSidebarCategories(rctx, userId, opts) + res, nErr := ss.Channel().CreateInitialSidebarCategories(rctx, userID, opts) require.NoError(t, nErr) require.NotEmpty(t, res) - categories, err := ss.Channel().GetSidebarCategoriesForTeamForUser(userId, team.Id) + categories, err := ss.Channel().GetSidebarCategoriesForTeamForUser(userID, team.Id) require.NoError(t, err) require.Equal(t, model.SidebarCategoryChannels, categories.Categories[1].Type) @@ -798,7 +798,7 @@ func testGetSidebarCategory(t *testing.T, rctx request.CTX, ss store.Store, s Sq defer ss.Channel().PermanentDelete(rctx, channel1.Id) _, nErr = ss.Channel().SaveMember(rctx, &model.ChannelMember{ - UserId: userId, + UserId: userID, ChannelId: channel1.Id, NotifyProps: model.GetDefaultChannelNotifyProps(), }) @@ -813,19 +813,19 @@ func testGetSidebarCategory(t *testing.T, rctx request.CTX, ss store.Store, s Sq }) t.Run("shouldn't return non-orphaned channels with the Channels category", func(t *testing.T) { - userId := model.NewId() - team := setupTeam(t, rctx, ss, userId) + userID := model.NewId() + team := setupTeam(t, rctx, ss, userID) opts := &store.SidebarCategorySearchOpts{ TeamID: team.Id, ExcludeTeam: false, } // Create the initial categories and find the channels category - res, nErr := ss.Channel().CreateInitialSidebarCategories(rctx, userId, opts) + res, nErr := ss.Channel().CreateInitialSidebarCategories(rctx, userID, opts) require.NoError(t, nErr) require.NotEmpty(t, res) - categories, err := ss.Channel().GetSidebarCategoriesForTeamForUser(userId, team.Id) + categories, err := ss.Channel().GetSidebarCategoriesForTeamForUser(userID, team.Id) require.NoError(t, err) favoritesCategory := categories.Categories[0] @@ -842,7 +842,7 @@ func testGetSidebarCategory(t *testing.T, rctx request.CTX, ss store.Store, s Sq }, 10) require.NoError(t, nErr) _, nErr = ss.Channel().SaveMember(rctx, &model.ChannelMember{ - UserId: userId, + UserId: userID, ChannelId: channel1.Id, NotifyProps: model.GetDefaultChannelNotifyProps(), }) @@ -856,14 +856,14 @@ func testGetSidebarCategory(t *testing.T, rctx request.CTX, ss store.Store, s Sq }, 10) require.NoError(t, nErr) _, nErr = ss.Channel().SaveMember(rctx, &model.ChannelMember{ - UserId: userId, + UserId: userID, ChannelId: channel2.Id, NotifyProps: model.GetDefaultChannelNotifyProps(), }) require.NoError(t, nErr) // And assign one to another category - _, _, err = ss.Channel().UpdateSidebarCategories(userId, team.Id, []*model.SidebarCategoryWithChannels{ + _, _, err = ss.Channel().UpdateSidebarCategories(userID, team.Id, []*model.SidebarCategoryWithChannels{ { SidebarCategory: favoritesCategory.SidebarCategory, Channels: []string{channel2.Id}, @@ -880,37 +880,37 @@ func testGetSidebarCategory(t *testing.T, rctx request.CTX, ss store.Store, s Sq }) t.Run("should return any orphaned DM channels with the Direct Messages category", func(t *testing.T) { - userId := model.NewId() - team := setupTeam(t, rctx, ss, userId) + userID := model.NewId() + team := setupTeam(t, rctx, ss, userID) // Create the initial categories and find the DMs category opts := &store.SidebarCategorySearchOpts{ TeamID: team.Id, ExcludeTeam: false, } - res, nErr := ss.Channel().CreateInitialSidebarCategories(rctx, userId, opts) + res, nErr := ss.Channel().CreateInitialSidebarCategories(rctx, userID, opts) require.NoError(t, nErr) require.NotEmpty(t, res) - categories, err := ss.Channel().GetSidebarCategoriesForTeamForUser(userId, team.Id) + categories, err := ss.Channel().GetSidebarCategoriesForTeamForUser(userID, team.Id) require.NoError(t, err) require.Equal(t, model.SidebarCategoryDirectMessages, categories.Categories[2].Type) dmsCategory := categories.Categories[2] // Create a DM - otherUserId := model.NewId() + otherUserID := model.NewId() dmChannel, nErr := ss.Channel().SaveDirectChannel(rctx, &model.Channel{ - Name: model.GetDMNameFromIds(userId, otherUserId), + Name: model.GetDMNameFromIds(userID, otherUserID), Type: model.ChannelTypeDirect, }, &model.ChannelMember{ - UserId: userId, + UserId: userID, NotifyProps: model.GetDefaultChannelNotifyProps(), }, &model.ChannelMember{ - UserId: otherUserId, + UserId: otherUserID, NotifyProps: model.GetDefaultChannelNotifyProps(), }, ) @@ -925,19 +925,19 @@ func testGetSidebarCategory(t *testing.T, rctx request.CTX, ss store.Store, s Sq }) t.Run("should return any orphaned GM channels with the Direct Messages category", func(t *testing.T) { - userId := model.NewId() - team := setupTeam(t, rctx, ss, userId) + userID := model.NewId() + team := setupTeam(t, rctx, ss, userID) // Create the initial categories and find the DMs category opts := &store.SidebarCategorySearchOpts{ TeamID: team.Id, ExcludeTeam: false, } - res, nErr := ss.Channel().CreateInitialSidebarCategories(rctx, userId, opts) + res, nErr := ss.Channel().CreateInitialSidebarCategories(rctx, userID, opts) require.NoError(t, nErr) require.NotEmpty(t, res) - categories, err := ss.Channel().GetSidebarCategoriesForTeamForUser(userId, team.Id) + categories, err := ss.Channel().GetSidebarCategoriesForTeamForUser(userID, team.Id) require.NoError(t, err) require.Equal(t, model.SidebarCategoryDirectMessages, categories.Categories[2].Type) @@ -952,7 +952,7 @@ func testGetSidebarCategory(t *testing.T, rctx request.CTX, ss store.Store, s Sq require.NoError(t, nErr) defer ss.Channel().PermanentDelete(rctx, gmChannel.Id) _, nErr = ss.Channel().SaveMember(rctx, &model.ChannelMember{ - UserId: userId, + UserId: userID, ChannelId: gmChannel.Id, NotifyProps: model.GetDefaultChannelNotifyProps(), }) @@ -967,55 +967,55 @@ func testGetSidebarCategory(t *testing.T, rctx request.CTX, ss store.Store, s Sq }) t.Run("should return orphaned DM channels in the DMs category which are in a custom category on another team", func(t *testing.T) { - userId := model.NewId() - team := setupTeam(t, rctx, ss, userId) + userID := model.NewId() + team := setupTeam(t, rctx, ss, userID) // Create the initial categories and find the DMs category opts := &store.SidebarCategorySearchOpts{ TeamID: team.Id, ExcludeTeam: false, } - res, nErr := ss.Channel().CreateInitialSidebarCategories(rctx, userId, opts) + res, nErr := ss.Channel().CreateInitialSidebarCategories(rctx, userID, opts) require.NoError(t, nErr) require.NotEmpty(t, res) - categories, err := ss.Channel().GetSidebarCategoriesForTeamForUser(userId, team.Id) + categories, err := ss.Channel().GetSidebarCategoriesForTeamForUser(userID, team.Id) require.NoError(t, err) require.Equal(t, model.SidebarCategoryDirectMessages, categories.Categories[2].Type) dmsCategory := categories.Categories[2] // Create a DM - otherUserId := model.NewId() + otherUserID := model.NewId() dmChannel, nErr := ss.Channel().SaveDirectChannel(rctx, &model.Channel{ - Name: model.GetDMNameFromIds(userId, otherUserId), + Name: model.GetDMNameFromIds(userID, otherUserID), Type: model.ChannelTypeDirect, }, &model.ChannelMember{ - UserId: userId, + UserId: userID, NotifyProps: model.GetDefaultChannelNotifyProps(), }, &model.ChannelMember{ - UserId: otherUserId, + UserId: otherUserID, NotifyProps: model.GetDefaultChannelNotifyProps(), }, ) require.NoError(t, nErr) // Create another team and assign the DM to a custom category on that team - otherTeam := setupTeam(t, rctx, ss, userId) + otherTeam := setupTeam(t, rctx, ss, userID) opts = &store.SidebarCategorySearchOpts{ TeamID: otherTeam.Id, ExcludeTeam: false, } - res, nErr = ss.Channel().CreateInitialSidebarCategories(rctx, userId, opts) + res, nErr = ss.Channel().CreateInitialSidebarCategories(rctx, userID, opts) require.NoError(t, nErr) require.NotEmpty(t, res) - _, err = ss.Channel().CreateSidebarCategory(userId, otherTeam.Id, &model.SidebarCategoryWithChannels{ + _, err = ss.Channel().CreateSidebarCategory(userID, otherTeam.Id, &model.SidebarCategoryWithChannels{ SidebarCategory: model.SidebarCategory{ - UserId: userId, + UserId: userID, TeamId: team.Id, }, Channels: []string{dmChannel.Id}, @@ -1033,14 +1033,14 @@ func testGetSidebarCategory(t *testing.T, rctx request.CTX, ss store.Store, s Sq func testGetSidebarCategories(t *testing.T, rctx request.CTX, ss store.Store) { t.Run("should return channels in the same order between different ways of getting categories", func(t *testing.T) { - userId := model.NewId() - team := setupTeam(t, rctx, ss, userId) + userID := model.NewId() + team := setupTeam(t, rctx, ss, userID) opts := &store.SidebarCategorySearchOpts{ TeamID: team.Id, ExcludeTeam: false, } - res, nErr := ss.Channel().CreateInitialSidebarCategories(rctx, userId, opts) + res, nErr := ss.Channel().CreateInitialSidebarCategories(rctx, userID, opts) require.NoError(t, nErr) require.NotEmpty(t, res) @@ -1050,7 +1050,7 @@ func testGetSidebarCategories(t *testing.T, rctx request.CTX, ss store.Store) { model.NewId(), } - newCategory, err := ss.Channel().CreateSidebarCategory(userId, team.Id, &model.SidebarCategoryWithChannels{ + newCategory, err := ss.Channel().CreateSidebarCategory(userID, team.Id, &model.SidebarCategoryWithChannels{ Channels: channelIds, }) require.NoError(t, err) @@ -1059,7 +1059,7 @@ func testGetSidebarCategories(t *testing.T, rctx request.CTX, ss store.Store) { gotCategory, err := ss.Channel().GetSidebarCategory(newCategory.Id) require.NoError(t, err) - res, err = ss.Channel().GetSidebarCategoriesForTeamForUser(userId, team.Id) + res, err = ss.Channel().GetSidebarCategoriesForTeamForUser(userID, team.Id) require.NoError(t, err) require.Len(t, res.Categories, 4) @@ -1071,17 +1071,17 @@ func testGetSidebarCategories(t *testing.T, rctx request.CTX, ss store.Store) { assert.Equal(t, channelIds, res.Categories[1].Channels) }) t.Run("should not return categories for teams deleted, or no longer a member", func(t *testing.T) { - userId := model.NewId() + userID := model.NewId() - teamMember1 := setupTeam(t, rctx, ss, userId) - teamMember2 := setupTeam(t, rctx, ss, userId) - teamDeleted := setupTeam(t, rctx, ss, userId) + teamMember1 := setupTeam(t, rctx, ss, userID) + teamMember2 := setupTeam(t, rctx, ss, userID) + teamDeleted := setupTeam(t, rctx, ss, userID) teamDeleted.DeleteAt = model.GetMillis() ss.Team().Update(teamDeleted) teamNotMember := setupTeam(t, rctx, ss) - teamDeletedMember := setupTeam(t, rctx, ss, userId) + teamDeletedMember := setupTeam(t, rctx, ss, userID) - members, err := ss.Team().GetMembersByIds(teamDeletedMember.Id, []string{userId}, nil) + members, err := ss.Team().GetMembersByIds(teamDeletedMember.Id, []string{userID}, nil) require.NoError(t, err) require.NotEmpty(t, members) member := members[0] @@ -1097,7 +1097,7 @@ func testGetSidebarCategories(t *testing.T, rctx request.CTX, ss store.Store) { } for _, id := range teamIds { - res, nErr := ss.Channel().CreateInitialSidebarCategories(rctx, userId, &store.SidebarCategorySearchOpts{TeamID: id}) + res, nErr := ss.Channel().CreateInitialSidebarCategories(rctx, userID, &store.SidebarCategorySearchOpts{TeamID: id}) require.NoError(t, nErr) require.NotEmpty(t, res) } @@ -1108,25 +1108,25 @@ func testGetSidebarCategories(t *testing.T, rctx request.CTX, ss store.Store) { } // Team member and not exclude - res, err := ss.Channel().GetSidebarCategories(userId, opts) + res, err := ss.Channel().GetSidebarCategories(userID, opts) require.NoError(t, err) assert.Equal(t, 3, len(res.Categories)) // No team member and not exclude opts.TeamID = teamDeleted.Id - res, err = ss.Channel().GetSidebarCategories(userId, opts) + res, err = ss.Channel().GetSidebarCategories(userID, opts) require.NoError(t, err) assert.Equal(t, 0, len(res.Categories)) // No team member and exclude opts.ExcludeTeam = true - res, err = ss.Channel().GetSidebarCategories(userId, opts) + res, err = ss.Channel().GetSidebarCategories(userID, opts) require.NoError(t, err) assert.Equal(t, 6, len(res.Categories)) // Team member and exclude opts.TeamID = teamMember1.Id - res, err = ss.Channel().GetSidebarCategories(userId, opts) + res, err = ss.Channel().GetSidebarCategories(userID, opts) require.NoError(t, err) assert.Equal(t, 3, len(res.Categories)) }) @@ -1134,19 +1134,19 @@ func testGetSidebarCategories(t *testing.T, rctx request.CTX, ss store.Store) { func testUpdateSidebarCategories(t *testing.T, rctx request.CTX, ss store.Store) { t.Run("ensure the query to update SidebarCategories hasn't been polluted by UpdateSidebarCategoryOrder", func(t *testing.T) { - userId := model.NewId() - team := setupTeam(t, rctx, ss, userId) + userID := model.NewId() + team := setupTeam(t, rctx, ss, userID) // Create the initial categories opts := &store.SidebarCategorySearchOpts{ TeamID: team.Id, ExcludeTeam: false, } - res, err := ss.Channel().CreateInitialSidebarCategories(rctx, userId, opts) + res, err := ss.Channel().CreateInitialSidebarCategories(rctx, userID, opts) require.NoError(t, err) require.NotEmpty(t, res) - initialCategories, err := ss.Channel().GetSidebarCategoriesForTeamForUser(userId, team.Id) + initialCategories, err := ss.Channel().GetSidebarCategoriesForTeamForUser(userID, team.Id) require.NoError(t, err) favoritesCategory := initialCategories.Categories[0] @@ -1154,7 +1154,7 @@ func testUpdateSidebarCategories(t *testing.T, rctx request.CTX, ss store.Store) dmsCategory := initialCategories.Categories[2] // And then update one of them - updated, _, err := ss.Channel().UpdateSidebarCategories(userId, team.Id, []*model.SidebarCategoryWithChannels{ + updated, _, err := ss.Channel().UpdateSidebarCategories(userID, team.Id, []*model.SidebarCategoryWithChannels{ channelsCategory, }) require.NoError(t, err) @@ -1162,7 +1162,7 @@ func testUpdateSidebarCategories(t *testing.T, rctx request.CTX, ss store.Store) assert.Equal(t, "Channels", updated[0].DisplayName) // And then reorder the categories - err = ss.Channel().UpdateSidebarCategoryOrder(userId, team.Id, []string{dmsCategory.Id, favoritesCategory.Id, channelsCategory.Id}) + err = ss.Channel().UpdateSidebarCategoryOrder(userID, team.Id, []string{dmsCategory.Id, favoritesCategory.Id, channelsCategory.Id}) require.NoError(t, err) // Which somehow blanks out stuff because ??? @@ -1172,19 +1172,19 @@ func testUpdateSidebarCategories(t *testing.T, rctx request.CTX, ss store.Store) }) t.Run("categories should be returned in their original order", func(t *testing.T) { - userId := model.NewId() - team := setupTeam(t, rctx, ss, userId) + userID := model.NewId() + team := setupTeam(t, rctx, ss, userID) // Create the initial categories opts := &store.SidebarCategorySearchOpts{ TeamID: team.Id, ExcludeTeam: false, } - res, err := ss.Channel().CreateInitialSidebarCategories(rctx, userId, opts) + res, err := ss.Channel().CreateInitialSidebarCategories(rctx, userID, opts) require.NoError(t, err) require.NotEmpty(t, res) - initialCategories, err := ss.Channel().GetSidebarCategoriesForTeamForUser(userId, team.Id) + initialCategories, err := ss.Channel().GetSidebarCategoriesForTeamForUser(userID, team.Id) require.NoError(t, err) favoritesCategory := initialCategories.Categories[0] @@ -1192,7 +1192,7 @@ func testUpdateSidebarCategories(t *testing.T, rctx request.CTX, ss store.Store) dmsCategory := initialCategories.Categories[2] // And then update them - updatedCategories, _, err := ss.Channel().UpdateSidebarCategories(userId, team.Id, []*model.SidebarCategoryWithChannels{ + updatedCategories, _, err := ss.Channel().UpdateSidebarCategories(userID, team.Id, []*model.SidebarCategoryWithChannels{ favoritesCategory, channelsCategory, dmsCategory, @@ -1204,25 +1204,25 @@ func testUpdateSidebarCategories(t *testing.T, rctx request.CTX, ss store.Store) }) t.Run("should silently fail to update read only fields", func(t *testing.T) { - userId := model.NewId() - team := setupTeam(t, rctx, ss, userId) + userID := model.NewId() + team := setupTeam(t, rctx, ss, userID) opts := &store.SidebarCategorySearchOpts{ TeamID: team.Id, ExcludeTeam: false, } - res, nErr := ss.Channel().CreateInitialSidebarCategories(rctx, userId, opts) + res, nErr := ss.Channel().CreateInitialSidebarCategories(rctx, userID, opts) require.NoError(t, nErr) require.NotEmpty(t, res) - initialCategories, err := ss.Channel().GetSidebarCategoriesForTeamForUser(userId, team.Id) + initialCategories, err := ss.Channel().GetSidebarCategoriesForTeamForUser(userID, team.Id) require.NoError(t, err) favoritesCategory := initialCategories.Categories[0] channelsCategory := initialCategories.Categories[1] dmsCategory := initialCategories.Categories[2] - customCategory, err := ss.Channel().CreateSidebarCategory(userId, team.Id, &model.SidebarCategoryWithChannels{}) + customCategory, err := ss.Channel().CreateSidebarCategory(userID, team.Id, &model.SidebarCategoryWithChannels{}) require.NoError(t, err) categoriesToUpdate := []*model.SidebarCategoryWithChannels{ @@ -1260,7 +1260,7 @@ func testUpdateSidebarCategories(t *testing.T, rctx request.CTX, ss store.Store) }, } - updatedCategories, _, err := ss.Channel().UpdateSidebarCategories(userId, team.Id, categoriesToUpdate) + updatedCategories, _, err := ss.Channel().UpdateSidebarCategories(userID, team.Id, categoriesToUpdate) assert.NoError(t, err) assert.NotEqual(t, "Favorites", categoriesToUpdate[0].DisplayName) @@ -1269,24 +1269,24 @@ func testUpdateSidebarCategories(t *testing.T, rctx request.CTX, ss store.Store) assert.Equal(t, model.SidebarCategoryChannels, updatedCategories[1].Type) assert.NotEqual(t, []string{}, categoriesToUpdate[2].Channels) assert.Equal(t, []string{}, updatedCategories[2].Channels) - assert.NotEqual(t, userId, categoriesToUpdate[3].UserId) - assert.Equal(t, userId, updatedCategories[3].UserId) + assert.NotEqual(t, userID, categoriesToUpdate[3].UserId) + assert.Equal(t, userID, updatedCategories[3].UserId) }) t.Run("should add and remove favorites preferences based on the Favorites category", func(t *testing.T) { - userId := model.NewId() - team := setupTeam(t, rctx, ss, userId) + userID := model.NewId() + team := setupTeam(t, rctx, ss, userID) // Create the initial categories and find the favorites category opts := &store.SidebarCategorySearchOpts{ TeamID: team.Id, ExcludeTeam: false, } - res, nErr := ss.Channel().CreateInitialSidebarCategories(rctx, userId, opts) + res, nErr := ss.Channel().CreateInitialSidebarCategories(rctx, userID, opts) require.NoError(t, nErr) require.NotEmpty(t, res) - categories, err := ss.Channel().GetSidebarCategoriesForTeamForUser(userId, team.Id) + categories, err := ss.Channel().GetSidebarCategoriesForTeamForUser(userID, team.Id) require.NoError(t, err) favoritesCategory := categories.Categories[0] @@ -1300,14 +1300,14 @@ func testUpdateSidebarCategories(t *testing.T, rctx request.CTX, ss store.Store) }, 10) require.NoError(t, nErr) _, nErr = ss.Channel().SaveMember(rctx, &model.ChannelMember{ - UserId: userId, + UserId: userID, ChannelId: channel.Id, NotifyProps: model.GetDefaultChannelNotifyProps(), }) require.NoError(t, nErr) // Assign it to favorites - _, _, err = ss.Channel().UpdateSidebarCategories(userId, team.Id, []*model.SidebarCategoryWithChannels{ + _, _, err = ss.Channel().UpdateSidebarCategories(userID, team.Id, []*model.SidebarCategoryWithChannels{ { SidebarCategory: favoritesCategory.SidebarCategory, Channels: []string{channel.Id}, @@ -1315,7 +1315,7 @@ func testUpdateSidebarCategories(t *testing.T, rctx request.CTX, ss store.Store) }) assert.NoError(t, err) - res2, nErr := ss.Preference().Get(userId, model.PreferenceCategoryFavoriteChannel, channel.Id) + res2, nErr := ss.Preference().Get(userID, model.PreferenceCategoryFavoriteChannel, channel.Id) assert.NoError(t, nErr) assert.NotNil(t, res2) assert.Equal(t, "true", res2.Value) @@ -1324,7 +1324,7 @@ func testUpdateSidebarCategories(t *testing.T, rctx request.CTX, ss store.Store) channelsCategory := categories.Categories[1] require.Equal(t, model.SidebarCategoryChannels, channelsCategory.Type) - _, _, err = ss.Channel().UpdateSidebarCategories(userId, team.Id, []*model.SidebarCategoryWithChannels{ + _, _, err = ss.Channel().UpdateSidebarCategories(userID, team.Id, []*model.SidebarCategoryWithChannels{ { SidebarCategory: channelsCategory.SidebarCategory, Channels: []string{channel.Id}, @@ -1332,52 +1332,52 @@ func testUpdateSidebarCategories(t *testing.T, rctx request.CTX, ss store.Store) }) assert.NoError(t, err) - res2, nErr = ss.Preference().Get(userId, model.PreferenceCategoryFavoriteChannel, channel.Id) + res2, nErr = ss.Preference().Get(userID, model.PreferenceCategoryFavoriteChannel, channel.Id) assert.Error(t, nErr) assert.True(t, errors.Is(nErr, sql.ErrNoRows)) assert.Nil(t, res2) }) t.Run("should add and remove favorites preferences for DMs", func(t *testing.T) { - userId := model.NewId() - team := setupTeam(t, rctx, ss, userId) + userID := model.NewId() + team := setupTeam(t, rctx, ss, userID) // Create the initial categories and find the favorites category opts := &store.SidebarCategorySearchOpts{ TeamID: team.Id, ExcludeTeam: false, } - res, nErr := ss.Channel().CreateInitialSidebarCategories(rctx, userId, opts) + res, nErr := ss.Channel().CreateInitialSidebarCategories(rctx, userID, opts) require.NoError(t, nErr) require.NotEmpty(t, res) - categories, err := ss.Channel().GetSidebarCategoriesForTeamForUser(userId, team.Id) + categories, err := ss.Channel().GetSidebarCategoriesForTeamForUser(userID, team.Id) require.NoError(t, err) favoritesCategory := categories.Categories[0] require.Equal(t, model.SidebarCategoryFavorites, favoritesCategory.Type) // Create a direct channel - otherUserId := model.NewId() + otherUserID := model.NewId() dmChannel, nErr := ss.Channel().SaveDirectChannel(rctx, &model.Channel{ - Name: model.GetDMNameFromIds(userId, otherUserId), + Name: model.GetDMNameFromIds(userID, otherUserID), Type: model.ChannelTypeDirect, }, &model.ChannelMember{ - UserId: userId, + UserId: userID, NotifyProps: model.GetDefaultChannelNotifyProps(), }, &model.ChannelMember{ - UserId: otherUserId, + UserId: otherUserID, NotifyProps: model.GetDefaultChannelNotifyProps(), }, ) assert.NoError(t, nErr) // Assign it to favorites - _, _, err = ss.Channel().UpdateSidebarCategories(userId, team.Id, []*model.SidebarCategoryWithChannels{ + _, _, err = ss.Channel().UpdateSidebarCategories(userID, team.Id, []*model.SidebarCategoryWithChannels{ { SidebarCategory: favoritesCategory.SidebarCategory, Channels: []string{dmChannel.Id}, @@ -1385,7 +1385,7 @@ func testUpdateSidebarCategories(t *testing.T, rctx request.CTX, ss store.Store) }) assert.NoError(t, err) - res2, nErr := ss.Preference().Get(userId, model.PreferenceCategoryFavoriteChannel, dmChannel.Id) + res2, nErr := ss.Preference().Get(userID, model.PreferenceCategoryFavoriteChannel, dmChannel.Id) assert.NoError(t, nErr) assert.NotNil(t, res2) assert.Equal(t, "true", res2.Value) @@ -1394,7 +1394,7 @@ func testUpdateSidebarCategories(t *testing.T, rctx request.CTX, ss store.Store) dmsCategory := categories.Categories[2] require.Equal(t, model.SidebarCategoryDirectMessages, dmsCategory.Type) - _, _, err = ss.Channel().UpdateSidebarCategories(userId, team.Id, []*model.SidebarCategoryWithChannels{ + _, _, err = ss.Channel().UpdateSidebarCategories(userID, team.Id, []*model.SidebarCategoryWithChannels{ { SidebarCategory: dmsCategory.SidebarCategory, Channels: []string{dmChannel.Id}, @@ -1402,27 +1402,27 @@ func testUpdateSidebarCategories(t *testing.T, rctx request.CTX, ss store.Store) }) assert.NoError(t, err) - res2, nErr = ss.Preference().Get(userId, model.PreferenceCategoryFavoriteChannel, dmChannel.Id) + res2, nErr = ss.Preference().Get(userID, model.PreferenceCategoryFavoriteChannel, dmChannel.Id) assert.Error(t, nErr) assert.True(t, errors.Is(nErr, sql.ErrNoRows)) assert.Nil(t, res2) }) t.Run("should add and remove favorites preferences, even if the channel is already favorited in preferences", func(t *testing.T) { - userId := model.NewId() - team := setupTeam(t, rctx, ss, userId) - team2 := setupTeam(t, rctx, ss, userId) + userID := model.NewId() + team := setupTeam(t, rctx, ss, userID) + team2 := setupTeam(t, rctx, ss, userID) // Create the initial categories and find the favorites categories in each team opts := &store.SidebarCategorySearchOpts{ TeamID: team.Id, ExcludeTeam: false, } - res, nErr := ss.Channel().CreateInitialSidebarCategories(rctx, userId, opts) + res, nErr := ss.Channel().CreateInitialSidebarCategories(rctx, userID, opts) require.NoError(t, nErr) require.NotEmpty(t, res) - categories, err := ss.Channel().GetSidebarCategoriesForTeamForUser(userId, team.Id) + categories, err := ss.Channel().GetSidebarCategoriesForTeamForUser(userID, team.Id) require.NoError(t, err) favoritesCategory := categories.Categories[0] @@ -1432,37 +1432,37 @@ func testUpdateSidebarCategories(t *testing.T, rctx request.CTX, ss store.Store) TeamID: team2.Id, ExcludeTeam: false, } - res, nErr = ss.Channel().CreateInitialSidebarCategories(rctx, userId, opts) + res, nErr = ss.Channel().CreateInitialSidebarCategories(rctx, userID, opts) require.NoError(t, nErr) require.NotEmpty(t, res) - categories2, err := ss.Channel().GetSidebarCategoriesForTeamForUser(userId, team2.Id) + categories2, err := ss.Channel().GetSidebarCategoriesForTeamForUser(userID, team2.Id) require.NoError(t, err) favoritesCategory2 := categories2.Categories[0] require.Equal(t, model.SidebarCategoryFavorites, favoritesCategory2.Type) // Create a direct channel - otherUserId := model.NewId() + otherUserID := model.NewId() dmChannel, nErr := ss.Channel().SaveDirectChannel(rctx, &model.Channel{ - Name: model.GetDMNameFromIds(userId, otherUserId), + Name: model.GetDMNameFromIds(userID, otherUserID), Type: model.ChannelTypeDirect, }, &model.ChannelMember{ - UserId: userId, + UserId: userID, NotifyProps: model.GetDefaultChannelNotifyProps(), }, &model.ChannelMember{ - UserId: otherUserId, + UserId: otherUserID, NotifyProps: model.GetDefaultChannelNotifyProps(), }, ) assert.NoError(t, nErr) // Assign it to favorites on the first team. The favorites preference gets set for all teams. - _, _, err = ss.Channel().UpdateSidebarCategories(userId, team.Id, []*model.SidebarCategoryWithChannels{ + _, _, err = ss.Channel().UpdateSidebarCategories(userID, team.Id, []*model.SidebarCategoryWithChannels{ { SidebarCategory: favoritesCategory.SidebarCategory, Channels: []string{dmChannel.Id}, @@ -1470,13 +1470,13 @@ func testUpdateSidebarCategories(t *testing.T, rctx request.CTX, ss store.Store) }) assert.NoError(t, err) - res2, nErr := ss.Preference().Get(userId, model.PreferenceCategoryFavoriteChannel, dmChannel.Id) + res2, nErr := ss.Preference().Get(userID, model.PreferenceCategoryFavoriteChannel, dmChannel.Id) assert.NoError(t, nErr) assert.NotNil(t, res2) assert.Equal(t, "true", res2.Value) // Assign it to favorites on the second team. The favorites preference is already set. - updated, _, err := ss.Channel().UpdateSidebarCategories(userId, team.Id, []*model.SidebarCategoryWithChannels{ + updated, _, err := ss.Channel().UpdateSidebarCategories(userID, team.Id, []*model.SidebarCategoryWithChannels{ { SidebarCategory: favoritesCategory2.SidebarCategory, Channels: []string{dmChannel.Id}, @@ -1485,13 +1485,13 @@ func testUpdateSidebarCategories(t *testing.T, rctx request.CTX, ss store.Store) assert.NoError(t, err) assert.Equal(t, []string{dmChannel.Id}, updated[0].Channels) - res2, nErr = ss.Preference().Get(userId, model.PreferenceCategoryFavoriteChannel, dmChannel.Id) + res2, nErr = ss.Preference().Get(userID, model.PreferenceCategoryFavoriteChannel, dmChannel.Id) assert.NoError(t, nErr) assert.NotNil(t, res2) assert.Equal(t, "true", res2.Value) // Remove it from favorites on the first team. This clears the favorites preference for all teams. - _, _, err = ss.Channel().UpdateSidebarCategories(userId, team.Id, []*model.SidebarCategoryWithChannels{ + _, _, err = ss.Channel().UpdateSidebarCategories(userID, team.Id, []*model.SidebarCategoryWithChannels{ { SidebarCategory: favoritesCategory.SidebarCategory, Channels: []string{}, @@ -1499,12 +1499,12 @@ func testUpdateSidebarCategories(t *testing.T, rctx request.CTX, ss store.Store) }) assert.NoError(t, err) - res2, nErr = ss.Preference().Get(userId, model.PreferenceCategoryFavoriteChannel, dmChannel.Id) + res2, nErr = ss.Preference().Get(userID, model.PreferenceCategoryFavoriteChannel, dmChannel.Id) require.Error(t, nErr) assert.Nil(t, res2) // Remove it from favorites on the second team. The favorites preference was already deleted. - _, _, err = ss.Channel().UpdateSidebarCategories(userId, team.Id, []*model.SidebarCategoryWithChannels{ + _, _, err = ss.Channel().UpdateSidebarCategories(userID, team.Id, []*model.SidebarCategoryWithChannels{ { SidebarCategory: favoritesCategory2.SidebarCategory, Channels: []string{}, @@ -1512,26 +1512,26 @@ func testUpdateSidebarCategories(t *testing.T, rctx request.CTX, ss store.Store) }) assert.NoError(t, err) - res2, nErr = ss.Preference().Get(userId, model.PreferenceCategoryFavoriteChannel, dmChannel.Id) + res2, nErr = ss.Preference().Get(userID, model.PreferenceCategoryFavoriteChannel, dmChannel.Id) require.Error(t, nErr) assert.Nil(t, res2) }) t.Run("should not affect other users' favorites preferences", func(t *testing.T) { - userId := model.NewId() - userId2 := model.NewId() - team := setupTeam(t, rctx, ss, userId, userId2) + userID := model.NewId() + userID2 := model.NewId() + team := setupTeam(t, rctx, ss, userID, userID2) // Create the initial categories and find the favorites category opts := &store.SidebarCategorySearchOpts{ TeamID: team.Id, ExcludeTeam: false, } - res, nErr := ss.Channel().CreateInitialSidebarCategories(rctx, userId, opts) + res, nErr := ss.Channel().CreateInitialSidebarCategories(rctx, userID, opts) require.NoError(t, nErr) require.NotEmpty(t, res) - categories, err := ss.Channel().GetSidebarCategoriesForTeamForUser(userId, team.Id) + categories, err := ss.Channel().GetSidebarCategoriesForTeamForUser(userID, team.Id) require.NoError(t, err) favoritesCategory := categories.Categories[0] @@ -1540,11 +1540,11 @@ func testUpdateSidebarCategories(t *testing.T, rctx request.CTX, ss store.Store) require.Equal(t, model.SidebarCategoryChannels, channelsCategory.Type) // Create the other users' categories - res, nErr = ss.Channel().CreateInitialSidebarCategories(rctx, userId2, opts) + res, nErr = ss.Channel().CreateInitialSidebarCategories(rctx, userID2, opts) require.NoError(t, nErr) require.NotEmpty(t, res) - categories2, err := ss.Channel().GetSidebarCategoriesForTeamForUser(userId2, team.Id) + categories2, err := ss.Channel().GetSidebarCategoriesForTeamForUser(userID2, team.Id) require.NoError(t, err) favoritesCategory2 := categories2.Categories[0] @@ -1560,20 +1560,20 @@ func testUpdateSidebarCategories(t *testing.T, rctx request.CTX, ss store.Store) }, 10) require.NoError(t, nErr) _, nErr = ss.Channel().SaveMember(rctx, &model.ChannelMember{ - UserId: userId, + UserId: userID, ChannelId: channel.Id, NotifyProps: model.GetDefaultChannelNotifyProps(), }) require.NoError(t, nErr) _, nErr = ss.Channel().SaveMember(rctx, &model.ChannelMember{ - UserId: userId2, + UserId: userID2, ChannelId: channel.Id, NotifyProps: model.GetDefaultChannelNotifyProps(), }) require.NoError(t, nErr) // Have user1 favorite it - _, _, err = ss.Channel().UpdateSidebarCategories(userId, team.Id, []*model.SidebarCategoryWithChannels{ + _, _, err = ss.Channel().UpdateSidebarCategories(userID, team.Id, []*model.SidebarCategoryWithChannels{ { SidebarCategory: favoritesCategory.SidebarCategory, Channels: []string{channel.Id}, @@ -1585,17 +1585,17 @@ func testUpdateSidebarCategories(t *testing.T, rctx request.CTX, ss store.Store) }) assert.NoError(t, err) - res2, nErr := ss.Preference().Get(userId, model.PreferenceCategoryFavoriteChannel, channel.Id) + res2, nErr := ss.Preference().Get(userID, model.PreferenceCategoryFavoriteChannel, channel.Id) assert.NoError(t, nErr) assert.NotNil(t, res2) assert.Equal(t, "true", res2.Value) - res2, nErr = ss.Preference().Get(userId2, model.PreferenceCategoryFavoriteChannel, channel.Id) + res2, nErr = ss.Preference().Get(userID2, model.PreferenceCategoryFavoriteChannel, channel.Id) assert.True(t, errors.Is(nErr, sql.ErrNoRows)) assert.Nil(t, res2) // And user2 favorite it - _, _, err = ss.Channel().UpdateSidebarCategories(userId2, team.Id, []*model.SidebarCategoryWithChannels{ + _, _, err = ss.Channel().UpdateSidebarCategories(userID2, team.Id, []*model.SidebarCategoryWithChannels{ { SidebarCategory: favoritesCategory2.SidebarCategory, Channels: []string{channel.Id}, @@ -1607,18 +1607,18 @@ func testUpdateSidebarCategories(t *testing.T, rctx request.CTX, ss store.Store) }) assert.NoError(t, err) - res2, nErr = ss.Preference().Get(userId, model.PreferenceCategoryFavoriteChannel, channel.Id) + res2, nErr = ss.Preference().Get(userID, model.PreferenceCategoryFavoriteChannel, channel.Id) assert.NoError(t, nErr) assert.NotNil(t, res2) assert.Equal(t, "true", res2.Value) - res2, nErr = ss.Preference().Get(userId2, model.PreferenceCategoryFavoriteChannel, channel.Id) + res2, nErr = ss.Preference().Get(userID2, model.PreferenceCategoryFavoriteChannel, channel.Id) assert.NoError(t, nErr) assert.NotNil(t, res2) assert.Equal(t, "true", res2.Value) // And then user1 unfavorite it - _, _, err = ss.Channel().UpdateSidebarCategories(userId, team.Id, []*model.SidebarCategoryWithChannels{ + _, _, err = ss.Channel().UpdateSidebarCategories(userID, team.Id, []*model.SidebarCategoryWithChannels{ { SidebarCategory: channelsCategory.SidebarCategory, Channels: []string{channel.Id}, @@ -1630,17 +1630,17 @@ func testUpdateSidebarCategories(t *testing.T, rctx request.CTX, ss store.Store) }) assert.NoError(t, err) - res2, nErr = ss.Preference().Get(userId, model.PreferenceCategoryFavoriteChannel, channel.Id) + res2, nErr = ss.Preference().Get(userID, model.PreferenceCategoryFavoriteChannel, channel.Id) assert.True(t, errors.Is(nErr, sql.ErrNoRows)) assert.Nil(t, res2) - res2, nErr = ss.Preference().Get(userId2, model.PreferenceCategoryFavoriteChannel, channel.Id) + res2, nErr = ss.Preference().Get(userID2, model.PreferenceCategoryFavoriteChannel, channel.Id) assert.NoError(t, nErr) assert.NotNil(t, res2) assert.Equal(t, "true", res2.Value) // And finally user2 favorite it - _, _, err = ss.Channel().UpdateSidebarCategories(userId2, team.Id, []*model.SidebarCategoryWithChannels{ + _, _, err = ss.Channel().UpdateSidebarCategories(userID2, team.Id, []*model.SidebarCategoryWithChannels{ { SidebarCategory: channelsCategory2.SidebarCategory, Channels: []string{channel.Id}, @@ -1652,18 +1652,18 @@ func testUpdateSidebarCategories(t *testing.T, rctx request.CTX, ss store.Store) }) assert.NoError(t, err) - res2, nErr = ss.Preference().Get(userId, model.PreferenceCategoryFavoriteChannel, channel.Id) + res2, nErr = ss.Preference().Get(userID, model.PreferenceCategoryFavoriteChannel, channel.Id) assert.True(t, errors.Is(nErr, sql.ErrNoRows)) assert.Nil(t, res2) - res2, nErr = ss.Preference().Get(userId2, model.PreferenceCategoryFavoriteChannel, channel.Id) + res2, nErr = ss.Preference().Get(userID2, model.PreferenceCategoryFavoriteChannel, channel.Id) assert.True(t, errors.Is(nErr, sql.ErrNoRows)) assert.Nil(t, res2) }) t.Run("channels removed from Channels or DMs categories should be re-added", func(t *testing.T) { - userId := model.NewId() - team := setupTeam(t, rctx, ss, userId) + userID := model.NewId() + team := setupTeam(t, rctx, ss, userID) // Create some channels channel, nErr := ss.Channel().Save(rctx, &model.Channel{ @@ -1673,25 +1673,25 @@ func testUpdateSidebarCategories(t *testing.T, rctx request.CTX, ss store.Store) }, 10) require.NoError(t, nErr) _, err := ss.Channel().SaveMember(rctx, &model.ChannelMember{ - UserId: userId, + UserId: userID, ChannelId: channel.Id, NotifyProps: model.GetDefaultChannelNotifyProps(), }) require.NoError(t, err) - otherUserId := model.NewId() + otherUserID := model.NewId() dmChannel, nErr := ss.Channel().SaveDirectChannel( rctx, &model.Channel{ - Name: model.GetDMNameFromIds(userId, otherUserId), + Name: model.GetDMNameFromIds(userID, otherUserID), Type: model.ChannelTypeDirect, }, &model.ChannelMember{ - UserId: userId, + UserId: userID, NotifyProps: model.GetDefaultChannelNotifyProps(), }, &model.ChannelMember{ - UserId: otherUserId, + UserId: otherUserID, NotifyProps: model.GetDefaultChannelNotifyProps(), }, ) @@ -1701,12 +1701,12 @@ func testUpdateSidebarCategories(t *testing.T, rctx request.CTX, ss store.Store) TeamID: team.Id, ExcludeTeam: false, } - res, nErr := ss.Channel().CreateInitialSidebarCategories(rctx, userId, opts) + res, nErr := ss.Channel().CreateInitialSidebarCategories(rctx, userID, opts) require.NoError(t, nErr) require.NotEmpty(t, res) // And some categories - initialCategories, nErr := ss.Channel().GetSidebarCategoriesForTeamForUser(userId, team.Id) + initialCategories, nErr := ss.Channel().GetSidebarCategoriesForTeamForUser(userID, team.Id) require.NoError(t, nErr) channelsCategory := initialCategories.Categories[1] @@ -1727,7 +1727,7 @@ func testUpdateSidebarCategories(t *testing.T, rctx request.CTX, ss store.Store) }, } - updatedCategories, _, nErr := ss.Channel().UpdateSidebarCategories(userId, team.Id, categoriesToUpdate) + updatedCategories, _, nErr := ss.Channel().UpdateSidebarCategories(userID, team.Id, categoriesToUpdate) assert.NoError(t, nErr) // The channels should still exist in the category because they would otherwise be orphaned @@ -1736,21 +1736,21 @@ func testUpdateSidebarCategories(t *testing.T, rctx request.CTX, ss store.Store) }) t.Run("should be able to move DMs into and out of custom categories", func(t *testing.T) { - userId := model.NewId() - team := setupTeam(t, rctx, ss, userId) + userID := model.NewId() + team := setupTeam(t, rctx, ss, userID) - otherUserId := model.NewId() + otherUserID := model.NewId() dmChannel, nErr := ss.Channel().SaveDirectChannel(rctx, &model.Channel{ - Name: model.GetDMNameFromIds(userId, otherUserId), + Name: model.GetDMNameFromIds(userID, otherUserID), Type: model.ChannelTypeDirect, }, &model.ChannelMember{ - UserId: userId, + UserId: userID, NotifyProps: model.GetDefaultChannelNotifyProps(), }, &model.ChannelMember{ - UserId: otherUserId, + UserId: otherUserID, NotifyProps: model.GetDefaultChannelNotifyProps(), }, ) @@ -1760,19 +1760,19 @@ func testUpdateSidebarCategories(t *testing.T, rctx request.CTX, ss store.Store) TeamID: team.Id, ExcludeTeam: false, } - res, nErr := ss.Channel().CreateInitialSidebarCategories(rctx, userId, opts) + res, nErr := ss.Channel().CreateInitialSidebarCategories(rctx, userID, opts) require.NoError(t, nErr) require.NotEmpty(t, res) // The DM should start in the DMs category - initialCategories, err := ss.Channel().GetSidebarCategoriesForTeamForUser(userId, team.Id) + initialCategories, err := ss.Channel().GetSidebarCategoriesForTeamForUser(userID, team.Id) require.NoError(t, err) dmsCategory := initialCategories.Categories[2] require.Equal(t, []string{dmChannel.Id}, dmsCategory.Channels) // Now move the DM into a custom category - customCategory, err := ss.Channel().CreateSidebarCategory(userId, team.Id, &model.SidebarCategoryWithChannels{}) + customCategory, err := ss.Channel().CreateSidebarCategory(userID, team.Id, &model.SidebarCategoryWithChannels{}) require.NoError(t, err) categoriesToUpdate := []*model.SidebarCategoryWithChannels{ @@ -1786,7 +1786,7 @@ func testUpdateSidebarCategories(t *testing.T, rctx request.CTX, ss store.Store) }, } - updatedCategories, _, err := ss.Channel().UpdateSidebarCategories(userId, team.Id, categoriesToUpdate) + updatedCategories, _, err := ss.Channel().UpdateSidebarCategories(userID, team.Id, categoriesToUpdate) assert.NoError(t, err) assert.Equal(t, dmsCategory.Id, updatedCategories[0].Id) assert.Equal(t, []string{}, updatedCategories[0].Channels) @@ -1813,7 +1813,7 @@ func testUpdateSidebarCategories(t *testing.T, rctx request.CTX, ss store.Store) }, } - updatedCategories, _, err = ss.Channel().UpdateSidebarCategories(userId, team.Id, categoriesToUpdate) + updatedCategories, _, err = ss.Channel().UpdateSidebarCategories(userID, team.Id, categoriesToUpdate) assert.NoError(t, err) assert.Equal(t, dmsCategory.Id, updatedCategories[0].Id) assert.Equal(t, []string{dmChannel.Id}, updatedCategories[0].Channels) @@ -1830,8 +1830,8 @@ func testUpdateSidebarCategories(t *testing.T, rctx request.CTX, ss store.Store) }) t.Run("should successfully move channels between categories", func(t *testing.T) { - userId := model.NewId() - team := setupTeam(t, rctx, ss, userId) + userID := model.NewId() + team := setupTeam(t, rctx, ss, userID) // Join a channel channel, nErr := ss.Channel().Save(rctx, &model.Channel{ @@ -1841,7 +1841,7 @@ func testUpdateSidebarCategories(t *testing.T, rctx request.CTX, ss store.Store) }, 10) require.NoError(t, nErr) _, err := ss.Channel().SaveMember(rctx, &model.ChannelMember{ - UserId: userId, + UserId: userID, ChannelId: channel.Id, NotifyProps: model.GetDefaultChannelNotifyProps(), }) @@ -1852,21 +1852,21 @@ func testUpdateSidebarCategories(t *testing.T, rctx request.CTX, ss store.Store) TeamID: team.Id, ExcludeTeam: false, } - res, nErr := ss.Channel().CreateInitialSidebarCategories(rctx, userId, opts) + res, nErr := ss.Channel().CreateInitialSidebarCategories(rctx, userID, opts) require.NoError(t, nErr) require.NotEmpty(t, res) - initialCategories, nErr := ss.Channel().GetSidebarCategoriesForTeamForUser(userId, team.Id) + initialCategories, nErr := ss.Channel().GetSidebarCategoriesForTeamForUser(userID, team.Id) require.NoError(t, nErr) channelsCategory := initialCategories.Categories[1] require.Equal(t, []string{channel.Id}, channelsCategory.Channels) - customCategory, nErr := ss.Channel().CreateSidebarCategory(userId, team.Id, &model.SidebarCategoryWithChannels{}) + customCategory, nErr := ss.Channel().CreateSidebarCategory(userID, team.Id, &model.SidebarCategoryWithChannels{}) require.NoError(t, nErr) // Move the channel one way - updatedCategories, _, nErr := ss.Channel().UpdateSidebarCategories(userId, team.Id, []*model.SidebarCategoryWithChannels{ + updatedCategories, _, nErr := ss.Channel().UpdateSidebarCategories(userID, team.Id, []*model.SidebarCategoryWithChannels{ { SidebarCategory: channelsCategory.SidebarCategory, Channels: []string{}, @@ -1882,7 +1882,7 @@ func testUpdateSidebarCategories(t *testing.T, rctx request.CTX, ss store.Store) assert.Equal(t, []string{channel.Id}, updatedCategories[1].Channels) // And then the other - updatedCategories, _, nErr = ss.Channel().UpdateSidebarCategories(userId, team.Id, []*model.SidebarCategoryWithChannels{ + updatedCategories, _, nErr = ss.Channel().UpdateSidebarCategories(userID, team.Id, []*model.SidebarCategoryWithChannels{ { SidebarCategory: channelsCategory.SidebarCategory, Channels: []string{channel.Id}, @@ -1898,8 +1898,8 @@ func testUpdateSidebarCategories(t *testing.T, rctx request.CTX, ss store.Store) }) t.Run("should correctly return the original categories that were modified", func(t *testing.T) { - userId := model.NewId() - team := setupTeam(t, rctx, ss, userId) + userID := model.NewId() + team := setupTeam(t, rctx, ss, userID) // Join a channel channel, nErr := ss.Channel().Save(rctx, &model.Channel{ @@ -1909,7 +1909,7 @@ func testUpdateSidebarCategories(t *testing.T, rctx request.CTX, ss store.Store) }, 10) require.NoError(t, nErr) _, err := ss.Channel().SaveMember(rctx, &model.ChannelMember{ - UserId: userId, + UserId: userID, ChannelId: channel.Id, NotifyProps: model.GetDefaultChannelNotifyProps(), }) @@ -1920,17 +1920,17 @@ func testUpdateSidebarCategories(t *testing.T, rctx request.CTX, ss store.Store) TeamID: team.Id, ExcludeTeam: false, } - res, nErr := ss.Channel().CreateInitialSidebarCategories(rctx, userId, opts) + res, nErr := ss.Channel().CreateInitialSidebarCategories(rctx, userID, opts) require.NoError(t, nErr) require.NotEmpty(t, res) - initialCategories, nErr := ss.Channel().GetSidebarCategoriesForTeamForUser(userId, team.Id) + initialCategories, nErr := ss.Channel().GetSidebarCategoriesForTeamForUser(userID, team.Id) require.NoError(t, nErr) channelsCategory := initialCategories.Categories[1] require.Equal(t, []string{channel.Id}, channelsCategory.Channels) - customCategory, nErr := ss.Channel().CreateSidebarCategory(userId, team.Id, &model.SidebarCategoryWithChannels{ + customCategory, nErr := ss.Channel().CreateSidebarCategory(userID, team.Id, &model.SidebarCategoryWithChannels{ SidebarCategory: model.SidebarCategory{ DisplayName: "originalName", }, @@ -1938,7 +1938,7 @@ func testUpdateSidebarCategories(t *testing.T, rctx request.CTX, ss store.Store) require.NoError(t, nErr) // Rename the custom category - updatedCategories, originalCategories, nErr := ss.Channel().UpdateSidebarCategories(userId, team.Id, []*model.SidebarCategoryWithChannels{ + updatedCategories, originalCategories, nErr := ss.Channel().UpdateSidebarCategories(userID, team.Id, []*model.SidebarCategoryWithChannels{ { SidebarCategory: model.SidebarCategory{ Id: customCategory.Id, @@ -1952,7 +1952,7 @@ func testUpdateSidebarCategories(t *testing.T, rctx request.CTX, ss store.Store) assert.Equal(t, "updatedName", updatedCategories[0].DisplayName) // Move a channel - updatedCategories, originalCategories, nErr = ss.Channel().UpdateSidebarCategories(userId, team.Id, []*model.SidebarCategoryWithChannels{ + updatedCategories, originalCategories, nErr = ss.Channel().UpdateSidebarCategories(userID, team.Id, []*model.SidebarCategoryWithChannels{ { SidebarCategory: channelsCategory.SidebarCategory, Channels: []string{}, @@ -1975,36 +1975,36 @@ func testUpdateSidebarCategories(t *testing.T, rctx request.CTX, ss store.Store) } func setupInitialSidebarCategories(t *testing.T, rctx request.CTX, ss store.Store) (string, string) { - userId := model.NewId() - team := setupTeam(t, rctx, ss, userId) + userID := model.NewId() + team := setupTeam(t, rctx, ss, userID) opts := &store.SidebarCategorySearchOpts{ TeamID: team.Id, ExcludeTeam: false, } - res, nErr := ss.Channel().CreateInitialSidebarCategories(rctx, userId, opts) + res, nErr := ss.Channel().CreateInitialSidebarCategories(rctx, userID, opts) require.NoError(t, nErr) require.NotEmpty(t, res) - res, err := ss.Channel().GetSidebarCategoriesForTeamForUser(userId, team.Id) + res, err := ss.Channel().GetSidebarCategoriesForTeamForUser(userID, team.Id) require.NoError(t, err) require.Len(t, res.Categories, 3) - return userId, team.Id + return userID, team.Id } func testClearSidebarOnTeamLeave(t *testing.T, rctx request.CTX, ss store.Store, s SqlStore) { t.Run("should delete all sidebar categories and channels on the team", func(t *testing.T) { - userId, teamId := setupInitialSidebarCategories(t, rctx, ss) + userID, teamID := setupInitialSidebarCategories(t, rctx, ss) user := &model.User{ - Id: userId, + Id: userID, } // Create some channels and assign them to a custom category channel1, nErr := ss.Channel().Save(rctx, &model.Channel{ Name: model.NewId(), - TeamId: teamId, + TeamId: teamID, Type: model.ChannelTypeOpen, }, 1000) require.NoError(t, nErr) @@ -2014,46 +2014,46 @@ func testClearSidebarOnTeamLeave(t *testing.T, rctx request.CTX, ss store.Store, }) require.NoError(t, nErr) - _, err := ss.Channel().CreateSidebarCategory(userId, teamId, &model.SidebarCategoryWithChannels{ + _, err := ss.Channel().CreateSidebarCategory(userID, teamID, &model.SidebarCategoryWithChannels{ Channels: []string{channel1.Id, dmChannel1.Id}, }) require.NoError(t, err) // Confirm that we start with the right number of categories and SidebarChannels entries var count int64 - err = s.GetMasterX().Get(&count, "SELECT COUNT(*) FROM SidebarCategories WHERE UserId = ?", userId) + err = s.GetMasterX().Get(&count, "SELECT COUNT(*) FROM SidebarCategories WHERE UserId = ?", userID) require.NoError(t, err) require.Equal(t, int64(4), count) - err = s.GetMasterX().Get(&count, "SELECT COUNT(*) FROM SidebarChannels WHERE UserId = ?", userId) + err = s.GetMasterX().Get(&count, "SELECT COUNT(*) FROM SidebarChannels WHERE UserId = ?", userID) require.NoError(t, err) require.Equal(t, int64(2), count) // Leave the team - err = ss.Channel().ClearSidebarOnTeamLeave(userId, teamId) + err = ss.Channel().ClearSidebarOnTeamLeave(userID, teamID) assert.NoError(t, err) // Confirm that all the categories and SidebarChannel entries have been deleted - err = s.GetMasterX().Get(&count, "SELECT COUNT(*) FROM SidebarCategories WHERE UserId = ?", userId) + err = s.GetMasterX().Get(&count, "SELECT COUNT(*) FROM SidebarCategories WHERE UserId = ?", userID) require.NoError(t, err) assert.Equal(t, int64(0), count) - err = s.GetMasterX().Get(&count, "SELECT COUNT(*) FROM SidebarChannels WHERE UserId = ?", userId) + err = s.GetMasterX().Get(&count, "SELECT COUNT(*) FROM SidebarChannels WHERE UserId = ?", userID) require.NoError(t, err) assert.Equal(t, int64(0), count) }) t.Run("should not delete sidebar categories and channels on another the team", func(t *testing.T) { - userId, teamId := setupInitialSidebarCategories(t, rctx, ss) + userID, teamID := setupInitialSidebarCategories(t, rctx, ss) user := &model.User{ - Id: userId, + Id: userID, } // Create some channels and assign them to a custom category channel1, nErr := ss.Channel().Save(rctx, &model.Channel{ Name: model.NewId(), - TeamId: teamId, + TeamId: teamID, Type: model.ChannelTypeOpen, }, 1000) require.NoError(t, nErr) @@ -2063,64 +2063,64 @@ func testClearSidebarOnTeamLeave(t *testing.T, rctx request.CTX, ss store.Store, }) require.NoError(t, nErr) - _, err := ss.Channel().CreateSidebarCategory(userId, teamId, &model.SidebarCategoryWithChannels{ + _, err := ss.Channel().CreateSidebarCategory(userID, teamID, &model.SidebarCategoryWithChannels{ Channels: []string{channel1.Id, dmChannel1.Id}, }) require.NoError(t, err) // Confirm that we start with the right number of categories and SidebarChannels entries var count int64 - err = s.GetMasterX().Get(&count, "SELECT COUNT(*) FROM SidebarCategories WHERE UserId = ?", userId) + err = s.GetMasterX().Get(&count, "SELECT COUNT(*) FROM SidebarCategories WHERE UserId = ?", userID) require.NoError(t, err) require.Equal(t, int64(4), count) - err = s.GetMasterX().Get(&count, "SELECT COUNT(*) FROM SidebarChannels WHERE UserId = ?", userId) + err = s.GetMasterX().Get(&count, "SELECT COUNT(*) FROM SidebarChannels WHERE UserId = ?", userID) require.NoError(t, err) require.Equal(t, int64(2), count) // Leave another team - err = ss.Channel().ClearSidebarOnTeamLeave(userId, model.NewId()) + err = ss.Channel().ClearSidebarOnTeamLeave(userID, model.NewId()) assert.NoError(t, err) // Confirm that nothing has been deleted - err = s.GetMasterX().Get(&count, "SELECT COUNT(*) FROM SidebarCategories WHERE UserId = ?", userId) + err = s.GetMasterX().Get(&count, "SELECT COUNT(*) FROM SidebarCategories WHERE UserId = ?", userID) require.NoError(t, err) assert.Equal(t, int64(4), count) - err = s.GetMasterX().Get(&count, "SELECT COUNT(*) FROM SidebarChannels WHERE UserId = ?", userId) + err = s.GetMasterX().Get(&count, "SELECT COUNT(*) FROM SidebarChannels WHERE UserId = ?", userID) require.NoError(t, err) assert.Equal(t, int64(2), count) }) t.Run("MM-30314 should not delete channels on another team under specific circumstances", func(t *testing.T) { - userId, teamId := setupInitialSidebarCategories(t, rctx, ss) + userID, teamID := setupInitialSidebarCategories(t, rctx, ss) user := &model.User{ - Id: userId, + Id: userID, } user2 := &model.User{ Id: model.NewId(), } // Create a second team and set up the sidebar categories for it - team2 := setupTeam(t, rctx, ss, userId) + team2 := setupTeam(t, rctx, ss, userID) opts := &store.SidebarCategorySearchOpts{ TeamID: team2.Id, ExcludeTeam: false, } - res, err := ss.Channel().CreateInitialSidebarCategories(rctx, userId, opts) + res, err := ss.Channel().CreateInitialSidebarCategories(rctx, userID, opts) require.NoError(t, err) require.NotEmpty(t, res) - res, err = ss.Channel().GetSidebarCategoriesForTeamForUser(userId, team2.Id) + res, err = ss.Channel().GetSidebarCategoriesForTeamForUser(userID, team2.Id) require.NoError(t, err) require.Len(t, res.Categories, 3) // On the first team, create some channels and assign them to a custom category channel1, nErr := ss.Channel().Save(rctx, &model.Channel{ Name: model.NewId(), - TeamId: teamId, + TeamId: teamID, Type: model.ChannelTypeOpen, }, 1000) require.NoError(t, nErr) @@ -2128,7 +2128,7 @@ func testClearSidebarOnTeamLeave(t *testing.T, rctx request.CTX, ss store.Store, dmChannel1, nErr := ss.Channel().CreateDirectChannel(rctx, user, user2) require.NoError(t, nErr) - _, err = ss.Channel().CreateSidebarCategory(userId, teamId, &model.SidebarCategoryWithChannels{ + _, err = ss.Channel().CreateSidebarCategory(userID, teamID, &model.SidebarCategoryWithChannels{ Channels: []string{channel1.Id, dmChannel1.Id}, }) require.NoError(t, err) @@ -2141,36 +2141,36 @@ func testClearSidebarOnTeamLeave(t *testing.T, rctx request.CTX, ss store.Store, }, 1000) require.NoError(t, nErr) - _, err = ss.Channel().CreateSidebarCategory(userId, team2.Id, &model.SidebarCategoryWithChannels{ + _, err = ss.Channel().CreateSidebarCategory(userID, team2.Id, &model.SidebarCategoryWithChannels{ Channels: []string{channel2.Id, dmChannel1.Id}, }) require.NoError(t, err) // Confirm that we start with the right number of categories and SidebarChannels entries var count int64 - err = s.GetMasterX().Get(&count, "SELECT COUNT(*) FROM SidebarCategories WHERE UserId = ?", userId) + err = s.GetMasterX().Get(&count, "SELECT COUNT(*) FROM SidebarCategories WHERE UserId = ?", userID) require.NoError(t, err) require.Equal(t, int64(8), count) - err = s.GetMasterX().Get(&count, "SELECT COUNT(*) FROM SidebarChannels WHERE UserId = ?", userId) + err = s.GetMasterX().Get(&count, "SELECT COUNT(*) FROM SidebarChannels WHERE UserId = ?", userID) require.NoError(t, err) require.Equal(t, int64(4), count) // Leave the first team - err = ss.Channel().ClearSidebarOnTeamLeave(userId, teamId) + err = ss.Channel().ClearSidebarOnTeamLeave(userID, teamID) assert.NoError(t, err) // Confirm that we have the correct number of categories and SidebarChannels entries left over - err = s.GetMasterX().Get(&count, "SELECT COUNT(*) FROM SidebarCategories WHERE UserId = ?", userId) + err = s.GetMasterX().Get(&count, "SELECT COUNT(*) FROM SidebarCategories WHERE UserId = ?", userID) require.NoError(t, err) assert.Equal(t, int64(4), count) - err = s.GetMasterX().Get(&count, "SELECT COUNT(*) FROM SidebarChannels WHERE UserId = ?", userId) + err = s.GetMasterX().Get(&count, "SELECT COUNT(*) FROM SidebarChannels WHERE UserId = ?", userID) require.NoError(t, err) assert.Equal(t, int64(2), count) // Confirm that the categories on the second team are unchanged - res, err = ss.Channel().GetSidebarCategoriesForTeamForUser(userId, team2.Id) + res, err = ss.Channel().GetSidebarCategoriesForTeamForUser(userID, team2.Id) require.NoError(t, err) assert.Len(t, res.Categories, 4) @@ -2181,15 +2181,15 @@ func testClearSidebarOnTeamLeave(t *testing.T, rctx request.CTX, ss store.Store, func testDeleteSidebarCategory(t *testing.T, rctx request.CTX, ss store.Store, s SqlStore) { t.Run("should correctly remove an empty category", func(t *testing.T) { - userId, teamId := setupInitialSidebarCategories(t, rctx, ss) - defer ss.User().PermanentDelete(rctx, userId) + userID, teamID := setupInitialSidebarCategories(t, rctx, ss) + defer ss.User().PermanentDelete(rctx, userID) - newCategory, err := ss.Channel().CreateSidebarCategory(userId, teamId, &model.SidebarCategoryWithChannels{}) + newCategory, err := ss.Channel().CreateSidebarCategory(userID, teamID, &model.SidebarCategoryWithChannels{}) require.NoError(t, err) require.NotNil(t, newCategory) // Ensure that the category was created properly - res, err := ss.Channel().GetSidebarCategoriesForTeamForUser(userId, teamId) + res, err := ss.Channel().GetSidebarCategoriesForTeamForUser(userID, teamID) require.NoError(t, err) require.Len(t, res.Categories, 4) @@ -2197,23 +2197,23 @@ func testDeleteSidebarCategory(t *testing.T, rctx request.CTX, ss store.Store, s err = ss.Channel().DeleteSidebarCategory(newCategory.Id) assert.NoError(t, err) - res, err = ss.Channel().GetSidebarCategoriesForTeamForUser(userId, teamId) + res, err = ss.Channel().GetSidebarCategoriesForTeamForUser(userID, teamID) require.NoError(t, err) require.Len(t, res.Categories, 3) }) t.Run("should correctly remove a category and its channels", func(t *testing.T) { - userId, teamId := setupInitialSidebarCategories(t, rctx, ss) - defer ss.User().PermanentDelete(rctx, userId) + userID, teamID := setupInitialSidebarCategories(t, rctx, ss) + defer ss.User().PermanentDelete(rctx, userID) user := &model.User{ - Id: userId, + Id: userID, } // Create some channels channel1, nErr := ss.Channel().Save(rctx, &model.Channel{ Name: model.NewId(), - TeamId: teamId, + TeamId: teamID, Type: model.ChannelTypeOpen, }, 1000) require.NoError(t, nErr) @@ -2221,7 +2221,7 @@ func testDeleteSidebarCategory(t *testing.T, rctx request.CTX, ss store.Store, s channel2, nErr := ss.Channel().Save(rctx, &model.Channel{ Name: model.NewId(), - TeamId: teamId, + TeamId: teamID, Type: model.ChannelTypePrivate, }, 1000) require.NoError(t, nErr) @@ -2234,14 +2234,14 @@ func testDeleteSidebarCategory(t *testing.T, rctx request.CTX, ss store.Store, s defer ss.Channel().PermanentDelete(rctx, dmChannel1.Id) // Assign some of those channels to a custom category - newCategory, err := ss.Channel().CreateSidebarCategory(userId, teamId, &model.SidebarCategoryWithChannels{ + newCategory, err := ss.Channel().CreateSidebarCategory(userID, teamID, &model.SidebarCategoryWithChannels{ Channels: []string{channel1.Id, channel2.Id, dmChannel1.Id}, }) require.NoError(t, err) require.NotNil(t, newCategory) // Ensure that the categories are set up correctly - res, err := ss.Channel().GetSidebarCategoriesForTeamForUser(userId, teamId) + res, err := ss.Channel().GetSidebarCategoriesForTeamForUser(userID, teamID) require.NoError(t, err) require.Len(t, res.Categories, 4) @@ -2253,7 +2253,7 @@ func testDeleteSidebarCategory(t *testing.T, rctx request.CTX, ss store.Store, s assert.NoError(t, err) // Confirm that the category was deleted... - res, err = ss.Channel().GetSidebarCategoriesForTeamForUser(userId, teamId) + res, err = ss.Channel().GetSidebarCategoriesForTeamForUser(userID, teamID) assert.NoError(t, err) assert.Len(t, res.Categories, 3) @@ -2271,9 +2271,9 @@ func testDeleteSidebarCategory(t *testing.T, rctx request.CTX, ss store.Store, s }) t.Run("should not allow you to remove non-custom categories", func(t *testing.T) { - userId, teamId := setupInitialSidebarCategories(t, rctx, ss) - defer ss.User().PermanentDelete(rctx, userId) - res, err := ss.Channel().GetSidebarCategoriesForTeamForUser(userId, teamId) + userID, teamID := setupInitialSidebarCategories(t, rctx, ss) + defer ss.User().PermanentDelete(rctx, userID) + res, err := ss.Channel().GetSidebarCategoriesForTeamForUser(userID, teamID) require.NoError(t, err) require.Len(t, res.Categories, 3) require.Equal(t, model.SidebarCategoryFavorites, res.Categories[0].Type) @@ -2293,21 +2293,21 @@ func testDeleteSidebarCategory(t *testing.T, rctx request.CTX, ss store.Store, s func testUpdateSidebarChannelsByPreferences(t *testing.T, rctx request.CTX, ss store.Store) { t.Run("Should be able to update sidebar channels", func(t *testing.T) { - userId := model.NewId() - teamId := model.NewId() + userID := model.NewId() + teamID := model.NewId() opts := &store.SidebarCategorySearchOpts{ - TeamID: teamId, + TeamID: teamID, ExcludeTeam: false, } - res, nErr := ss.Channel().CreateInitialSidebarCategories(rctx, userId, opts) + res, nErr := ss.Channel().CreateInitialSidebarCategories(rctx, userID, opts) require.NoError(t, nErr) require.NotEmpty(t, res) channel, nErr := ss.Channel().Save(rctx, &model.Channel{ Name: "channel", Type: model.ChannelTypeOpen, - TeamId: teamId, + TeamId: teamID, }, 10) require.NoError(t, nErr) @@ -2322,14 +2322,14 @@ func testUpdateSidebarChannelsByPreferences(t *testing.T, rctx request.CTX, ss s }) t.Run("Should not panic if channel is not found", func(t *testing.T) { - userId := model.NewId() - teamId := model.NewId() + userID := model.NewId() + teamID := model.NewId() opts := &store.SidebarCategorySearchOpts{ - TeamID: teamId, + TeamID: teamID, ExcludeTeam: false, } - res, nErr := ss.Channel().CreateInitialSidebarCategories(rctx, userId, opts) + res, nErr := ss.Channel().CreateInitialSidebarCategories(rctx, userID, opts) assert.NoError(t, nErr) require.NotEmpty(t, res) diff --git a/server/channels/store/storetest/compliance_store.go b/server/channels/store/storetest/compliance_store.go index 93651baefebe0..7789d02828d6e 100644 --- a/server/channels/store/storetest/compliance_store.go +++ b/server/channels/store/storetest/compliance_store.go @@ -105,7 +105,7 @@ func testComplianceExport(t *testing.T, rctx request.CTX, ss store.Store) { t1 := &model.Team{} t1.DisplayName = "DisplayName" - t1.Name = NewTestId() + t1.Name = NewTestID() t1.Email = MakeEmail() t1.Type = model.TeamOpen t1, err := ss.Team().Save(t1) @@ -130,7 +130,7 @@ func testComplianceExport(t *testing.T, rctx request.CTX, ss store.Store) { c1 := &model.Channel{} c1.TeamId = t1.Id c1.DisplayName = "Channel2" - c1.Name = NewTestId() + c1.Name = NewTestID() c1.Type = model.ChannelTypeOpen c1, nErr = ss.Channel().Save(rctx, c1, -1) require.NoError(t, nErr) @@ -139,7 +139,7 @@ func testComplianceExport(t *testing.T, rctx request.CTX, ss store.Store) { o1.ChannelId = c1.Id o1.UserId = u1.Id o1.CreateAt = model.GetMillis() - o1.Message = NewTestId() + o1.Message = NewTestID() o1, nErr = ss.Post().Save(rctx, o1) require.NoError(t, nErr) @@ -147,7 +147,7 @@ func testComplianceExport(t *testing.T, rctx request.CTX, ss store.Store) { o1a.ChannelId = c1.Id o1a.UserId = u1.Id o1a.CreateAt = o1.CreateAt + 10 - o1a.Message = NewTestId() + o1a.Message = NewTestID() _, nErr = ss.Post().Save(rctx, o1a) require.NoError(t, nErr) @@ -155,7 +155,7 @@ func testComplianceExport(t *testing.T, rctx request.CTX, ss store.Store) { o2.ChannelId = c1.Id o2.UserId = u1.Id o2.CreateAt = o1.CreateAt + 20 - o2.Message = NewTestId() + o2.Message = NewTestID() _, nErr = ss.Post().Save(rctx, o2) require.NoError(t, nErr) @@ -163,7 +163,7 @@ func testComplianceExport(t *testing.T, rctx request.CTX, ss store.Store) { o2a.ChannelId = c1.Id o2a.UserId = u2.Id o2a.CreateAt = o1.CreateAt + 30 - o2a.Message = NewTestId() + o2a.Message = NewTestID() o2a, nErr = ss.Post().Save(rctx, o2a) require.NoError(t, nErr) @@ -239,7 +239,7 @@ func testComplianceExportDirectMessages(t *testing.T, rctx request.CTX, ss store t1 := &model.Team{} t1.DisplayName = "DisplayName" - t1.Name = NewTestId() + t1.Name = NewTestID() t1.Email = MakeEmail() t1.Type = model.TeamOpen t1, err := ss.Team().Save(t1) @@ -264,7 +264,7 @@ func testComplianceExportDirectMessages(t *testing.T, rctx request.CTX, ss store c1 := &model.Channel{} c1.TeamId = t1.Id c1.DisplayName = "Channel2" - c1.Name = NewTestId() + c1.Name = NewTestID() c1.Type = model.ChannelTypeOpen c1, nErr = ss.Channel().Save(rctx, c1, -1) require.NoError(t, nErr) @@ -275,7 +275,7 @@ func testComplianceExportDirectMessages(t *testing.T, rctx request.CTX, ss store o1.ChannelId = c1.Id o1.UserId = u1.Id o1.CreateAt = model.GetMillis() - o1.Message = NewTestId() + o1.Message = NewTestID() o1, nErr = ss.Post().Save(rctx, o1) require.NoError(t, nErr) @@ -283,7 +283,7 @@ func testComplianceExportDirectMessages(t *testing.T, rctx request.CTX, ss store o1a.ChannelId = c1.Id o1a.UserId = u1.Id o1a.CreateAt = o1.CreateAt + 10 - o1a.Message = NewTestId() + o1a.Message = NewTestID() _, nErr = ss.Post().Save(rctx, o1a) require.NoError(t, nErr) @@ -291,7 +291,7 @@ func testComplianceExportDirectMessages(t *testing.T, rctx request.CTX, ss store o2.ChannelId = c1.Id o2.UserId = u1.Id o2.CreateAt = o1.CreateAt + 20 - o2.Message = NewTestId() + o2.Message = NewTestID() _, nErr = ss.Post().Save(rctx, o2) require.NoError(t, nErr) @@ -299,7 +299,7 @@ func testComplianceExportDirectMessages(t *testing.T, rctx request.CTX, ss store o2a.ChannelId = c1.Id o2a.UserId = u2.Id o2a.CreateAt = o1.CreateAt + 30 - o2a.Message = NewTestId() + o2a.Message = NewTestID() _, nErr = ss.Post().Save(rctx, o2a) require.NoError(t, nErr) @@ -307,7 +307,7 @@ func testComplianceExportDirectMessages(t *testing.T, rctx request.CTX, ss store o3.ChannelId = cDM.Id o3.UserId = u1.Id o3.CreateAt = o1.CreateAt + 40 - o3.Message = NewTestId() + o3.Message = NewTestID() o3, nErr = ss.Post().Save(rctx, o3) require.NoError(t, nErr) @@ -362,7 +362,7 @@ func testComplianceExportDirectMessages(t *testing.T, rctx request.CTX, ss store post.ChannelId = c1.Id post.UserId = u1.Id post.CreateAt = createAt - post.Message = NewTestId() + post.Message = NewTestID() _, nErr = ss.Post().Save(rctx, post) require.NoError(t, nErr) } @@ -407,7 +407,7 @@ func testMessageExportPublicChannel(t *testing.T, rctx request.CTX, ss store.Sto // need a team team := &model.Team{ DisplayName: "DisplayName", - Name: NewTestId(), + Name: NewTestID(), Email: MakeEmail(), Type: model.TeamOpen, } @@ -454,7 +454,7 @@ func testMessageExportPublicChannel(t *testing.T, rctx request.CTX, ss store.Sto ChannelId: channel.Id, UserId: user1.Id, CreateAt: startTime, - Message: NewTestId(), + Message: NewTestID(), } post1, err = ss.Post().Save(rctx, post1) require.NoError(t, err) @@ -463,7 +463,7 @@ func testMessageExportPublicChannel(t *testing.T, rctx request.CTX, ss store.Sto ChannelId: channel.Id, UserId: user1.Id, CreateAt: startTime + 10, - Message: NewTestId(), + Message: NewTestID(), } post2, err = ss.Post().Save(rctx, post2) require.NoError(t, err) @@ -511,7 +511,7 @@ func testMessageExportPrivateChannel(t *testing.T, rctx request.CTX, ss store.St // need a team team := &model.Team{ DisplayName: "DisplayName", - Name: NewTestId(), + Name: NewTestID(), Email: MakeEmail(), Type: model.TeamOpen, } @@ -558,7 +558,7 @@ func testMessageExportPrivateChannel(t *testing.T, rctx request.CTX, ss store.St ChannelId: channel.Id, UserId: user1.Id, CreateAt: startTime, - Message: NewTestId(), + Message: NewTestID(), } post1, err = ss.Post().Save(rctx, post1) require.NoError(t, err) @@ -567,7 +567,7 @@ func testMessageExportPrivateChannel(t *testing.T, rctx request.CTX, ss store.St ChannelId: channel.Id, UserId: user1.Id, CreateAt: startTime + 10, - Message: NewTestId(), + Message: NewTestID(), } post2, err = ss.Post().Save(rctx, post2) require.NoError(t, err) @@ -617,7 +617,7 @@ func testMessageExportDirectMessageChannel(t *testing.T, rctx request.CTX, ss st // need a team team := &model.Team{ DisplayName: "DisplayName", - Name: NewTestId(), + Name: NewTestID(), Email: MakeEmail(), Type: model.TeamOpen, } @@ -658,7 +658,7 @@ func testMessageExportDirectMessageChannel(t *testing.T, rctx request.CTX, ss st ChannelId: directMessageChannel.Id, UserId: user1.Id, CreateAt: startTime + 20, - Message: NewTestId(), + Message: NewTestID(), } post, err = ss.Post().Save(rctx, post) require.NoError(t, err) @@ -698,7 +698,7 @@ func testMessageExportGroupMessageChannel(t *testing.T, rctx request.CTX, ss sto // need a team team := &model.Team{ DisplayName: "DisplayName", - Name: NewTestId(), + Name: NewTestID(), Email: MakeEmail(), Type: model.TeamOpen, } @@ -756,7 +756,7 @@ func testMessageExportGroupMessageChannel(t *testing.T, rctx request.CTX, ss sto ChannelId: groupMessageChannel.Id, UserId: user1.Id, CreateAt: startTime + 20, - Message: NewTestId(), + Message: NewTestID(), } post, err = ss.Post().Save(rctx, post) require.NoError(t, err) @@ -796,7 +796,7 @@ func testEditExportMessage(t *testing.T, rctx request.CTX, ss store.Store) { // need a team team := &model.Team{ DisplayName: "DisplayName", - Name: NewTestId(), + Name: NewTestID(), Email: MakeEmail(), Type: model.TeamOpen, } @@ -831,7 +831,7 @@ func testEditExportMessage(t *testing.T, rctx request.CTX, ss store.Store) { ChannelId: channel.Id, UserId: user1.Id, CreateAt: startTime, - Message: NewTestId(), + Message: NewTestID(), } post1, err = ss.Post().Save(rctx, post1) require.NoError(t, err) @@ -888,7 +888,7 @@ func testEditAfterExportMessage(t *testing.T, rctx request.CTX, ss store.Store) // need a team team := &model.Team{ DisplayName: "DisplayName", - Name: NewTestId(), + Name: NewTestID(), Email: MakeEmail(), Type: model.TeamOpen, } @@ -923,7 +923,7 @@ func testEditAfterExportMessage(t *testing.T, rctx request.CTX, ss store.Store) ChannelId: channel.Id, UserId: user1.Id, CreateAt: startTime, - Message: NewTestId(), + Message: NewTestID(), } post1, err = ss.Post().Save(rctx, post1) require.NoError(t, err) @@ -999,7 +999,7 @@ func testDeleteExportMessage(t *testing.T, rctx request.CTX, ss store.Store) { // need a team team := &model.Team{ DisplayName: "DisplayName", - Name: NewTestId(), + Name: NewTestID(), Email: MakeEmail(), Type: model.TeamOpen, } @@ -1034,7 +1034,7 @@ func testDeleteExportMessage(t *testing.T, rctx request.CTX, ss store.Store) { ChannelId: channel.Id, UserId: user1.Id, CreateAt: startTime, - Message: NewTestId(), + Message: NewTestID(), } post1, err = ss.Post().Save(rctx, post1) require.NoError(t, err) @@ -1084,7 +1084,7 @@ func testDeleteAfterExportMessage(t *testing.T, rctx request.CTX, ss store.Store // need a team team := &model.Team{ DisplayName: "DisplayName", - Name: NewTestId(), + Name: NewTestID(), Email: MakeEmail(), Type: model.TeamOpen, } @@ -1119,7 +1119,7 @@ func testDeleteAfterExportMessage(t *testing.T, rctx request.CTX, ss store.Store ChannelId: channel.Id, UserId: user1.Id, CreateAt: startTime, - Message: NewTestId(), + Message: NewTestID(), } post1, err = ss.Post().Save(rctx, post1) require.NoError(t, err) diff --git a/server/channels/store/storetest/desktop_tokens_store.go b/server/channels/store/storetest/desktop_tokens_store.go index dd62657b75ed4..3791dbadabcda 100644 --- a/server/channels/store/storetest/desktop_tokens_store.go +++ b/server/channels/store/storetest/desktop_tokens_store.go @@ -13,28 +13,28 @@ import ( ) func TestDesktopTokensStore(t *testing.T, rctx request.CTX, ss store.Store, s SqlStore) { - t.Run("GetUserId", func(t *testing.T) { testGetUserId(t, rctx, ss) }) + t.Run("GetUserId", func(t *testing.T) { testGetUserID(t, rctx, ss) }) t.Run("Insert", func(t *testing.T) { testInsert(t, rctx, ss) }) t.Run("Delete", func(t *testing.T) { testDeleteToken(t, rctx, ss) }) - t.Run("DeleteByUserId", func(t *testing.T) { testDeleteByUserId(t, rctx, ss) }) + t.Run("DeleteByUserId", func(t *testing.T) { testDeleteByUserID(t, rctx, ss) }) t.Run("DeleteOlderThan", func(t *testing.T) { testDeleteOlderThan(t, rctx, ss) }) } -func testGetUserId(t *testing.T, rctx request.CTX, ss store.Store) { +func testGetUserID(t *testing.T, rctx request.CTX, ss store.Store) { err := ss.DesktopTokens().Insert("token_with_id", 1000, "user_id") require.NoError(t, err) t.Run("get user id", func(t *testing.T) { - userId, err := ss.DesktopTokens().GetUserId("token_with_id", 1000) + userID, err := ss.DesktopTokens().GetUserId("token_with_id", 1000) assert.NoError(t, err) - assert.Equal(t, "user_id", *userId) + assert.Equal(t, "user_id", *userID) }) t.Run("get user id - expired", func(t *testing.T) { - userId, err := ss.DesktopTokens().GetUserId("token_with_id", 10000) + userID, err := ss.DesktopTokens().GetUserId("token_with_id", 10000) assert.Error(t, err) assert.IsType(t, &store.ErrNotFound{}, err) - assert.Nil(t, userId) + assert.Nil(t, userID) }) } @@ -59,9 +59,9 @@ func testDeleteToken(t *testing.T, rctx request.CTX, ss store.Store) { require.NoError(t, err) t.Run("delete", func(t *testing.T) { - userId, err := ss.DesktopTokens().GetUserId("deleteable_token", 3000) + userID, err := ss.DesktopTokens().GetUserId("deleteable_token", 3000) assert.NoError(t, err) - assert.Equal(t, "user_id", *userId) + assert.Equal(t, "user_id", *userID) err = ss.DesktopTokens().Delete("deleteable_token") assert.NoError(t, err) @@ -71,14 +71,14 @@ func testDeleteToken(t *testing.T, rctx request.CTX, ss store.Store) { }) } -func testDeleteByUserId(t *testing.T, rctx request.CTX, ss store.Store) { +func testDeleteByUserID(t *testing.T, rctx request.CTX, ss store.Store) { err := ss.DesktopTokens().Insert("deleteable_token_2", 4000, "deleteable_user_id") require.NoError(t, err) t.Run("delete by user id", func(t *testing.T) { - userId, err := ss.DesktopTokens().GetUserId("deleteable_token_2", 3000) + userID, err := ss.DesktopTokens().GetUserId("deleteable_token_2", 3000) assert.NoError(t, err) - assert.Equal(t, "deleteable_user_id", *userId) + assert.Equal(t, "deleteable_user_id", *userID) err = ss.DesktopTokens().DeleteByUserId("deleteable_user_id") assert.NoError(t, err) diff --git a/server/channels/store/storetest/draft_store.go b/server/channels/store/storetest/draft_store.go index ac0ec96fc52be..bb305977c7221 100644 --- a/server/channels/store/storetest/draft_store.go +++ b/server/channels/store/storetest/draft_store.go @@ -22,9 +22,9 @@ func TestDraftStore(t *testing.T, rctx request.CTX, ss store.Store, s SqlStore) t.Run("DeleteDraftsAssociatedWithPost", func(t *testing.T) { testDeleteDraftsAssociatedWithPost(t, rctx, ss) }) t.Run("GetDraft", func(t *testing.T) { testGetDraft(t, rctx, ss) }) t.Run("GetDraftsForUser", func(t *testing.T) { testGetDraftsForUser(t, rctx, ss) }) - t.Run("GetLastCreateAtAndUserIdValuesForEmptyDraftsMigration", func(t *testing.T) { testGetLastCreateAtAndUserIdValuesForEmptyDraftsMigration(t, rctx, ss) }) - t.Run("DeleteEmptyDraftsByCreateAtAndUserId", func(t *testing.T) { testDeleteEmptyDraftsByCreateAtAndUserId(t, rctx, ss) }) - t.Run("DeleteOrphanDraftsByCreateAtAndUserId", func(t *testing.T) { testDeleteOrphanDraftsByCreateAtAndUserId(t, rctx, ss) }) + t.Run("GetLastCreateAtAndUserIdValuesForEmptyDraftsMigration", func(t *testing.T) { testGetLastCreateAtAndUserIDValuesForEmptyDraftsMigration(t, rctx, ss) }) + t.Run("DeleteEmptyDraftsByCreateAtAndUserId", func(t *testing.T) { testDeleteEmptyDraftsByCreateAtAndUserID(t, rctx, ss) }) + t.Run("DeleteOrphanDraftsByCreateAtAndUserId", func(t *testing.T) { testDeleteOrphanDraftsByCreateAtAndUserID(t, rctx, ss) }) } func testSaveDraft(t *testing.T, rctx request.CTX, ss store.Store) { @@ -388,26 +388,26 @@ func countDraftPages(t *testing.T, rctx request.CTX, ss store.Store) int { pages := 0 createAt := int64(0) - userId := "" + userID := "" for { - nextCreateAt, nextUserId, err := ss.Draft().GetLastCreateAtAndUserIdValuesForEmptyDraftsMigration(createAt, userId) + nextCreateAt, nextUserID, err := ss.Draft().GetLastCreateAtAndUserIdValuesForEmptyDraftsMigration(createAt, userID) require.NoError(t, err) - if nextCreateAt == 0 && nextUserId == "" { + if nextCreateAt == 0 && nextUserID == "" { break } // Ensure we're always making progress. if nextCreateAt == createAt { - require.Greater(t, nextUserId, userId) + require.Greater(t, nextUserID, userID) } else { require.Greater(t, nextCreateAt, createAt) } pages++ createAt = nextCreateAt - userId = nextUserId + userID = nextUserID } return pages @@ -483,14 +483,14 @@ func makeDraftsWithDeletedPosts(t *testing.T, rctx request.CTX, ss store.Store, time.Sleep(5 * time.Millisecond) } -func testGetLastCreateAtAndUserIdValuesForEmptyDraftsMigration(t *testing.T, rctx request.CTX, ss store.Store) { +func testGetLastCreateAtAndUserIDValuesForEmptyDraftsMigration(t *testing.T, rctx request.CTX, ss store.Store) { t.Run("no drafts", func(t *testing.T) { clearDrafts(t, rctx, ss) - createAt, userId, err := ss.Draft().GetLastCreateAtAndUserIdValuesForEmptyDraftsMigration(0, "") + createAt, userID, err := ss.Draft().GetLastCreateAtAndUserIdValuesForEmptyDraftsMigration(0, "") require.NoError(t, err) assert.EqualValues(t, 0, createAt) - assert.Equal(t, "", userId) + assert.Equal(t, "", userID) assert.Equal(t, 0, countDraftPages(t, rctx, ss), "incorrect number of pages") }) @@ -510,7 +510,7 @@ func testGetLastCreateAtAndUserIdValuesForEmptyDraftsMigration(t *testing.T, rct }) } -func testDeleteEmptyDraftsByCreateAtAndUserId(t *testing.T, rctx request.CTX, ss store.Store) { +func testDeleteEmptyDraftsByCreateAtAndUserID(t *testing.T, rctx request.CTX, ss store.Store) { t.Run("nil parameters", func(t *testing.T) { clearDrafts(t, rctx, ss) @@ -522,54 +522,54 @@ func testDeleteEmptyDraftsByCreateAtAndUserId(t *testing.T, rctx request.CTX, ss clearDrafts(t, rctx, ss) makeDrafts(t, ss, 100, "") - createAt, userId := int64(0), "" - nextCreateAt, nextUserId, err := ss.Draft().GetLastCreateAtAndUserIdValuesForEmptyDraftsMigration(createAt, userId) + createAt, userID := int64(0), "" + nextCreateAt, nextUserID, err := ss.Draft().GetLastCreateAtAndUserIdValuesForEmptyDraftsMigration(createAt, userID) require.NoError(t, err) - err = ss.Draft().DeleteEmptyDraftsByCreateAtAndUserId(createAt, userId) + err = ss.Draft().DeleteEmptyDraftsByCreateAtAndUserId(createAt, userID) require.NoError(t, err) - createAt, userId = nextCreateAt, nextUserId + createAt, userID = nextCreateAt, nextUserID assert.Equal(t, 0, countDraftPages(t, rctx, ss), "incorrect number of pages") - nextCreateAt, nextUserId, err = ss.Draft().GetLastCreateAtAndUserIdValuesForEmptyDraftsMigration(createAt, userId) + nextCreateAt, nextUserID, err = ss.Draft().GetLastCreateAtAndUserIdValuesForEmptyDraftsMigration(createAt, userID) require.NoError(t, err) assert.EqualValues(t, 0, nextCreateAt, "should have finished iterating through drafts") - assert.Equal(t, "", nextUserId, "should have finished iterating through drafts") + assert.Equal(t, "", nextUserID, "should have finished iterating through drafts") }) t.Run("delete multiple pages, all empty", func(t *testing.T) { clearDrafts(t, rctx, ss) makeDrafts(t, ss, 300, "") - createAt, userId := int64(0), "" - nextCreateAt, nextUserId, err := ss.Draft().GetLastCreateAtAndUserIdValuesForEmptyDraftsMigration(createAt, userId) + createAt, userID := int64(0), "" + nextCreateAt, nextUserID, err := ss.Draft().GetLastCreateAtAndUserIdValuesForEmptyDraftsMigration(createAt, userID) require.NoError(t, err) - err = ss.Draft().DeleteEmptyDraftsByCreateAtAndUserId(createAt, userId) + err = ss.Draft().DeleteEmptyDraftsByCreateAtAndUserId(createAt, userID) require.NoError(t, err) - createAt, userId = nextCreateAt, nextUserId + createAt, userID = nextCreateAt, nextUserID assert.Equal(t, 2, countDraftPages(t, rctx, ss), "incorrect number of pages") - nextCreateAt, nextUserId, err = ss.Draft().GetLastCreateAtAndUserIdValuesForEmptyDraftsMigration(createAt, userId) + nextCreateAt, nextUserID, err = ss.Draft().GetLastCreateAtAndUserIdValuesForEmptyDraftsMigration(createAt, userID) require.NoError(t, err) - err = ss.Draft().DeleteEmptyDraftsByCreateAtAndUserId(createAt, userId) + err = ss.Draft().DeleteEmptyDraftsByCreateAtAndUserId(createAt, userID) require.NoError(t, err) - createAt, userId = nextCreateAt, nextUserId + createAt, userID = nextCreateAt, nextUserID assert.Equal(t, 1, countDraftPages(t, rctx, ss), "incorrect number of pages") - nextCreateAt, nextUserId, err = ss.Draft().GetLastCreateAtAndUserIdValuesForEmptyDraftsMigration(createAt, userId) + nextCreateAt, nextUserID, err = ss.Draft().GetLastCreateAtAndUserIdValuesForEmptyDraftsMigration(createAt, userID) require.NoError(t, err) - err = ss.Draft().DeleteEmptyDraftsByCreateAtAndUserId(createAt, userId) + err = ss.Draft().DeleteEmptyDraftsByCreateAtAndUserId(createAt, userID) require.NoError(t, err) - createAt, userId = nextCreateAt, nextUserId + createAt, userID = nextCreateAt, nextUserID assert.Equal(t, 0, countDraftPages(t, rctx, ss), "incorrect number of pages") - nextCreateAt, nextUserId, err = ss.Draft().GetLastCreateAtAndUserIdValuesForEmptyDraftsMigration(createAt, userId) + nextCreateAt, nextUserID, err = ss.Draft().GetLastCreateAtAndUserIdValuesForEmptyDraftsMigration(createAt, userID) require.NoError(t, err) assert.EqualValues(t, 0, nextCreateAt, "should have finished iterating through drafts") - assert.Equal(t, "", nextUserId, "should have finished iterating through drafts") + assert.Equal(t, "", nextUserID, "should have finished iterating through drafts") }) t.Run("delete multiple pages, some empty", func(t *testing.T) { @@ -588,62 +588,62 @@ func testDeleteEmptyDraftsByCreateAtAndUserId(t *testing.T, rctx request.CTX, ss // Verify initially 5 pages assert.Equal(t, 5, countDraftPages(t, rctx, ss), "incorrect number of pages") - createAt, userId := int64(0), "" + createAt, userID := int64(0), "" - nextCreateAt, nextUserId, err := ss.Draft().GetLastCreateAtAndUserIdValuesForEmptyDraftsMigration(createAt, userId) + nextCreateAt, nextUserID, err := ss.Draft().GetLastCreateAtAndUserIdValuesForEmptyDraftsMigration(createAt, userID) require.NoError(t, err) - err = ss.Draft().DeleteEmptyDraftsByCreateAtAndUserId(createAt, userId) + err = ss.Draft().DeleteEmptyDraftsByCreateAtAndUserId(createAt, userID) require.NoError(t, err) - createAt, userId = nextCreateAt, nextUserId + createAt, userID = nextCreateAt, nextUserID // Only deleted 50, so still 5 pages assert.Equal(t, 5, countDraftPages(t, rctx, ss), "incorrect number of pages") - nextCreateAt, nextUserId, err = ss.Draft().GetLastCreateAtAndUserIdValuesForEmptyDraftsMigration(createAt, userId) + nextCreateAt, nextUserID, err = ss.Draft().GetLastCreateAtAndUserIdValuesForEmptyDraftsMigration(createAt, userID) require.NoError(t, err) - err = ss.Draft().DeleteEmptyDraftsByCreateAtAndUserId(createAt, userId) + err = ss.Draft().DeleteEmptyDraftsByCreateAtAndUserId(createAt, userID) require.NoError(t, err) - createAt, userId = nextCreateAt, nextUserId + createAt, userID = nextCreateAt, nextUserID // Now deleted 100, so down to 4 pages assert.Equal(t, 4, countDraftPages(t, rctx, ss), "incorrect number of pages") - nextCreateAt, nextUserId, err = ss.Draft().GetLastCreateAtAndUserIdValuesForEmptyDraftsMigration(createAt, userId) + nextCreateAt, nextUserID, err = ss.Draft().GetLastCreateAtAndUserIdValuesForEmptyDraftsMigration(createAt, userID) require.NoError(t, err) - err = ss.Draft().DeleteEmptyDraftsByCreateAtAndUserId(createAt, userId) + err = ss.Draft().DeleteEmptyDraftsByCreateAtAndUserId(createAt, userID) require.NoError(t, err) - createAt, userId = nextCreateAt, nextUserId + createAt, userID = nextCreateAt, nextUserID // Only deleted 150 now, so still 4 pages assert.Equal(t, 4, countDraftPages(t, rctx, ss), "incorrect number of pages") - nextCreateAt, nextUserId, err = ss.Draft().GetLastCreateAtAndUserIdValuesForEmptyDraftsMigration(createAt, userId) + nextCreateAt, nextUserID, err = ss.Draft().GetLastCreateAtAndUserIdValuesForEmptyDraftsMigration(createAt, userID) require.NoError(t, err) - err = ss.Draft().DeleteEmptyDraftsByCreateAtAndUserId(createAt, userId) + err = ss.Draft().DeleteEmptyDraftsByCreateAtAndUserId(createAt, userID) require.NoError(t, err) - createAt, userId = nextCreateAt, nextUserId + createAt, userID = nextCreateAt, nextUserID // Now deleted all 200 empty messages, so down to 3 pages assert.Equal(t, 3, countDraftPages(t, rctx, ss), "incorrect number of pages") // Keep going through all pages to verify nothing else gets deleted. - nextCreateAt, nextUserId, err = ss.Draft().GetLastCreateAtAndUserIdValuesForEmptyDraftsMigration(createAt, userId) + nextCreateAt, nextUserID, err = ss.Draft().GetLastCreateAtAndUserIdValuesForEmptyDraftsMigration(createAt, userID) require.NoError(t, err) - err = ss.Draft().DeleteEmptyDraftsByCreateAtAndUserId(createAt, userId) + err = ss.Draft().DeleteEmptyDraftsByCreateAtAndUserId(createAt, userID) require.NoError(t, err) - createAt, userId = nextCreateAt, nextUserId + createAt, userID = nextCreateAt, nextUserID // Verify we're done iterating - nextCreateAt, nextUserId, err = ss.Draft().GetLastCreateAtAndUserIdValuesForEmptyDraftsMigration(createAt, userId) + nextCreateAt, nextUserID, err = ss.Draft().GetLastCreateAtAndUserIdValuesForEmptyDraftsMigration(createAt, userID) require.NoError(t, err) assert.EqualValues(t, 0, nextCreateAt, "should have finished iterating through drafts") - assert.Equal(t, "", nextUserId, "should have finished iterating through drafts") + assert.Equal(t, "", nextUserID, "should have finished iterating through drafts") }) } -func testDeleteOrphanDraftsByCreateAtAndUserId(t *testing.T, rctx request.CTX, ss store.Store) { +func testDeleteOrphanDraftsByCreateAtAndUserID(t *testing.T, rctx request.CTX, ss store.Store) { t.Run("nil parameters", func(t *testing.T) { clearDrafts(t, rctx, ss) clearPosts(t, rctx, ss) @@ -658,19 +658,19 @@ func testDeleteOrphanDraftsByCreateAtAndUserId(t *testing.T, rctx request.CTX, s makeDrafts(t, ss, 100, "Okay") - createAt, userId := int64(0), "" - nextCreateAt, nextUserId, err := ss.Draft().GetLastCreateAtAndUserIdValuesForEmptyDraftsMigration(createAt, userId) + createAt, userID := int64(0), "" + nextCreateAt, nextUserID, err := ss.Draft().GetLastCreateAtAndUserIdValuesForEmptyDraftsMigration(createAt, userID) require.NoError(t, err) - err = ss.Draft().DeleteOrphanDraftsByCreateAtAndUserId(createAt, userId) + err = ss.Draft().DeleteOrphanDraftsByCreateAtAndUserId(createAt, userID) require.NoError(t, err) - createAt, userId = nextCreateAt, nextUserId + createAt, userID = nextCreateAt, nextUserID assert.Equal(t, 0, countDraftPages(t, rctx, ss), "incorrect number of pages") - nextCreateAt, nextUserId, err = ss.Draft().GetLastCreateAtAndUserIdValuesForEmptyDraftsMigration(createAt, userId) + nextCreateAt, nextUserID, err = ss.Draft().GetLastCreateAtAndUserIdValuesForEmptyDraftsMigration(createAt, userID) require.NoError(t, err) assert.EqualValues(t, 0, nextCreateAt, "should have finished iterating through drafts") - assert.Equal(t, "", nextUserId, "should have finished iterating through drafts") + assert.Equal(t, "", nextUserID, "should have finished iterating through drafts") }) t.Run("delete multiple pages, drafts with no post", func(t *testing.T) { @@ -679,35 +679,35 @@ func testDeleteOrphanDraftsByCreateAtAndUserId(t *testing.T, rctx request.CTX, s makeDrafts(t, ss, 300, "Okay") - createAt, userId := int64(0), "" - nextCreateAt, nextUserId, err := ss.Draft().GetLastCreateAtAndUserIdValuesForEmptyDraftsMigration(createAt, userId) + createAt, userID := int64(0), "" + nextCreateAt, nextUserID, err := ss.Draft().GetLastCreateAtAndUserIdValuesForEmptyDraftsMigration(createAt, userID) require.NoError(t, err) - err = ss.Draft().DeleteOrphanDraftsByCreateAtAndUserId(createAt, userId) + err = ss.Draft().DeleteOrphanDraftsByCreateAtAndUserId(createAt, userID) require.NoError(t, err) - createAt, userId = nextCreateAt, nextUserId + createAt, userID = nextCreateAt, nextUserID assert.Equal(t, 2, countDraftPages(t, rctx, ss), "incorrect number of pages") - nextCreateAt, nextUserId, err = ss.Draft().GetLastCreateAtAndUserIdValuesForEmptyDraftsMigration(createAt, userId) + nextCreateAt, nextUserID, err = ss.Draft().GetLastCreateAtAndUserIdValuesForEmptyDraftsMigration(createAt, userID) require.NoError(t, err) - err = ss.Draft().DeleteOrphanDraftsByCreateAtAndUserId(createAt, userId) + err = ss.Draft().DeleteOrphanDraftsByCreateAtAndUserId(createAt, userID) require.NoError(t, err) - createAt, userId = nextCreateAt, nextUserId + createAt, userID = nextCreateAt, nextUserID assert.Equal(t, 1, countDraftPages(t, rctx, ss), "incorrect number of pages") - nextCreateAt, nextUserId, err = ss.Draft().GetLastCreateAtAndUserIdValuesForEmptyDraftsMigration(createAt, userId) + nextCreateAt, nextUserID, err = ss.Draft().GetLastCreateAtAndUserIdValuesForEmptyDraftsMigration(createAt, userID) require.NoError(t, err) - err = ss.Draft().DeleteOrphanDraftsByCreateAtAndUserId(createAt, userId) + err = ss.Draft().DeleteOrphanDraftsByCreateAtAndUserId(createAt, userID) require.NoError(t, err) - createAt, userId = nextCreateAt, nextUserId + createAt, userID = nextCreateAt, nextUserID assert.Equal(t, 0, countDraftPages(t, rctx, ss), "incorrect number of pages") - nextCreateAt, nextUserId, err = ss.Draft().GetLastCreateAtAndUserIdValuesForEmptyDraftsMigration(createAt, userId) + nextCreateAt, nextUserID, err = ss.Draft().GetLastCreateAtAndUserIdValuesForEmptyDraftsMigration(createAt, userID) require.NoError(t, err) assert.EqualValues(t, 0, nextCreateAt, "should have finished iterating through drafts") - assert.Equal(t, "", nextUserId, "should have finished iterating through drafts") + assert.Equal(t, "", nextUserID, "should have finished iterating through drafts") }) t.Run("delete single page, drafts with deleted post", func(t *testing.T) { @@ -716,19 +716,19 @@ func testDeleteOrphanDraftsByCreateAtAndUserId(t *testing.T, rctx request.CTX, s makeDraftsWithDeletedPosts(t, rctx, ss, 100, "Okay") - createAt, userId := int64(0), "" - nextCreateAt, nextUserId, err := ss.Draft().GetLastCreateAtAndUserIdValuesForEmptyDraftsMigration(createAt, userId) + createAt, userID := int64(0), "" + nextCreateAt, nextUserID, err := ss.Draft().GetLastCreateAtAndUserIdValuesForEmptyDraftsMigration(createAt, userID) require.NoError(t, err) - err = ss.Draft().DeleteOrphanDraftsByCreateAtAndUserId(createAt, userId) + err = ss.Draft().DeleteOrphanDraftsByCreateAtAndUserId(createAt, userID) require.NoError(t, err) - createAt, userId = nextCreateAt, nextUserId + createAt, userID = nextCreateAt, nextUserID assert.Equal(t, 0, countDraftPages(t, rctx, ss), "incorrect number of pages") - nextCreateAt, nextUserId, err = ss.Draft().GetLastCreateAtAndUserIdValuesForEmptyDraftsMigration(createAt, userId) + nextCreateAt, nextUserID, err = ss.Draft().GetLastCreateAtAndUserIdValuesForEmptyDraftsMigration(createAt, userID) require.NoError(t, err) assert.EqualValues(t, 0, nextCreateAt, "should have finished iterating through drafts") - assert.Equal(t, "", nextUserId, "should have finished iterating through drafts") + assert.Equal(t, "", nextUserID, "should have finished iterating through drafts") }) t.Run("delete multiple pages, drafts with deleted post", func(t *testing.T) { @@ -737,35 +737,35 @@ func testDeleteOrphanDraftsByCreateAtAndUserId(t *testing.T, rctx request.CTX, s makeDraftsWithDeletedPosts(t, rctx, ss, 300, "Okay") - createAt, userId := int64(0), "" - nextCreateAt, nextUserId, err := ss.Draft().GetLastCreateAtAndUserIdValuesForEmptyDraftsMigration(createAt, userId) + createAt, userID := int64(0), "" + nextCreateAt, nextUserID, err := ss.Draft().GetLastCreateAtAndUserIdValuesForEmptyDraftsMigration(createAt, userID) require.NoError(t, err) - err = ss.Draft().DeleteOrphanDraftsByCreateAtAndUserId(createAt, userId) + err = ss.Draft().DeleteOrphanDraftsByCreateAtAndUserId(createAt, userID) require.NoError(t, err) - createAt, userId = nextCreateAt, nextUserId + createAt, userID = nextCreateAt, nextUserID assert.Equal(t, 2, countDraftPages(t, rctx, ss), "incorrect number of pages") - nextCreateAt, nextUserId, err = ss.Draft().GetLastCreateAtAndUserIdValuesForEmptyDraftsMigration(createAt, userId) + nextCreateAt, nextUserID, err = ss.Draft().GetLastCreateAtAndUserIdValuesForEmptyDraftsMigration(createAt, userID) require.NoError(t, err) - err = ss.Draft().DeleteOrphanDraftsByCreateAtAndUserId(createAt, userId) + err = ss.Draft().DeleteOrphanDraftsByCreateAtAndUserId(createAt, userID) require.NoError(t, err) - createAt, userId = nextCreateAt, nextUserId + createAt, userID = nextCreateAt, nextUserID assert.Equal(t, 1, countDraftPages(t, rctx, ss), "incorrect number of pages") - nextCreateAt, nextUserId, err = ss.Draft().GetLastCreateAtAndUserIdValuesForEmptyDraftsMigration(createAt, userId) + nextCreateAt, nextUserID, err = ss.Draft().GetLastCreateAtAndUserIdValuesForEmptyDraftsMigration(createAt, userID) require.NoError(t, err) - err = ss.Draft().DeleteOrphanDraftsByCreateAtAndUserId(createAt, userId) + err = ss.Draft().DeleteOrphanDraftsByCreateAtAndUserId(createAt, userID) require.NoError(t, err) - createAt, userId = nextCreateAt, nextUserId + createAt, userID = nextCreateAt, nextUserID assert.Equal(t, 0, countDraftPages(t, rctx, ss), "incorrect number of pages") - nextCreateAt, nextUserId, err = ss.Draft().GetLastCreateAtAndUserIdValuesForEmptyDraftsMigration(createAt, userId) + nextCreateAt, nextUserID, err = ss.Draft().GetLastCreateAtAndUserIdValuesForEmptyDraftsMigration(createAt, userID) require.NoError(t, err) assert.EqualValues(t, 0, nextCreateAt, "should have finished iterating through drafts") - assert.Equal(t, "", nextUserId, "should have finished iterating through drafts") + assert.Equal(t, "", nextUserID, "should have finished iterating through drafts") }) t.Run("delete single page, drafts with non deleted post", func(t *testing.T) { @@ -774,20 +774,20 @@ func testDeleteOrphanDraftsByCreateAtAndUserId(t *testing.T, rctx request.CTX, s makeDraftsWithNonDeletedPosts(t, rctx, ss, 100, "Okay") - createAt, userId := int64(0), "" - nextCreateAt, nextUserId, err := ss.Draft().GetLastCreateAtAndUserIdValuesForEmptyDraftsMigration(createAt, userId) + createAt, userID := int64(0), "" + nextCreateAt, nextUserID, err := ss.Draft().GetLastCreateAtAndUserIdValuesForEmptyDraftsMigration(createAt, userID) require.NoError(t, err) - err = ss.Draft().DeleteOrphanDraftsByCreateAtAndUserId(createAt, userId) + err = ss.Draft().DeleteOrphanDraftsByCreateAtAndUserId(createAt, userID) require.NoError(t, err) - createAt, userId = nextCreateAt, nextUserId + createAt, userID = nextCreateAt, nextUserID assert.Equal(t, 100, countDrafts(t, rctx, ss), "incorrect number of drafts") assert.Equal(t, 1, countDraftPages(t, rctx, ss), "incorrect number of pages") - nextCreateAt, nextUserId, err = ss.Draft().GetLastCreateAtAndUserIdValuesForEmptyDraftsMigration(createAt, userId) + nextCreateAt, nextUserID, err = ss.Draft().GetLastCreateAtAndUserIdValuesForEmptyDraftsMigration(createAt, userID) require.NoError(t, err) assert.EqualValues(t, 0, nextCreateAt, "should have finished iterating through drafts") - assert.Equal(t, "", nextUserId, "should have finished iterating through drafts") + assert.Equal(t, "", nextUserID, "should have finished iterating through drafts") }) t.Run("delete multiple pages, drafts with non deleted post", func(t *testing.T) { @@ -796,38 +796,38 @@ func testDeleteOrphanDraftsByCreateAtAndUserId(t *testing.T, rctx request.CTX, s makeDraftsWithNonDeletedPosts(t, rctx, ss, 300, "Okay") - createAt, userId := int64(0), "" - nextCreateAt, nextUserId, err := ss.Draft().GetLastCreateAtAndUserIdValuesForEmptyDraftsMigration(createAt, userId) + createAt, userID := int64(0), "" + nextCreateAt, nextUserID, err := ss.Draft().GetLastCreateAtAndUserIdValuesForEmptyDraftsMigration(createAt, userID) require.NoError(t, err) - err = ss.Draft().DeleteOrphanDraftsByCreateAtAndUserId(createAt, userId) + err = ss.Draft().DeleteOrphanDraftsByCreateAtAndUserId(createAt, userID) require.NoError(t, err) - createAt, userId = nextCreateAt, nextUserId + createAt, userID = nextCreateAt, nextUserID assert.Equal(t, 300, countDrafts(t, rctx, ss), "incorrect number of drafts") assert.Equal(t, 3, countDraftPages(t, rctx, ss), "incorrect number of pages") - nextCreateAt, nextUserId, err = ss.Draft().GetLastCreateAtAndUserIdValuesForEmptyDraftsMigration(createAt, userId) + nextCreateAt, nextUserID, err = ss.Draft().GetLastCreateAtAndUserIdValuesForEmptyDraftsMigration(createAt, userID) require.NoError(t, err) - err = ss.Draft().DeleteOrphanDraftsByCreateAtAndUserId(createAt, userId) + err = ss.Draft().DeleteOrphanDraftsByCreateAtAndUserId(createAt, userID) require.NoError(t, err) - createAt, userId = nextCreateAt, nextUserId + createAt, userID = nextCreateAt, nextUserID assert.Equal(t, 300, countDrafts(t, rctx, ss), "incorrect number of drafts") assert.Equal(t, 3, countDraftPages(t, rctx, ss), "incorrect number of pages") - nextCreateAt, nextUserId, err = ss.Draft().GetLastCreateAtAndUserIdValuesForEmptyDraftsMigration(createAt, userId) + nextCreateAt, nextUserID, err = ss.Draft().GetLastCreateAtAndUserIdValuesForEmptyDraftsMigration(createAt, userID) require.NoError(t, err) - err = ss.Draft().DeleteOrphanDraftsByCreateAtAndUserId(createAt, userId) + err = ss.Draft().DeleteOrphanDraftsByCreateAtAndUserId(createAt, userID) require.NoError(t, err) - createAt, userId = nextCreateAt, nextUserId + createAt, userID = nextCreateAt, nextUserID assert.Equal(t, 300, countDrafts(t, rctx, ss), "incorrect number of drafts") assert.Equal(t, 3, countDraftPages(t, rctx, ss), "incorrect number of pages") - nextCreateAt, nextUserId, err = ss.Draft().GetLastCreateAtAndUserIdValuesForEmptyDraftsMigration(createAt, userId) + nextCreateAt, nextUserID, err = ss.Draft().GetLastCreateAtAndUserIdValuesForEmptyDraftsMigration(createAt, userID) require.NoError(t, err) assert.EqualValues(t, 0, nextCreateAt, "should have finished iterating through drafts") - assert.Equal(t, "", nextUserId, "should have finished iterating through drafts") + assert.Equal(t, "", nextUserID, "should have finished iterating through drafts") }) // This test is a bit more complicated, but it's the most realistic scenario and covers all the remaining cases @@ -859,43 +859,43 @@ func testDeleteOrphanDraftsByCreateAtAndUserId(t *testing.T, rctx request.CTX, s assert.Equal(t, 5, countDraftPages(t, rctx, ss), "incorrect number of pages") assert.Equal(t, 500, countDrafts(t, rctx, ss), "incorrect number of drafts") - createAt, userId := int64(0), "" + createAt, userID := int64(0), "" - nextCreateAt, nextUserId, err := ss.Draft().GetLastCreateAtAndUserIdValuesForEmptyDraftsMigration(createAt, userId) + nextCreateAt, nextUserID, err := ss.Draft().GetLastCreateAtAndUserIdValuesForEmptyDraftsMigration(createAt, userID) require.NoError(t, err) - err = ss.Draft().DeleteOrphanDraftsByCreateAtAndUserId(createAt, userId) + err = ss.Draft().DeleteOrphanDraftsByCreateAtAndUserId(createAt, userID) require.NoError(t, err) - createAt, userId = nextCreateAt, nextUserId + createAt, userID = nextCreateAt, nextUserID // Only deleted 50, so still 5 pages assert.Equal(t, 5, countDraftPages(t, rctx, ss), "incorrect number of pages") assert.Equal(t, 450, countDrafts(t, rctx, ss), "incorrect number of drafts") - nextCreateAt, nextUserId, err = ss.Draft().GetLastCreateAtAndUserIdValuesForEmptyDraftsMigration(createAt, userId) + nextCreateAt, nextUserID, err = ss.Draft().GetLastCreateAtAndUserIdValuesForEmptyDraftsMigration(createAt, userID) require.NoError(t, err) - err = ss.Draft().DeleteOrphanDraftsByCreateAtAndUserId(createAt, userId) + err = ss.Draft().DeleteOrphanDraftsByCreateAtAndUserId(createAt, userID) require.NoError(t, err) - createAt, userId = nextCreateAt, nextUserId + createAt, userID = nextCreateAt, nextUserID // Now deleted 150, so down to 4 pages assert.Equal(t, 4, countDraftPages(t, rctx, ss), "incorrect number of pages") assert.Equal(t, 350, countDrafts(t, rctx, ss), "incorrect number of drafts") - nextCreateAt, nextUserId, err = ss.Draft().GetLastCreateAtAndUserIdValuesForEmptyDraftsMigration(createAt, userId) + nextCreateAt, nextUserID, err = ss.Draft().GetLastCreateAtAndUserIdValuesForEmptyDraftsMigration(createAt, userID) require.NoError(t, err) - err = ss.Draft().DeleteOrphanDraftsByCreateAtAndUserId(createAt, userId) + err = ss.Draft().DeleteOrphanDraftsByCreateAtAndUserId(createAt, userID) require.NoError(t, err) - createAt, userId = nextCreateAt, nextUserId + createAt, userID = nextCreateAt, nextUserID // Now deleted 200 now, so down to 3 pages assert.Equal(t, 3, countDraftPages(t, rctx, ss), "incorrect number of pages") assert.Equal(t, 300, countDrafts(t, rctx, ss), "incorrect number of drafts") - nextCreateAt, nextUserId, err = ss.Draft().GetLastCreateAtAndUserIdValuesForEmptyDraftsMigration(createAt, userId) + nextCreateAt, nextUserID, err = ss.Draft().GetLastCreateAtAndUserIdValuesForEmptyDraftsMigration(createAt, userID) require.NoError(t, err) - err = ss.Draft().DeleteOrphanDraftsByCreateAtAndUserId(createAt, userId) + err = ss.Draft().DeleteOrphanDraftsByCreateAtAndUserId(createAt, userID) require.NoError(t, err) - createAt, userId = nextCreateAt, nextUserId + createAt, userID = nextCreateAt, nextUserID // Now deleted 270 empty messages, so still 3 pages assert.Equal(t, 3, countDraftPages(t, rctx, ss), "incorrect number of pages") @@ -903,18 +903,18 @@ func testDeleteOrphanDraftsByCreateAtAndUserId(t *testing.T, rctx request.CTX, s // Keep going through all pages to verify nothing else gets deleted. - nextCreateAt, nextUserId, err = ss.Draft().GetLastCreateAtAndUserIdValuesForEmptyDraftsMigration(createAt, userId) + nextCreateAt, nextUserID, err = ss.Draft().GetLastCreateAtAndUserIdValuesForEmptyDraftsMigration(createAt, userID) require.NoError(t, err) - err = ss.Draft().DeleteOrphanDraftsByCreateAtAndUserId(createAt, userId) + err = ss.Draft().DeleteOrphanDraftsByCreateAtAndUserId(createAt, userID) require.NoError(t, err) - createAt, userId = nextCreateAt, nextUserId + createAt, userID = nextCreateAt, nextUserID // Verify we're done iterating - nextCreateAt, nextUserId, err = ss.Draft().GetLastCreateAtAndUserIdValuesForEmptyDraftsMigration(createAt, userId) + nextCreateAt, nextUserID, err = ss.Draft().GetLastCreateAtAndUserIdValuesForEmptyDraftsMigration(createAt, userID) require.NoError(t, err) assert.EqualValues(t, 0, nextCreateAt, "should have finished iterating through drafts") - assert.Equal(t, "", nextUserId, "should have finished iterating through drafts") + assert.Equal(t, "", nextUserID, "should have finished iterating through drafts") }) } diff --git a/server/channels/store/storetest/file_info_store.go b/server/channels/store/storetest/file_info_store.go index b9b705a1d52fc..a4073b8b63be9 100644 --- a/server/channels/store/storetest/file_info_store.go +++ b/server/channels/store/storetest/file_info_store.go @@ -106,34 +106,34 @@ func testFileInfoSaveGetByPath(t *testing.T, rctx request.CTX, ss store.Store) { } func testFileInfoGetForPost(t *testing.T, rctx request.CTX, ss store.Store) { - userId := model.NewId() - postId := model.NewId() - channelId := model.NewId() + userID := model.NewId() + postID := model.NewId() + channelID := model.NewId() infos := []*model.FileInfo{ { - PostId: postId, - ChannelId: channelId, - CreatorId: userId, + PostId: postID, + ChannelId: channelID, + CreatorId: userID, Path: "file.txt", }, { - PostId: postId, - ChannelId: channelId, - CreatorId: userId, + PostId: postID, + ChannelId: channelID, + CreatorId: userID, Path: "file.txt", }, { - PostId: postId, - ChannelId: channelId, - CreatorId: userId, + PostId: postID, + ChannelId: channelID, + CreatorId: userID, Path: "file.txt", DeleteAt: 123, }, { PostId: model.NewId(), - ChannelId: channelId, - CreatorId: userId, + ChannelId: channelID, + CreatorId: userID, Path: "file.txt", }, } @@ -149,7 +149,7 @@ func testFileInfoGetForPost(t *testing.T, rctx request.CTX, ss store.Store) { testCases := []struct { Name string - PostId string + PostID string ReadFromMaster bool IncludeDeleted bool AllowFromCache bool @@ -157,7 +157,7 @@ func testFileInfoGetForPost(t *testing.T, rctx request.CTX, ss store.Store) { }{ { Name: "Fetch from master, without deleted and without cache", - PostId: postId, + PostID: postID, ReadFromMaster: true, IncludeDeleted: false, AllowFromCache: false, @@ -165,7 +165,7 @@ func testFileInfoGetForPost(t *testing.T, rctx request.CTX, ss store.Store) { }, { Name: "Fetch from master, with deleted and without cache", - PostId: postId, + PostID: postID, ReadFromMaster: true, IncludeDeleted: true, AllowFromCache: false, @@ -173,7 +173,7 @@ func testFileInfoGetForPost(t *testing.T, rctx request.CTX, ss store.Store) { }, { Name: "Fetch from master, with deleted and with cache", - PostId: postId, + PostID: postID, ReadFromMaster: true, IncludeDeleted: true, AllowFromCache: true, @@ -181,7 +181,7 @@ func testFileInfoGetForPost(t *testing.T, rctx request.CTX, ss store.Store) { }, { Name: "Fetch from replica, without deleted and without cache", - PostId: postId, + PostID: postID, ReadFromMaster: false, IncludeDeleted: false, AllowFromCache: false, @@ -189,7 +189,7 @@ func testFileInfoGetForPost(t *testing.T, rctx request.CTX, ss store.Store) { }, { Name: "Fetch from replica, with deleted and without cache", - PostId: postId, + PostID: postID, ReadFromMaster: false, IncludeDeleted: true, AllowFromCache: false, @@ -197,7 +197,7 @@ func testFileInfoGetForPost(t *testing.T, rctx request.CTX, ss store.Store) { }, { Name: "Fetch from replica, with deleted and without cache", - PostId: postId, + PostID: postID, ReadFromMaster: false, IncludeDeleted: true, AllowFromCache: true, @@ -205,7 +205,7 @@ func testFileInfoGetForPost(t *testing.T, rctx request.CTX, ss store.Store) { }, { Name: "Fetch from replica, without deleted and with cache", - PostId: postId, + PostID: postID, ReadFromMaster: true, IncludeDeleted: false, AllowFromCache: true, @@ -216,7 +216,7 @@ func testFileInfoGetForPost(t *testing.T, rctx request.CTX, ss store.Store) { for _, tc := range testCases { t.Run(tc.Name, func(t *testing.T) { postInfos, err := ss.FileInfo().GetForPost( - tc.PostId, + tc.PostID, tc.ReadFromMaster, tc.IncludeDeleted, tc.AllowFromCache, @@ -228,34 +228,34 @@ func testFileInfoGetForPost(t *testing.T, rctx request.CTX, ss store.Store) { } func testFileInfoGetForUser(t *testing.T, rctx request.CTX, ss store.Store) { - userId := model.NewId() - userId2 := model.NewId() - postId := model.NewId() - channelId := model.NewId() + userID := model.NewId() + userID2 := model.NewId() + postID := model.NewId() + channelID := model.NewId() infos := []*model.FileInfo{ { - PostId: postId, - ChannelId: channelId, - CreatorId: userId, + PostId: postID, + ChannelId: channelID, + CreatorId: userID, Path: "file.txt", }, { - PostId: postId, - ChannelId: channelId, - CreatorId: userId, + PostId: postID, + ChannelId: channelID, + CreatorId: userID, Path: "file.txt", }, { - PostId: postId, - ChannelId: channelId, - CreatorId: userId, + PostId: postID, + ChannelId: channelID, + CreatorId: userID, Path: "file.txt", }, { PostId: model.NewId(), - ChannelId: channelId, - CreatorId: userId2, + ChannelId: channelID, + CreatorId: userID2, Path: "file.txt", }, } @@ -269,11 +269,11 @@ func testFileInfoGetForUser(t *testing.T, rctx request.CTX, ss store.Store) { }(newInfo.Id) } - userPosts, err := ss.FileInfo().GetForUser(userId) + userPosts, err := ss.FileInfo().GetForUser(userID) require.NoError(t, err) assert.Len(t, userPosts, 3) - userPosts, err = ss.FileInfo().GetForUser(userId2) + userPosts, err = ss.FileInfo().GetForUser(userID2) require.NoError(t, err) assert.Len(t, userPosts, 1) } @@ -308,24 +308,24 @@ func testFileInfoGetWithOptions(t *testing.T, rctx request.CTX, ss store.Store) return fileInfo } - userId1 := model.NewId() - userId2 := model.NewId() + userID1 := model.NewId() + userID2 := model.NewId() - channelId1 := model.NewId() - channelId2 := model.NewId() - channelId3 := model.NewId() + channelID1 := model.NewId() + channelID2 := model.NewId() + channelID3 := model.NewId() - post1_1 := makePost(channelId1, userId1) // post 1 by user 1 - post1_2 := makePost(channelId3, userId1) // post 2 by user 1 - post2_1 := makePost(channelId2, userId2) - post2_2 := makePost(channelId3, userId2) + post1_1 := makePost(channelID1, userID1) // post 1 by user 1 + post1_2 := makePost(channelID3, userID1) // post 2 by user 1 + post2_1 := makePost(channelID2, userID2) + post2_2 := makePost(channelID3, userID2) epoch := time.Date(2020, 1, 1, 1, 1, 1, 1, time.UTC) - file1_1 := makeFile(post1_1, userId1, epoch.AddDate(0, 0, 1).Unix(), "a") // file 1 by user 1 - file1_2 := makeFile(post1_2, userId1, epoch.AddDate(0, 0, 2).Unix(), "b") // file 2 by user 1 - file1_3 := makeFile(&model.Post{}, userId1, epoch.AddDate(0, 0, 3).Unix(), "c") // file that is not attached to a post - file2_1 := makeFile(post2_1, userId2, epoch.AddDate(0, 0, 4).Unix(), "d") // file 2 by user 1 - file2_2 := makeFile(post2_2, userId2, epoch.AddDate(0, 0, 5).Unix(), "e") + file1_1 := makeFile(post1_1, userID1, epoch.AddDate(0, 0, 1).Unix(), "a") // file 1 by user 1 + file1_2 := makeFile(post1_2, userID1, epoch.AddDate(0, 0, 2).Unix(), "b") // file 2 by user 1 + file1_3 := makeFile(&model.Post{}, userID1, epoch.AddDate(0, 0, 3).Unix(), "c") // file that is not attached to a post + file2_1 := makeFile(post2_1, userID2, epoch.AddDate(0, 0, 4).Unix(), "d") // file 2 by user 1 + file2_2 := makeFile(post2_2, userID2, epoch.AddDate(0, 0, 5).Unix(), "e") // delete a file _, err := ss.FileInfo().DeleteForPost(rctx, file2_2.PostId) @@ -357,7 +357,7 @@ func testFileInfoGetWithOptions(t *testing.T, rctx request.CTX, ss store.Store) PerPage: 10, Opt: &model.GetFileInfosOptions{ IncludeDeleted: true, - ChannelIds: []string{channelId3}, + ChannelIds: []string{channelID3}, }, ExpectedFileIds: []string{file1_2.Id, file2_2.Id}, }, @@ -367,8 +367,8 @@ func testFileInfoGetWithOptions(t *testing.T, rctx request.CTX, ss store.Store) PerPage: 10, Opt: &model.GetFileInfosOptions{ IncludeDeleted: true, - UserIds: []string{userId1}, - ChannelIds: []string{channelId3}, + UserIds: []string{userID1}, + ChannelIds: []string{channelID3}, }, ExpectedFileIds: []string{file1_2.Id}, }, @@ -387,7 +387,7 @@ func testFileInfoGetWithOptions(t *testing.T, rctx request.CTX, ss store.Store) Page: 0, PerPage: 10, Opt: &model.GetFileInfosOptions{ - UserIds: []string{userId1}, + UserIds: []string{userID1}, SortBy: model.FileinfoSortByCreated, SortDescending: true, }, @@ -418,25 +418,25 @@ func testFileInfoGetWithOptions(t *testing.T, rctx request.CTX, ss store.Store) } } -type byFileInfoId []*model.FileInfo +type byFileInfoID []*model.FileInfo -func (a byFileInfoId) Len() int { return len(a) } -func (a byFileInfoId) Swap(i, j int) { a[i], a[j] = a[j], a[i] } -func (a byFileInfoId) Less(i, j int) bool { return a[i].Id < a[j].Id } +func (a byFileInfoID) Len() int { return len(a) } +func (a byFileInfoID) Swap(i, j int) { a[i], a[j] = a[j], a[i] } +func (a byFileInfoID) Less(i, j int) bool { return a[i].Id < a[j].Id } func testFileInfoAttachToPost(t *testing.T, rctx request.CTX, ss store.Store) { t.Run("should attach files", func(t *testing.T) { - userId := model.NewId() - postId := model.NewId() - channelId := model.NewId() + userID := model.NewId() + postID := model.NewId() + channelID := model.NewId() info1, err := ss.FileInfo().Save(rctx, &model.FileInfo{ - CreatorId: userId, + CreatorId: userID, Path: "file.txt", }) require.NoError(t, err) info2, err := ss.FileInfo().Save(rctx, &model.FileInfo{ - CreatorId: userId, + CreatorId: userID, Path: "file2.txt", }) require.NoError(t, err) @@ -444,49 +444,49 @@ func testFileInfoAttachToPost(t *testing.T, rctx request.CTX, ss store.Store) { require.Equal(t, "", info1.PostId) require.Equal(t, "", info2.PostId) - err = ss.FileInfo().AttachToPost(rctx, info1.Id, postId, channelId, userId) + err = ss.FileInfo().AttachToPost(rctx, info1.Id, postID, channelID, userID) assert.NoError(t, err) - info1.PostId = postId - info1.ChannelId = channelId + info1.PostId = postID + info1.ChannelId = channelID - err = ss.FileInfo().AttachToPost(rctx, info2.Id, postId, channelId, userId) + err = ss.FileInfo().AttachToPost(rctx, info2.Id, postID, channelID, userID) assert.NoError(t, err) - info2.PostId = postId - info2.ChannelId = channelId + info2.PostId = postID + info2.ChannelId = channelID - data, err := ss.FileInfo().GetForPost(postId, true, false, false) + data, err := ss.FileInfo().GetForPost(postID, true, false, false) require.NoError(t, err) expected := []*model.FileInfo{info1, info2} - sort.Sort(byFileInfoId(expected)) - sort.Sort(byFileInfoId(data)) + sort.Sort(byFileInfoID(expected)) + sort.Sort(byFileInfoID(data)) assert.EqualValues(t, expected, data) }) t.Run("should not attach files to multiple posts", func(t *testing.T) { - userId := model.NewId() - postId := model.NewId() - channelId := model.NewId() + userID := model.NewId() + postID := model.NewId() + channelID := model.NewId() info, err := ss.FileInfo().Save(rctx, &model.FileInfo{ - CreatorId: userId, + CreatorId: userID, Path: "file.txt", }) require.NoError(t, err) require.Equal(t, "", info.PostId) - err = ss.FileInfo().AttachToPost(rctx, info.Id, model.NewId(), channelId, userId) + err = ss.FileInfo().AttachToPost(rctx, info.Id, model.NewId(), channelID, userID) require.NoError(t, err) - err = ss.FileInfo().AttachToPost(rctx, info.Id, postId, channelId, userId) + err = ss.FileInfo().AttachToPost(rctx, info.Id, postID, channelID, userID) require.Error(t, err) }) t.Run("should not attach files owned from a different user", func(t *testing.T) { - userId := model.NewId() - postId := model.NewId() - channelId := model.NewId() + userID := model.NewId() + postID := model.NewId() + channelID := model.NewId() info, err := ss.FileInfo().Save(rctx, &model.FileInfo{ CreatorId: model.NewId(), @@ -496,13 +496,13 @@ func testFileInfoAttachToPost(t *testing.T, rctx request.CTX, ss store.Store) { require.Equal(t, "", info.PostId) - err = ss.FileInfo().AttachToPost(rctx, info.Id, postId, channelId, userId) + err = ss.FileInfo().AttachToPost(rctx, info.Id, postID, channelID, userID) assert.Error(t, err) }) t.Run("should attach files uploaded by nouser", func(t *testing.T) { - postId := model.NewId() - channelId := model.NewId() + postID := model.NewId() + channelID := model.NewId() info, err := ss.FileInfo().Save(rctx, &model.FileInfo{ CreatorId: "nouser", @@ -511,46 +511,46 @@ func testFileInfoAttachToPost(t *testing.T, rctx request.CTX, ss store.Store) { require.NoError(t, err) assert.Equal(t, "", info.PostId) - err = ss.FileInfo().AttachToPost(rctx, info.Id, postId, channelId, model.NewId()) + err = ss.FileInfo().AttachToPost(rctx, info.Id, postID, channelID, model.NewId()) require.NoError(t, err) - data, err := ss.FileInfo().GetForPost(postId, true, false, false) + data, err := ss.FileInfo().GetForPost(postID, true, false, false) require.NoError(t, err) - info.PostId = postId - info.ChannelId = channelId + info.PostId = postID + info.ChannelId = channelID assert.EqualValues(t, []*model.FileInfo{info}, data) }) } func testFileInfoDeleteForPost(t *testing.T, rctx request.CTX, ss store.Store) { - userId := model.NewId() - postId := model.NewId() - channelId := model.NewId() + userID := model.NewId() + postID := model.NewId() + channelID := model.NewId() infos := []*model.FileInfo{ { - PostId: postId, - ChannelId: channelId, - CreatorId: userId, + PostId: postID, + ChannelId: channelID, + CreatorId: userID, Path: "file.txt", }, { - PostId: postId, - ChannelId: channelId, - CreatorId: userId, + PostId: postID, + ChannelId: channelID, + CreatorId: userID, Path: "file.txt", }, { - PostId: postId, - ChannelId: channelId, - CreatorId: userId, + PostId: postID, + ChannelId: channelID, + CreatorId: userID, Path: "file.txt", DeleteAt: 123, }, { PostId: model.NewId(), - ChannelId: channelId, - CreatorId: userId, + ChannelId: channelID, + CreatorId: userID, Path: "file.txt", }, } @@ -564,10 +564,10 @@ func testFileInfoDeleteForPost(t *testing.T, rctx request.CTX, ss store.Store) { }(newInfo.Id) } - _, err := ss.FileInfo().DeleteForPost(rctx, postId) + _, err := ss.FileInfo().DeleteForPost(rctx, postID) require.NoError(t, err) - infos, err = ss.FileInfo().GetForPost(postId, true, false, false) + infos, err = ss.FileInfo().GetForPost(postID, true, false, false) require.NoError(t, err) assert.Empty(t, infos) } @@ -586,12 +586,12 @@ func testFileInfoPermanentDelete(t *testing.T, rctx request.CTX, ss store.Store) } func testFileInfoPermanentDeleteBatch(t *testing.T, rctx request.CTX, ss store.Store) { - postId := model.NewId() - channelId := model.NewId() + postID := model.NewId() + channelID := model.NewId() _, err := ss.FileInfo().Save(rctx, &model.FileInfo{ - PostId: postId, - ChannelId: channelId, + PostId: postID, + ChannelId: channelID, CreatorId: model.NewId(), Path: "file.txt", CreateAt: 1000, @@ -599,8 +599,8 @@ func testFileInfoPermanentDeleteBatch(t *testing.T, rctx request.CTX, ss store.S require.NoError(t, err) _, err = ss.FileInfo().Save(rctx, &model.FileInfo{ - PostId: postId, - ChannelId: channelId, + PostId: postID, + ChannelId: channelID, CreatorId: model.NewId(), Path: "file.txt", CreateAt: 1200, @@ -608,8 +608,8 @@ func testFileInfoPermanentDeleteBatch(t *testing.T, rctx request.CTX, ss store.S require.NoError(t, err) _, err = ss.FileInfo().Save(rctx, &model.FileInfo{ - PostId: postId, - ChannelId: channelId, + PostId: postID, + ChannelId: channelID, CreatorId: model.NewId(), Path: "file.txt", CreateAt: 2000, @@ -617,8 +617,8 @@ func testFileInfoPermanentDeleteBatch(t *testing.T, rctx request.CTX, ss store.S require.NoError(t, err) bookmarkFile, err := ss.FileInfo().Save(rctx, &model.FileInfo{ // should not be deleted - PostId: postId, - ChannelId: channelId, + PostId: postID, + ChannelId: channelID, CreatorId: model.BookmarkFileOwner, Path: "file.txt", CreateAt: 1000, @@ -626,32 +626,32 @@ func testFileInfoPermanentDeleteBatch(t *testing.T, rctx request.CTX, ss store.S defer ss.FileInfo().PermanentDelete(rctx, bookmarkFile.Id) require.NoError(t, err) - postFiles, err := ss.FileInfo().GetForPost(postId, true, false, false) + postFiles, err := ss.FileInfo().GetForPost(postID, true, false, false) require.NoError(t, err) assert.Len(t, postFiles, 4) _, err = ss.FileInfo().PermanentDeleteBatch(rctx, 1500, 1000) require.NoError(t, err) - postFiles, err = ss.FileInfo().GetForPost(postId, true, false, false) + postFiles, err = ss.FileInfo().GetForPost(postID, true, false, false) require.NoError(t, err) assert.Len(t, postFiles, 2) } func testFileInfoPermanentDeleteByUser(t *testing.T, rctx request.CTX, ss store.Store) { - userId := model.NewId() - postId := model.NewId() - channelId := model.NewId() + userID := model.NewId() + postID := model.NewId() + channelID := model.NewId() _, err := ss.FileInfo().Save(rctx, &model.FileInfo{ - PostId: postId, - ChannelId: channelId, - CreatorId: userId, + PostId: postID, + ChannelId: channelID, + CreatorId: userID, Path: "file.txt", }) require.NoError(t, err) - _, err = ss.FileInfo().PermanentDeleteByUser(rctx, userId) + _, err = ss.FileInfo().PermanentDeleteByUser(rctx, userID) require.NoError(t, err) } diff --git a/server/channels/store/storetest/group_store.go b/server/channels/store/storetest/group_store.go index 3e8a2f671220d..a7c76be140dc9 100644 --- a/server/channels/store/storetest/group_store.go +++ b/server/channels/store/storetest/group_store.go @@ -2975,7 +2975,7 @@ func testGetGroupsAssociatedToChannelsByTeam(t *testing.T, rctx request.CTX, ss CompanyName: model.NewId(), AllowOpenInvite: false, InviteId: model.NewId(), - Name: NewTestId(), + Name: NewTestID(), Email: "success+" + model.NewId() + "@simulator.amazonses.com", Type: model.TeamOpen, } @@ -3218,7 +3218,7 @@ func testGetGroupsByTeam(t *testing.T, rctx request.CTX, ss store.Store) { CompanyName: model.NewId(), AllowOpenInvite: false, InviteId: model.NewId(), - Name: NewTestId(), + Name: NewTestID(), Email: "success+" + model.NewId() + "@simulator.amazonses.com", Type: model.TeamOpen, } @@ -3272,7 +3272,7 @@ func testGetGroupsByTeam(t *testing.T, rctx request.CTX, ss store.Store) { CompanyName: model.NewId(), AllowOpenInvite: false, InviteId: model.NewId(), - Name: NewTestId(), + Name: NewTestID(), Email: "success+" + model.NewId() + "@simulator.amazonses.com", Type: model.TeamInvite, } @@ -3464,7 +3464,7 @@ func testGetGroups(t *testing.T, rctx request.CTX, ss store.Store) { CompanyName: model.NewId(), AllowOpenInvite: false, InviteId: model.NewId(), - Name: NewTestId(), + Name: NewTestID(), Email: "success+" + model.NewId() + "@simulator.amazonses.com", Type: model.TeamOpen, GroupConstrained: model.NewPointer(true), @@ -3531,7 +3531,7 @@ func testGetGroups(t *testing.T, rctx request.CTX, ss store.Store) { CompanyName: model.NewId(), AllowOpenInvite: false, InviteId: model.NewId(), - Name: NewTestId(), + Name: NewTestID(), Email: "success+" + model.NewId() + "@simulator.amazonses.com", Type: model.TeamInvite, } @@ -3656,7 +3656,7 @@ func testGetGroups(t *testing.T, rctx request.CTX, ss store.Store) { CompanyName: model.NewId(), AllowOpenInvite: false, InviteId: model.NewId(), - Name: NewTestId(), + Name: NewTestID(), Email: "success+" + model.NewId() + "@simulator.amazonses.com", Type: model.TeamInvite, } @@ -4007,7 +4007,7 @@ func testTeamMembersMinusGroupMembers(t *testing.T, rctx request.CTX, ss store.S CompanyName: model.NewId(), AllowOpenInvite: false, InviteId: model.NewId(), - Name: NewTestId(), + Name: NewTestID(), Email: model.NewId() + "@simulator.amazonses.com", Type: model.TeamOpen, GroupConstrained: model.NewPointer(true), @@ -4475,7 +4475,7 @@ func groupTestAdminRoleGroupsForSyncableMemberTeam(t *testing.T, rctx request.CT team := &model.Team{ DisplayName: "A Name", - Name: NewTestId(), + Name: NewTestID(), Type: model.TeamOpen, } team, nErr := ss.Team().Save(team) @@ -4578,7 +4578,7 @@ func groupTestPermittedSyncableAdminsTeam(t *testing.T, rctx request.CTX, ss sto team := &model.Team{ DisplayName: "A Name", - Name: NewTestId(), + Name: NewTestID(), Type: model.TeamOpen, } team, nErr := ss.Team().Save(team) @@ -5034,7 +5034,7 @@ func groupTestGroupTeamCount(t *testing.T, rctx request.CTX, ss store.Store) { Description: model.NewId(), AllowOpenInvite: false, InviteId: model.NewId(), - Name: NewTestId(), + Name: NewTestID(), Email: model.NewId() + "@simulator.amazonses.com", Type: model.TeamOpen, }) diff --git a/server/channels/store/storetest/mocks/AuditStore.go b/server/channels/store/storetest/mocks/AuditStore.go index addeae46fbd41..e8300a02b6d63 100644 --- a/server/channels/store/storetest/mocks/AuditStore.go +++ b/server/channels/store/storetest/mocks/AuditStore.go @@ -14,9 +14,9 @@ type AuditStore struct { mock.Mock } -// Get provides a mock function with given fields: user_id, offset, limit -func (_m *AuditStore) Get(user_id string, offset int, limit int) (model.Audits, error) { - ret := _m.Called(user_id, offset, limit) +// Get provides a mock function with given fields: userID, offset, limit +func (_m *AuditStore) Get(userID string, offset int, limit int) (model.Audits, error) { + ret := _m.Called(userID, offset, limit) if len(ret) == 0 { panic("no return value specified for Get") @@ -25,10 +25,10 @@ func (_m *AuditStore) Get(user_id string, offset int, limit int) (model.Audits, var r0 model.Audits var r1 error if rf, ok := ret.Get(0).(func(string, int, int) (model.Audits, error)); ok { - return rf(user_id, offset, limit) + return rf(userID, offset, limit) } if rf, ok := ret.Get(0).(func(string, int, int) model.Audits); ok { - r0 = rf(user_id, offset, limit) + r0 = rf(userID, offset, limit) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(model.Audits) @@ -36,7 +36,7 @@ func (_m *AuditStore) Get(user_id string, offset int, limit int) (model.Audits, } if rf, ok := ret.Get(1).(func(string, int, int) error); ok { - r1 = rf(user_id, offset, limit) + r1 = rf(userID, offset, limit) } else { r1 = ret.Error(1) } diff --git a/server/channels/store/storetest/mocks/ChannelBookmarkStore.go b/server/channels/store/storetest/mocks/ChannelBookmarkStore.go index bc1ecb9cf047d..11e0983b3c8aa 100644 --- a/server/channels/store/storetest/mocks/ChannelBookmarkStore.go +++ b/server/channels/store/storetest/mocks/ChannelBookmarkStore.go @@ -14,9 +14,9 @@ type ChannelBookmarkStore struct { mock.Mock } -// Delete provides a mock function with given fields: bookmarkId, deleteFile -func (_m *ChannelBookmarkStore) Delete(bookmarkId string, deleteFile bool) error { - ret := _m.Called(bookmarkId, deleteFile) +// Delete provides a mock function with given fields: bookmarkID, deleteFile +func (_m *ChannelBookmarkStore) Delete(bookmarkID string, deleteFile bool) error { + ret := _m.Called(bookmarkID, deleteFile) if len(ret) == 0 { panic("no return value specified for Delete") @@ -24,7 +24,7 @@ func (_m *ChannelBookmarkStore) Delete(bookmarkId string, deleteFile bool) error var r0 error if rf, ok := ret.Get(0).(func(string, bool) error); ok { - r0 = rf(bookmarkId, deleteFile) + r0 = rf(bookmarkID, deleteFile) } else { r0 = ret.Error(0) } @@ -32,9 +32,9 @@ func (_m *ChannelBookmarkStore) Delete(bookmarkId string, deleteFile bool) error return r0 } -// ErrorIfBookmarkFileInfoAlreadyAttached provides a mock function with given fields: fileId -func (_m *ChannelBookmarkStore) ErrorIfBookmarkFileInfoAlreadyAttached(fileId string) error { - ret := _m.Called(fileId) +// ErrorIfBookmarkFileInfoAlreadyAttached provides a mock function with given fields: fileID +func (_m *ChannelBookmarkStore) ErrorIfBookmarkFileInfoAlreadyAttached(fileID string) error { + ret := _m.Called(fileID) if len(ret) == 0 { panic("no return value specified for ErrorIfBookmarkFileInfoAlreadyAttached") @@ -42,7 +42,7 @@ func (_m *ChannelBookmarkStore) ErrorIfBookmarkFileInfoAlreadyAttached(fileId st var r0 error if rf, ok := ret.Get(0).(func(string) error); ok { - r0 = rf(fileId) + r0 = rf(fileID) } else { r0 = ret.Error(0) } @@ -80,9 +80,9 @@ func (_m *ChannelBookmarkStore) Get(Id string, includeDeleted bool) (*model.Chan return r0, r1 } -// GetBookmarksForChannelSince provides a mock function with given fields: channelId, since -func (_m *ChannelBookmarkStore) GetBookmarksForChannelSince(channelId string, since int64) ([]*model.ChannelBookmarkWithFileInfo, error) { - ret := _m.Called(channelId, since) +// GetBookmarksForChannelSince provides a mock function with given fields: channelID, since +func (_m *ChannelBookmarkStore) GetBookmarksForChannelSince(channelID string, since int64) ([]*model.ChannelBookmarkWithFileInfo, error) { + ret := _m.Called(channelID, since) if len(ret) == 0 { panic("no return value specified for GetBookmarksForChannelSince") @@ -91,10 +91,10 @@ func (_m *ChannelBookmarkStore) GetBookmarksForChannelSince(channelId string, si var r0 []*model.ChannelBookmarkWithFileInfo var r1 error if rf, ok := ret.Get(0).(func(string, int64) ([]*model.ChannelBookmarkWithFileInfo, error)); ok { - return rf(channelId, since) + return rf(channelID, since) } if rf, ok := ret.Get(0).(func(string, int64) []*model.ChannelBookmarkWithFileInfo); ok { - r0 = rf(channelId, since) + r0 = rf(channelID, since) } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]*model.ChannelBookmarkWithFileInfo) @@ -102,7 +102,7 @@ func (_m *ChannelBookmarkStore) GetBookmarksForChannelSince(channelId string, si } if rf, ok := ret.Get(1).(func(string, int64) error); ok { - r1 = rf(channelId, since) + r1 = rf(channelID, since) } else { r1 = ret.Error(1) } @@ -158,9 +158,9 @@ func (_m *ChannelBookmarkStore) Update(bookmark *model.ChannelBookmark) error { return r0 } -// UpdateSortOrder provides a mock function with given fields: bookmarkId, channelId, newIndex -func (_m *ChannelBookmarkStore) UpdateSortOrder(bookmarkId string, channelId string, newIndex int64) ([]*model.ChannelBookmarkWithFileInfo, error) { - ret := _m.Called(bookmarkId, channelId, newIndex) +// UpdateSortOrder provides a mock function with given fields: bookmarkID, channelID, newIndex +func (_m *ChannelBookmarkStore) UpdateSortOrder(bookmarkID string, channelID string, newIndex int64) ([]*model.ChannelBookmarkWithFileInfo, error) { + ret := _m.Called(bookmarkID, channelID, newIndex) if len(ret) == 0 { panic("no return value specified for UpdateSortOrder") @@ -169,10 +169,10 @@ func (_m *ChannelBookmarkStore) UpdateSortOrder(bookmarkId string, channelId str var r0 []*model.ChannelBookmarkWithFileInfo var r1 error if rf, ok := ret.Get(0).(func(string, string, int64) ([]*model.ChannelBookmarkWithFileInfo, error)); ok { - return rf(bookmarkId, channelId, newIndex) + return rf(bookmarkID, channelID, newIndex) } if rf, ok := ret.Get(0).(func(string, string, int64) []*model.ChannelBookmarkWithFileInfo); ok { - r0 = rf(bookmarkId, channelId, newIndex) + r0 = rf(bookmarkID, channelID, newIndex) } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]*model.ChannelBookmarkWithFileInfo) @@ -180,7 +180,7 @@ func (_m *ChannelBookmarkStore) UpdateSortOrder(bookmarkId string, channelId str } if rf, ok := ret.Get(1).(func(string, string, int64) error); ok { - r1 = rf(bookmarkId, channelId, newIndex) + r1 = rf(bookmarkID, channelID, newIndex) } else { r1 = ret.Error(1) } diff --git a/server/channels/store/storetest/mocks/ChannelStore.go b/server/channels/store/storetest/mocks/ChannelStore.go index 4927cd9c0f522..8b5911449f0e0 100644 --- a/server/channels/store/storetest/mocks/ChannelStore.go +++ b/server/channels/store/storetest/mocks/ChannelStore.go @@ -712,9 +712,9 @@ func (_m *ChannelStore) GetAllDirectChannelsForExportAfter(limit int, afterID st return r0, r1 } -// GetByName provides a mock function with given fields: team_id, name, allowFromCache -func (_m *ChannelStore) GetByName(team_id string, name string, allowFromCache bool) (*model.Channel, error) { - ret := _m.Called(team_id, name, allowFromCache) +// GetByName provides a mock function with given fields: teamID, name, allowFromCache +func (_m *ChannelStore) GetByName(teamID string, name string, allowFromCache bool) (*model.Channel, error) { + ret := _m.Called(teamID, name, allowFromCache) if len(ret) == 0 { panic("no return value specified for GetByName") @@ -723,10 +723,10 @@ func (_m *ChannelStore) GetByName(team_id string, name string, allowFromCache bo var r0 *model.Channel var r1 error if rf, ok := ret.Get(0).(func(string, string, bool) (*model.Channel, error)); ok { - return rf(team_id, name, allowFromCache) + return rf(teamID, name, allowFromCache) } if rf, ok := ret.Get(0).(func(string, string, bool) *model.Channel); ok { - r0 = rf(team_id, name, allowFromCache) + r0 = rf(teamID, name, allowFromCache) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*model.Channel) @@ -734,7 +734,7 @@ func (_m *ChannelStore) GetByName(team_id string, name string, allowFromCache bo } if rf, ok := ret.Get(1).(func(string, string, bool) error); ok { - r1 = rf(team_id, name, allowFromCache) + r1 = rf(teamID, name, allowFromCache) } else { r1 = ret.Error(1) } @@ -742,9 +742,9 @@ func (_m *ChannelStore) GetByName(team_id string, name string, allowFromCache bo return r0, r1 } -// GetByNameIncludeDeleted provides a mock function with given fields: team_id, name, allowFromCache -func (_m *ChannelStore) GetByNameIncludeDeleted(team_id string, name string, allowFromCache bool) (*model.Channel, error) { - ret := _m.Called(team_id, name, allowFromCache) +// GetByNameIncludeDeleted provides a mock function with given fields: teamID, name, allowFromCache +func (_m *ChannelStore) GetByNameIncludeDeleted(teamID string, name string, allowFromCache bool) (*model.Channel, error) { + ret := _m.Called(teamID, name, allowFromCache) if len(ret) == 0 { panic("no return value specified for GetByNameIncludeDeleted") @@ -753,10 +753,10 @@ func (_m *ChannelStore) GetByNameIncludeDeleted(team_id string, name string, all var r0 *model.Channel var r1 error if rf, ok := ret.Get(0).(func(string, string, bool) (*model.Channel, error)); ok { - return rf(team_id, name, allowFromCache) + return rf(teamID, name, allowFromCache) } if rf, ok := ret.Get(0).(func(string, string, bool) *model.Channel); ok { - r0 = rf(team_id, name, allowFromCache) + r0 = rf(teamID, name, allowFromCache) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*model.Channel) @@ -764,7 +764,7 @@ func (_m *ChannelStore) GetByNameIncludeDeleted(team_id string, name string, all } if rf, ok := ret.Get(1).(func(string, string, bool) error); ok { - r1 = rf(team_id, name, allowFromCache) + r1 = rf(teamID, name, allowFromCache) } else { r1 = ret.Error(1) } @@ -772,9 +772,9 @@ func (_m *ChannelStore) GetByNameIncludeDeleted(team_id string, name string, all return r0, r1 } -// GetByNames provides a mock function with given fields: team_id, names, allowFromCache -func (_m *ChannelStore) GetByNames(team_id string, names []string, allowFromCache bool) ([]*model.Channel, error) { - ret := _m.Called(team_id, names, allowFromCache) +// GetByNames provides a mock function with given fields: teamID, names, allowFromCache +func (_m *ChannelStore) GetByNames(teamID string, names []string, allowFromCache bool) ([]*model.Channel, error) { + ret := _m.Called(teamID, names, allowFromCache) if len(ret) == 0 { panic("no return value specified for GetByNames") @@ -783,10 +783,10 @@ func (_m *ChannelStore) GetByNames(team_id string, names []string, allowFromCach var r0 []*model.Channel var r1 error if rf, ok := ret.Get(0).(func(string, []string, bool) ([]*model.Channel, error)); ok { - return rf(team_id, names, allowFromCache) + return rf(teamID, names, allowFromCache) } if rf, ok := ret.Get(0).(func(string, []string, bool) []*model.Channel); ok { - r0 = rf(team_id, names, allowFromCache) + r0 = rf(teamID, names, allowFromCache) } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]*model.Channel) @@ -794,7 +794,7 @@ func (_m *ChannelStore) GetByNames(team_id string, names []string, allowFromCach } if rf, ok := ret.Get(1).(func(string, []string, bool) error); ok { - r1 = rf(team_id, names, allowFromCache) + r1 = rf(teamID, names, allowFromCache) } else { r1 = ret.Error(1) } @@ -802,9 +802,9 @@ func (_m *ChannelStore) GetByNames(team_id string, names []string, allowFromCach return r0, r1 } -// GetByNamesIncludeDeleted provides a mock function with given fields: team_id, names, allowFromCache -func (_m *ChannelStore) GetByNamesIncludeDeleted(team_id string, names []string, allowFromCache bool) ([]*model.Channel, error) { - ret := _m.Called(team_id, names, allowFromCache) +// GetByNamesIncludeDeleted provides a mock function with given fields: teamID, names, allowFromCache +func (_m *ChannelStore) GetByNamesIncludeDeleted(teamID string, names []string, allowFromCache bool) ([]*model.Channel, error) { + ret := _m.Called(teamID, names, allowFromCache) if len(ret) == 0 { panic("no return value specified for GetByNamesIncludeDeleted") @@ -813,10 +813,10 @@ func (_m *ChannelStore) GetByNamesIncludeDeleted(team_id string, names []string, var r0 []*model.Channel var r1 error if rf, ok := ret.Get(0).(func(string, []string, bool) ([]*model.Channel, error)); ok { - return rf(team_id, names, allowFromCache) + return rf(teamID, names, allowFromCache) } if rf, ok := ret.Get(0).(func(string, []string, bool) []*model.Channel); ok { - r0 = rf(team_id, names, allowFromCache) + r0 = rf(teamID, names, allowFromCache) } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]*model.Channel) @@ -824,7 +824,7 @@ func (_m *ChannelStore) GetByNamesIncludeDeleted(team_id string, names []string, } if rf, ok := ret.Get(1).(func(string, []string, bool) error); ok { - r1 = rf(team_id, names, allowFromCache) + r1 = rf(teamID, names, allowFromCache) } else { r1 = ret.Error(1) } @@ -1210,9 +1210,9 @@ func (_m *ChannelStore) GetChannelsWithUnreadsAndWithMentions(ctx context.Contex return r0, r1, r2, r3 } -// 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) { - ret := _m.Called(team_id, offset, limit, userID) +// GetDeleted provides a mock function with given fields: teamID, offset, limit, userID +func (_m *ChannelStore) GetDeleted(teamID string, offset int, limit int, userID string) (model.ChannelList, error) { + ret := _m.Called(teamID, offset, limit, userID) if len(ret) == 0 { panic("no return value specified for GetDeleted") @@ -1221,10 +1221,10 @@ func (_m *ChannelStore) GetDeleted(team_id string, offset int, limit int, userID var r0 model.ChannelList var r1 error if rf, ok := ret.Get(0).(func(string, int, int, string) (model.ChannelList, error)); ok { - return rf(team_id, offset, limit, userID) + return rf(teamID, offset, limit, userID) } if rf, ok := ret.Get(0).(func(string, int, int, string) model.ChannelList); ok { - r0 = rf(team_id, offset, limit, userID) + r0 = rf(teamID, offset, limit, userID) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(model.ChannelList) @@ -1232,7 +1232,7 @@ func (_m *ChannelStore) GetDeleted(team_id string, offset int, limit int, userID } if rf, ok := ret.Get(1).(func(string, int, int, string) error); ok { - r1 = rf(team_id, offset, limit, userID) + r1 = rf(teamID, offset, limit, userID) } else { r1 = ret.Error(1) } @@ -1240,9 +1240,9 @@ func (_m *ChannelStore) GetDeleted(team_id string, offset int, limit int, userID return r0, r1 } -// GetDeletedByName provides a mock function with given fields: team_id, name -func (_m *ChannelStore) GetDeletedByName(team_id string, name string) (*model.Channel, error) { - ret := _m.Called(team_id, name) +// GetDeletedByName provides a mock function with given fields: teamID, name +func (_m *ChannelStore) GetDeletedByName(teamID string, name string) (*model.Channel, error) { + ret := _m.Called(teamID, name) if len(ret) == 0 { panic("no return value specified for GetDeletedByName") @@ -1251,10 +1251,10 @@ func (_m *ChannelStore) GetDeletedByName(team_id string, name string) (*model.Ch var r0 *model.Channel var r1 error if rf, ok := ret.Get(0).(func(string, string) (*model.Channel, error)); ok { - return rf(team_id, name) + return rf(teamID, name) } if rf, ok := ret.Get(0).(func(string, string) *model.Channel); ok { - r0 = rf(team_id, name) + r0 = rf(teamID, name) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*model.Channel) @@ -1262,7 +1262,7 @@ func (_m *ChannelStore) GetDeletedByName(team_id string, name string) (*model.Ch } if rf, ok := ret.Get(1).(func(string, string) error); ok { - r1 = rf(team_id, name) + r1 = rf(teamID, name) } else { r1 = ret.Error(1) } @@ -2802,9 +2802,9 @@ func (_m *ChannelStore) SetDeleteAt(channelID string, deleteAt int64, updateAt i return r0 } -// SetShared provides a mock function with given fields: channelId, shared -func (_m *ChannelStore) SetShared(channelId string, shared bool) error { - ret := _m.Called(channelId, shared) +// SetShared provides a mock function with given fields: channelID, shared +func (_m *ChannelStore) SetShared(channelID string, shared bool) error { + ret := _m.Called(channelID, shared) if len(ret) == 0 { panic("no return value specified for SetShared") @@ -2812,7 +2812,7 @@ func (_m *ChannelStore) SetShared(channelId string, shared bool) error { var r0 error if rf, ok := ret.Get(0).(func(string, bool) error); ok { - r0 = rf(channelId, shared) + r0 = rf(channelID, shared) } else { r0 = ret.Error(0) } diff --git a/server/channels/store/storetest/mocks/DesktopTokensStore.go b/server/channels/store/storetest/mocks/DesktopTokensStore.go index 84d3a9ee652ec..6b1b997ac6ec5 100644 --- a/server/channels/store/storetest/mocks/DesktopTokensStore.go +++ b/server/channels/store/storetest/mocks/DesktopTokensStore.go @@ -29,9 +29,9 @@ func (_m *DesktopTokensStore) Delete(token string) error { return r0 } -// DeleteByUserId provides a mock function with given fields: userId -func (_m *DesktopTokensStore) DeleteByUserId(userId string) error { - ret := _m.Called(userId) +// DeleteByUserId provides a mock function with given fields: userID +func (_m *DesktopTokensStore) DeleteByUserId(userID string) error { + ret := _m.Called(userID) if len(ret) == 0 { panic("no return value specified for DeleteByUserId") @@ -39,7 +39,7 @@ func (_m *DesktopTokensStore) DeleteByUserId(userId string) error { var r0 error if rf, ok := ret.Get(0).(func(string) error); ok { - r0 = rf(userId) + r0 = rf(userID) } else { r0 = ret.Error(0) } @@ -95,9 +95,9 @@ func (_m *DesktopTokensStore) GetUserId(token string, minCreatedAt int64) (*stri return r0, r1 } -// Insert provides a mock function with given fields: token, createAt, userId -func (_m *DesktopTokensStore) Insert(token string, createAt int64, userId string) error { - ret := _m.Called(token, createAt, userId) +// Insert provides a mock function with given fields: token, createAt, userID +func (_m *DesktopTokensStore) Insert(token string, createAt int64, userID string) error { + ret := _m.Called(token, createAt, userID) if len(ret) == 0 { panic("no return value specified for Insert") @@ -105,7 +105,7 @@ func (_m *DesktopTokensStore) Insert(token string, createAt int64, userId string var r0 error if rf, ok := ret.Get(0).(func(string, int64, string) error); ok { - r0 = rf(token, createAt, userId) + r0 = rf(token, createAt, userID) } else { r0 = ret.Error(0) } diff --git a/server/channels/store/storetest/mocks/DraftStore.go b/server/channels/store/storetest/mocks/DraftStore.go index c7309bcbbf98b..82ff38a2f25a4 100644 --- a/server/channels/store/storetest/mocks/DraftStore.go +++ b/server/channels/store/storetest/mocks/DraftStore.go @@ -50,9 +50,9 @@ func (_m *DraftStore) DeleteDraftsAssociatedWithPost(channelID string, rootID st return r0 } -// DeleteEmptyDraftsByCreateAtAndUserId provides a mock function with given fields: createAt, userId -func (_m *DraftStore) DeleteEmptyDraftsByCreateAtAndUserId(createAt int64, userId string) error { - ret := _m.Called(createAt, userId) +// DeleteEmptyDraftsByCreateAtAndUserId provides a mock function with given fields: createAt, userID +func (_m *DraftStore) DeleteEmptyDraftsByCreateAtAndUserId(createAt int64, userID string) error { + ret := _m.Called(createAt, userID) if len(ret) == 0 { panic("no return value specified for DeleteEmptyDraftsByCreateAtAndUserId") @@ -60,7 +60,7 @@ func (_m *DraftStore) DeleteEmptyDraftsByCreateAtAndUserId(createAt int64, userI var r0 error if rf, ok := ret.Get(0).(func(int64, string) error); ok { - r0 = rf(createAt, userId) + r0 = rf(createAt, userID) } else { r0 = ret.Error(0) } @@ -68,9 +68,9 @@ func (_m *DraftStore) DeleteEmptyDraftsByCreateAtAndUserId(createAt int64, userI return r0 } -// DeleteOrphanDraftsByCreateAtAndUserId provides a mock function with given fields: createAt, userId -func (_m *DraftStore) DeleteOrphanDraftsByCreateAtAndUserId(createAt int64, userId string) error { - ret := _m.Called(createAt, userId) +// DeleteOrphanDraftsByCreateAtAndUserId provides a mock function with given fields: createAt, userID +func (_m *DraftStore) DeleteOrphanDraftsByCreateAtAndUserId(createAt int64, userID string) error { + ret := _m.Called(createAt, userID) if len(ret) == 0 { panic("no return value specified for DeleteOrphanDraftsByCreateAtAndUserId") @@ -78,7 +78,7 @@ func (_m *DraftStore) DeleteOrphanDraftsByCreateAtAndUserId(createAt int64, user var r0 error if rf, ok := ret.Get(0).(func(int64, string) error); ok { - r0 = rf(createAt, userId) + r0 = rf(createAt, userID) } else { r0 = ret.Error(0) } @@ -146,9 +146,9 @@ func (_m *DraftStore) GetDraftsForUser(userID string, teamID string) ([]*model.D return r0, r1 } -// GetLastCreateAtAndUserIdValuesForEmptyDraftsMigration provides a mock function with given fields: createAt, userId -func (_m *DraftStore) GetLastCreateAtAndUserIdValuesForEmptyDraftsMigration(createAt int64, userId string) (int64, string, error) { - ret := _m.Called(createAt, userId) +// GetLastCreateAtAndUserIdValuesForEmptyDraftsMigration provides a mock function with given fields: createAt, userID +func (_m *DraftStore) GetLastCreateAtAndUserIdValuesForEmptyDraftsMigration(createAt int64, userID string) (int64, string, error) { + ret := _m.Called(createAt, userID) if len(ret) == 0 { panic("no return value specified for GetLastCreateAtAndUserIdValuesForEmptyDraftsMigration") @@ -158,22 +158,22 @@ func (_m *DraftStore) GetLastCreateAtAndUserIdValuesForEmptyDraftsMigration(crea var r1 string var r2 error if rf, ok := ret.Get(0).(func(int64, string) (int64, string, error)); ok { - return rf(createAt, userId) + return rf(createAt, userID) } if rf, ok := ret.Get(0).(func(int64, string) int64); ok { - r0 = rf(createAt, userId) + r0 = rf(createAt, userID) } else { r0 = ret.Get(0).(int64) } if rf, ok := ret.Get(1).(func(int64, string) string); ok { - r1 = rf(createAt, userId) + r1 = rf(createAt, userID) } else { r1 = ret.Get(1).(string) } if rf, ok := ret.Get(2).(func(int64, string) error); ok { - r2 = rf(createAt, userId) + r2 = rf(createAt, userID) } else { r2 = ret.Error(2) } diff --git a/server/channels/store/storetest/mocks/NotifyAdminStore.go b/server/channels/store/storetest/mocks/NotifyAdminStore.go index e6b1349112f25..622e281332cef 100644 --- a/server/channels/store/storetest/mocks/NotifyAdminStore.go +++ b/server/channels/store/storetest/mocks/NotifyAdminStore.go @@ -62,9 +62,9 @@ func (_m *NotifyAdminStore) Get(trial bool) ([]*model.NotifyAdminData, error) { return r0, r1 } -// GetDataByUserIdAndFeature provides a mock function with given fields: userId, feature -func (_m *NotifyAdminStore) GetDataByUserIdAndFeature(userId string, feature model.MattermostFeature) ([]*model.NotifyAdminData, error) { - ret := _m.Called(userId, feature) +// GetDataByUserIdAndFeature provides a mock function with given fields: userID, feature +func (_m *NotifyAdminStore) GetDataByUserIdAndFeature(userID string, feature model.MattermostFeature) ([]*model.NotifyAdminData, error) { + ret := _m.Called(userID, feature) if len(ret) == 0 { panic("no return value specified for GetDataByUserIdAndFeature") @@ -73,10 +73,10 @@ func (_m *NotifyAdminStore) GetDataByUserIdAndFeature(userId string, feature mod var r0 []*model.NotifyAdminData var r1 error if rf, ok := ret.Get(0).(func(string, model.MattermostFeature) ([]*model.NotifyAdminData, error)); ok { - return rf(userId, feature) + return rf(userID, feature) } if rf, ok := ret.Get(0).(func(string, model.MattermostFeature) []*model.NotifyAdminData); ok { - r0 = rf(userId, feature) + r0 = rf(userID, feature) } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]*model.NotifyAdminData) @@ -84,7 +84,7 @@ func (_m *NotifyAdminStore) GetDataByUserIdAndFeature(userId string, feature mod } if rf, ok := ret.Get(1).(func(string, model.MattermostFeature) error); ok { - r1 = rf(userId, feature) + r1 = rf(userID, feature) } else { r1 = ret.Error(1) } @@ -122,9 +122,9 @@ func (_m *NotifyAdminStore) Save(data *model.NotifyAdminData) (*model.NotifyAdmi return r0, r1 } -// Update provides a mock function with given fields: userId, requiredPlan, requiredFeature, now -func (_m *NotifyAdminStore) Update(userId string, requiredPlan string, requiredFeature model.MattermostFeature, now int64) error { - ret := _m.Called(userId, requiredPlan, requiredFeature, now) +// Update provides a mock function with given fields: userID, requiredPlan, requiredFeature, now +func (_m *NotifyAdminStore) Update(userID string, requiredPlan string, requiredFeature model.MattermostFeature, now int64) error { + ret := _m.Called(userID, requiredPlan, requiredFeature, now) if len(ret) == 0 { panic("no return value specified for Update") @@ -132,7 +132,7 @@ func (_m *NotifyAdminStore) Update(userId string, requiredPlan string, requiredF var r0 error if rf, ok := ret.Get(0).(func(string, string, model.MattermostFeature, int64) error); ok { - r0 = rf(userId, requiredPlan, requiredFeature, now) + r0 = rf(userID, requiredPlan, requiredFeature, now) } else { r0 = ret.Error(0) } diff --git a/server/channels/store/storetest/mocks/OAuthStore.go b/server/channels/store/storetest/mocks/OAuthStore.go index a73b019989fb9..c1158111ff87d 100644 --- a/server/channels/store/storetest/mocks/OAuthStore.go +++ b/server/channels/store/storetest/mocks/OAuthStore.go @@ -92,9 +92,9 @@ func (_m *OAuthStore) GetAccessDataByRefreshToken(token string) (*model.AccessDa return r0, r1 } -// GetAccessDataByUserForApp provides a mock function with given fields: userID, clientId -func (_m *OAuthStore) GetAccessDataByUserForApp(userID string, clientId string) ([]*model.AccessData, error) { - ret := _m.Called(userID, clientId) +// GetAccessDataByUserForApp provides a mock function with given fields: userID, clientID +func (_m *OAuthStore) GetAccessDataByUserForApp(userID string, clientID string) ([]*model.AccessData, error) { + ret := _m.Called(userID, clientID) if len(ret) == 0 { panic("no return value specified for GetAccessDataByUserForApp") @@ -103,10 +103,10 @@ func (_m *OAuthStore) GetAccessDataByUserForApp(userID string, clientId string) var r0 []*model.AccessData var r1 error if rf, ok := ret.Get(0).(func(string, string) ([]*model.AccessData, error)); ok { - return rf(userID, clientId) + return rf(userID, clientID) } if rf, ok := ret.Get(0).(func(string, string) []*model.AccessData); ok { - r0 = rf(userID, clientId) + r0 = rf(userID, clientID) } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]*model.AccessData) @@ -114,7 +114,7 @@ func (_m *OAuthStore) GetAccessDataByUserForApp(userID string, clientId string) } if rf, ok := ret.Get(1).(func(string, string) error); ok { - r1 = rf(userID, clientId) + r1 = rf(userID, clientID) } else { r1 = ret.Error(1) } @@ -272,9 +272,9 @@ func (_m *OAuthStore) GetAuthorizedApps(userID string, offset int, limit int) ([ return r0, r1 } -// GetPreviousAccessData provides a mock function with given fields: userID, clientId -func (_m *OAuthStore) GetPreviousAccessData(userID string, clientId string) (*model.AccessData, error) { - ret := _m.Called(userID, clientId) +// GetPreviousAccessData provides a mock function with given fields: userID, clientID +func (_m *OAuthStore) GetPreviousAccessData(userID string, clientID string) (*model.AccessData, error) { + ret := _m.Called(userID, clientID) if len(ret) == 0 { panic("no return value specified for GetPreviousAccessData") @@ -283,10 +283,10 @@ func (_m *OAuthStore) GetPreviousAccessData(userID string, clientId string) (*mo var r0 *model.AccessData var r1 error if rf, ok := ret.Get(0).(func(string, string) (*model.AccessData, error)); ok { - return rf(userID, clientId) + return rf(userID, clientID) } if rf, ok := ret.Get(0).(func(string, string) *model.AccessData); ok { - r0 = rf(userID, clientId) + r0 = rf(userID, clientID) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*model.AccessData) @@ -294,7 +294,7 @@ func (_m *OAuthStore) GetPreviousAccessData(userID string, clientId string) (*mo } if rf, ok := ret.Get(1).(func(string, string) error); ok { - r1 = rf(userID, clientId) + r1 = rf(userID, clientID) } else { r1 = ret.Error(1) } @@ -374,9 +374,9 @@ func (_m *OAuthStore) RemoveAuthData(code string) error { return r0 } -// RemoveAuthDataByClientId provides a mock function with given fields: clientId, userId -func (_m *OAuthStore) RemoveAuthDataByClientId(clientId string, userId string) error { - ret := _m.Called(clientId, userId) +// RemoveAuthDataByClientId provides a mock function with given fields: clientID, userID +func (_m *OAuthStore) RemoveAuthDataByClientId(clientID string, userID string) error { + ret := _m.Called(clientID, userID) if len(ret) == 0 { panic("no return value specified for RemoveAuthDataByClientId") @@ -384,7 +384,7 @@ func (_m *OAuthStore) RemoveAuthDataByClientId(clientId string, userId string) e var r0 error if rf, ok := ret.Get(0).(func(string, string) error); ok { - r0 = rf(clientId, userId) + r0 = rf(clientID, userID) } else { r0 = ret.Error(0) } @@ -392,9 +392,9 @@ func (_m *OAuthStore) RemoveAuthDataByClientId(clientId string, userId string) e return r0 } -// RemoveAuthDataByUserId provides a mock function with given fields: userId -func (_m *OAuthStore) RemoveAuthDataByUserId(userId string) error { - ret := _m.Called(userId) +// RemoveAuthDataByUserId provides a mock function with given fields: userID +func (_m *OAuthStore) RemoveAuthDataByUserId(userID string) error { + ret := _m.Called(userID) if len(ret) == 0 { panic("no return value specified for RemoveAuthDataByUserId") @@ -402,7 +402,7 @@ func (_m *OAuthStore) RemoveAuthDataByUserId(userId string) error { var r0 error if rf, ok := ret.Get(0).(func(string) error); ok { - r0 = rf(userId) + r0 = rf(userID) } else { r0 = ret.Error(0) } diff --git a/server/channels/store/storetest/mocks/PostPriorityStore.go b/server/channels/store/storetest/mocks/PostPriorityStore.go index c4a0deb0e4ab1..a3d351d3896b5 100644 --- a/server/channels/store/storetest/mocks/PostPriorityStore.go +++ b/server/channels/store/storetest/mocks/PostPriorityStore.go @@ -14,9 +14,9 @@ type PostPriorityStore struct { mock.Mock } -// GetForPost provides a mock function with given fields: postId -func (_m *PostPriorityStore) GetForPost(postId string) (*model.PostPriority, error) { - ret := _m.Called(postId) +// GetForPost provides a mock function with given fields: postID +func (_m *PostPriorityStore) GetForPost(postID string) (*model.PostPriority, error) { + ret := _m.Called(postID) if len(ret) == 0 { panic("no return value specified for GetForPost") @@ -25,10 +25,10 @@ func (_m *PostPriorityStore) GetForPost(postId string) (*model.PostPriority, err var r0 *model.PostPriority var r1 error if rf, ok := ret.Get(0).(func(string) (*model.PostPriority, error)); ok { - return rf(postId) + return rf(postID) } if rf, ok := ret.Get(0).(func(string) *model.PostPriority); ok { - r0 = rf(postId) + r0 = rf(postID) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*model.PostPriority) @@ -36,7 +36,7 @@ func (_m *PostPriorityStore) GetForPost(postId string) (*model.PostPriority, err } if rf, ok := ret.Get(1).(func(string) error); ok { - r1 = rf(postId) + r1 = rf(postID) } else { r1 = ret.Error(1) } diff --git a/server/channels/store/storetest/mocks/PostStore.go b/server/channels/store/storetest/mocks/PostStore.go index eeee213fa95d8..4d74b5e3768ba 100644 --- a/server/channels/store/storetest/mocks/PostStore.go +++ b/server/channels/store/storetest/mocks/PostStore.go @@ -191,9 +191,9 @@ func (_m *PostStore) GetDirectPostParentsForExportAfter(limit int, afterID strin return r0, r1 } -// GetEditHistoryForPost provides a mock function with given fields: postId -func (_m *PostStore) GetEditHistoryForPost(postId string) ([]*model.Post, error) { - ret := _m.Called(postId) +// GetEditHistoryForPost provides a mock function with given fields: postID +func (_m *PostStore) GetEditHistoryForPost(postID string) ([]*model.Post, error) { + ret := _m.Called(postID) if len(ret) == 0 { panic("no return value specified for GetEditHistoryForPost") @@ -202,10 +202,10 @@ func (_m *PostStore) GetEditHistoryForPost(postId string) ([]*model.Post, error) var r0 []*model.Post var r1 error if rf, ok := ret.Get(0).(func(string) ([]*model.Post, error)); ok { - return rf(postId) + return rf(postID) } if rf, ok := ret.Get(0).(func(string) []*model.Post); ok { - r0 = rf(postId) + r0 = rf(postID) } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]*model.Post) @@ -213,7 +213,7 @@ func (_m *PostStore) GetEditHistoryForPost(postId string) ([]*model.Post, error) } if rf, ok := ret.Get(1).(func(string) error); ok { - r1 = rf(postId) + r1 = rf(postID) } else { r1 = ret.Error(1) } @@ -946,9 +946,9 @@ func (_m *PostStore) GetSingle(rctx request.CTX, id string, inclDeleted bool) (* return r0, r1 } -// HasAutoResponsePostByUserSince provides a mock function with given fields: options, userId -func (_m *PostStore) HasAutoResponsePostByUserSince(options model.GetPostsSinceOptions, userId string) (bool, error) { - ret := _m.Called(options, userId) +// HasAutoResponsePostByUserSince provides a mock function with given fields: options, userID +func (_m *PostStore) HasAutoResponsePostByUserSince(options model.GetPostsSinceOptions, userID string) (bool, error) { + ret := _m.Called(options, userID) if len(ret) == 0 { panic("no return value specified for HasAutoResponsePostByUserSince") @@ -957,16 +957,16 @@ func (_m *PostStore) HasAutoResponsePostByUserSince(options model.GetPostsSinceO var r0 bool var r1 error if rf, ok := ret.Get(0).(func(model.GetPostsSinceOptions, string) (bool, error)); ok { - return rf(options, userId) + return rf(options, userID) } if rf, ok := ret.Get(0).(func(model.GetPostsSinceOptions, string) bool); ok { - r0 = rf(options, userId) + r0 = rf(options, userID) } else { r0 = ret.Get(0).(bool) } if rf, ok := ret.Get(1).(func(model.GetPostsSinceOptions, string) error); ok { - r1 = rf(options, userId) + r1 = rf(options, userID) } else { r1 = ret.Error(1) } diff --git a/server/channels/store/storetest/mocks/ReactionStore.go b/server/channels/store/storetest/mocks/ReactionStore.go index 5f8c2e8fa8400..c55748f3f4471 100644 --- a/server/channels/store/storetest/mocks/ReactionStore.go +++ b/server/channels/store/storetest/mocks/ReactionStore.go @@ -120,9 +120,9 @@ func (_m *ReactionStore) DeleteOrphanedRowsByIds(r *model.RetentionIdsForDeletio return r0, r1 } -// ExistsOnPost provides a mock function with given fields: postId, emojiName -func (_m *ReactionStore) ExistsOnPost(postId string, emojiName string) (bool, error) { - ret := _m.Called(postId, emojiName) +// ExistsOnPost provides a mock function with given fields: postID, emojiName +func (_m *ReactionStore) ExistsOnPost(postID string, emojiName string) (bool, error) { + ret := _m.Called(postID, emojiName) if len(ret) == 0 { panic("no return value specified for ExistsOnPost") @@ -131,16 +131,16 @@ func (_m *ReactionStore) ExistsOnPost(postId string, emojiName string) (bool, er var r0 bool var r1 error if rf, ok := ret.Get(0).(func(string, string) (bool, error)); ok { - return rf(postId, emojiName) + return rf(postID, emojiName) } if rf, ok := ret.Get(0).(func(string, string) bool); ok { - r0 = rf(postId, emojiName) + r0 = rf(postID, emojiName) } else { r0 = ret.Get(0).(bool) } if rf, ok := ret.Get(1).(func(string, string) error); ok { - r1 = rf(postId, emojiName) + r1 = rf(postID, emojiName) } else { r1 = ret.Error(1) } @@ -178,9 +178,9 @@ func (_m *ReactionStore) GetForPost(postID string, allowFromCache bool) ([]*mode return r0, r1 } -// GetForPostSince provides a mock function with given fields: postId, since, excludeRemoteId, inclDeleted -func (_m *ReactionStore) GetForPostSince(postId string, since int64, excludeRemoteId string, inclDeleted bool) ([]*model.Reaction, error) { - ret := _m.Called(postId, since, excludeRemoteId, inclDeleted) +// GetForPostSince provides a mock function with given fields: postID, since, excludeRemoteID, inclDeleted +func (_m *ReactionStore) GetForPostSince(postID string, since int64, excludeRemoteID string, inclDeleted bool) ([]*model.Reaction, error) { + ret := _m.Called(postID, since, excludeRemoteID, inclDeleted) if len(ret) == 0 { panic("no return value specified for GetForPostSince") @@ -189,10 +189,10 @@ func (_m *ReactionStore) GetForPostSince(postId string, since int64, excludeRemo var r0 []*model.Reaction var r1 error if rf, ok := ret.Get(0).(func(string, int64, string, bool) ([]*model.Reaction, error)); ok { - return rf(postId, since, excludeRemoteId, inclDeleted) + return rf(postID, since, excludeRemoteID, inclDeleted) } if rf, ok := ret.Get(0).(func(string, int64, string, bool) []*model.Reaction); ok { - r0 = rf(postId, since, excludeRemoteId, inclDeleted) + r0 = rf(postID, since, excludeRemoteID, inclDeleted) } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]*model.Reaction) @@ -200,7 +200,7 @@ func (_m *ReactionStore) GetForPostSince(postId string, since int64, excludeRemo } if rf, ok := ret.Get(1).(func(string, int64, string, bool) error); ok { - r1 = rf(postId, since, excludeRemoteId, inclDeleted) + r1 = rf(postID, since, excludeRemoteID, inclDeleted) } else { r1 = ret.Error(1) } @@ -238,9 +238,9 @@ func (_m *ReactionStore) GetSingle(userID string, postID string, remoteID string return r0, r1 } -// GetUniqueCountForPost provides a mock function with given fields: postId -func (_m *ReactionStore) GetUniqueCountForPost(postId string) (int, error) { - ret := _m.Called(postId) +// GetUniqueCountForPost provides a mock function with given fields: postID +func (_m *ReactionStore) GetUniqueCountForPost(postID string) (int, error) { + ret := _m.Called(postID) if len(ret) == 0 { panic("no return value specified for GetUniqueCountForPost") @@ -249,16 +249,16 @@ func (_m *ReactionStore) GetUniqueCountForPost(postId string) (int, error) { var r0 int var r1 error if rf, ok := ret.Get(0).(func(string) (int, error)); ok { - return rf(postId) + return rf(postID) } if rf, ok := ret.Get(0).(func(string) int); ok { - r0 = rf(postId) + r0 = rf(postID) } else { r0 = ret.Get(0).(int) } if rf, ok := ret.Get(1).(func(string) error); ok { - r1 = rf(postId) + r1 = rf(postID) } else { r1 = ret.Error(1) } diff --git a/server/channels/store/storetest/mocks/RemoteClusterStore.go b/server/channels/store/storetest/mocks/RemoteClusterStore.go index ad65c28c9930d..be8024454491c 100644 --- a/server/channels/store/storetest/mocks/RemoteClusterStore.go +++ b/server/channels/store/storetest/mocks/RemoteClusterStore.go @@ -14,9 +14,9 @@ type RemoteClusterStore struct { mock.Mock } -// Delete provides a mock function with given fields: remoteClusterId -func (_m *RemoteClusterStore) Delete(remoteClusterId string) (bool, error) { - ret := _m.Called(remoteClusterId) +// Delete provides a mock function with given fields: remoteClusterID +func (_m *RemoteClusterStore) Delete(remoteClusterID string) (bool, error) { + ret := _m.Called(remoteClusterID) if len(ret) == 0 { panic("no return value specified for Delete") @@ -25,16 +25,16 @@ func (_m *RemoteClusterStore) Delete(remoteClusterId string) (bool, error) { var r0 bool var r1 error if rf, ok := ret.Get(0).(func(string) (bool, error)); ok { - return rf(remoteClusterId) + return rf(remoteClusterID) } if rf, ok := ret.Get(0).(func(string) bool); ok { - r0 = rf(remoteClusterId) + r0 = rf(remoteClusterID) } else { r0 = ret.Get(0).(bool) } if rf, ok := ret.Get(1).(func(string) error); ok { - r1 = rf(remoteClusterId) + r1 = rf(remoteClusterID) } else { r1 = ret.Error(1) } @@ -42,9 +42,9 @@ func (_m *RemoteClusterStore) Delete(remoteClusterId string) (bool, error) { return r0, r1 } -// Get provides a mock function with given fields: remoteClusterId, includeDeleted -func (_m *RemoteClusterStore) Get(remoteClusterId string, includeDeleted bool) (*model.RemoteCluster, error) { - ret := _m.Called(remoteClusterId, includeDeleted) +// Get provides a mock function with given fields: remoteClusterID, includeDeleted +func (_m *RemoteClusterStore) Get(remoteClusterID string, includeDeleted bool) (*model.RemoteCluster, error) { + ret := _m.Called(remoteClusterID, includeDeleted) if len(ret) == 0 { panic("no return value specified for Get") @@ -53,10 +53,10 @@ func (_m *RemoteClusterStore) Get(remoteClusterId string, includeDeleted bool) ( var r0 *model.RemoteCluster var r1 error if rf, ok := ret.Get(0).(func(string, bool) (*model.RemoteCluster, error)); ok { - return rf(remoteClusterId, includeDeleted) + return rf(remoteClusterID, includeDeleted) } if rf, ok := ret.Get(0).(func(string, bool) *model.RemoteCluster); ok { - r0 = rf(remoteClusterId, includeDeleted) + r0 = rf(remoteClusterID, includeDeleted) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*model.RemoteCluster) @@ -64,7 +64,7 @@ func (_m *RemoteClusterStore) Get(remoteClusterId string, includeDeleted bool) ( } if rf, ok := ret.Get(1).(func(string, bool) error); ok { - r1 = rf(remoteClusterId, includeDeleted) + r1 = rf(remoteClusterID, includeDeleted) } else { r1 = ret.Error(1) } @@ -162,9 +162,9 @@ func (_m *RemoteClusterStore) Save(rc *model.RemoteCluster) (*model.RemoteCluste return r0, r1 } -// SetLastPingAt provides a mock function with given fields: remoteClusterId -func (_m *RemoteClusterStore) SetLastPingAt(remoteClusterId string) error { - ret := _m.Called(remoteClusterId) +// SetLastPingAt provides a mock function with given fields: remoteClusterID +func (_m *RemoteClusterStore) SetLastPingAt(remoteClusterID string) error { + ret := _m.Called(remoteClusterID) if len(ret) == 0 { panic("no return value specified for SetLastPingAt") @@ -172,7 +172,7 @@ func (_m *RemoteClusterStore) SetLastPingAt(remoteClusterId string) error { var r0 error if rf, ok := ret.Get(0).(func(string) error); ok { - r0 = rf(remoteClusterId) + r0 = rf(remoteClusterID) } else { r0 = ret.Error(0) } @@ -210,9 +210,9 @@ func (_m *RemoteClusterStore) Update(rc *model.RemoteCluster) (*model.RemoteClus return r0, r1 } -// UpdateTopics provides a mock function with given fields: remoteClusterId, topics -func (_m *RemoteClusterStore) UpdateTopics(remoteClusterId string, topics string) (*model.RemoteCluster, error) { - ret := _m.Called(remoteClusterId, topics) +// UpdateTopics provides a mock function with given fields: remoteClusterID, topics +func (_m *RemoteClusterStore) UpdateTopics(remoteClusterID string, topics string) (*model.RemoteCluster, error) { + ret := _m.Called(remoteClusterID, topics) if len(ret) == 0 { panic("no return value specified for UpdateTopics") @@ -221,10 +221,10 @@ func (_m *RemoteClusterStore) UpdateTopics(remoteClusterId string, topics string var r0 *model.RemoteCluster var r1 error if rf, ok := ret.Get(0).(func(string, string) (*model.RemoteCluster, error)); ok { - return rf(remoteClusterId, topics) + return rf(remoteClusterID, topics) } if rf, ok := ret.Get(0).(func(string, string) *model.RemoteCluster); ok { - r0 = rf(remoteClusterId, topics) + r0 = rf(remoteClusterID, topics) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*model.RemoteCluster) @@ -232,7 +232,7 @@ func (_m *RemoteClusterStore) UpdateTopics(remoteClusterId string, topics string } if rf, ok := ret.Get(1).(func(string, string) error); ok { - r1 = rf(remoteClusterId, topics) + r1 = rf(remoteClusterID, topics) } else { r1 = ret.Error(1) } diff --git a/server/channels/store/storetest/mocks/RetentionPolicyStore.go b/server/channels/store/storetest/mocks/RetentionPolicyStore.go index 752b1efae0c86..fb0b4a7408715 100644 --- a/server/channels/store/storetest/mocks/RetentionPolicyStore.go +++ b/server/channels/store/storetest/mocks/RetentionPolicyStore.go @@ -14,9 +14,9 @@ type RetentionPolicyStore struct { mock.Mock } -// AddChannels provides a mock function with given fields: policyId, channelIds -func (_m *RetentionPolicyStore) AddChannels(policyId string, channelIds []string) error { - ret := _m.Called(policyId, channelIds) +// AddChannels provides a mock function with given fields: policyID, channelIds +func (_m *RetentionPolicyStore) AddChannels(policyID string, channelIds []string) error { + ret := _m.Called(policyID, channelIds) if len(ret) == 0 { panic("no return value specified for AddChannels") @@ -24,7 +24,7 @@ func (_m *RetentionPolicyStore) AddChannels(policyId string, channelIds []string var r0 error if rf, ok := ret.Get(0).(func(string, []string) error); ok { - r0 = rf(policyId, channelIds) + r0 = rf(policyID, channelIds) } else { r0 = ret.Error(0) } @@ -32,9 +32,9 @@ func (_m *RetentionPolicyStore) AddChannels(policyId string, channelIds []string return r0 } -// AddTeams provides a mock function with given fields: policyId, teamIds -func (_m *RetentionPolicyStore) AddTeams(policyId string, teamIds []string) error { - ret := _m.Called(policyId, teamIds) +// AddTeams provides a mock function with given fields: policyID, teamIds +func (_m *RetentionPolicyStore) AddTeams(policyID string, teamIds []string) error { + ret := _m.Called(policyID, teamIds) if len(ret) == 0 { panic("no return value specified for AddTeams") @@ -42,7 +42,7 @@ func (_m *RetentionPolicyStore) AddTeams(policyId string, teamIds []string) erro var r0 error if rf, ok := ret.Get(0).(func(string, []string) error); ok { - r0 = rf(policyId, teamIds) + r0 = rf(policyID, teamIds) } else { r0 = ret.Error(0) } @@ -214,9 +214,9 @@ func (_m *RetentionPolicyStore) GetChannelPoliciesForUser(userID string, offset return r0, r1 } -// GetChannels provides a mock function with given fields: policyId, offset, limit -func (_m *RetentionPolicyStore) GetChannels(policyId string, offset int, limit int) (model.ChannelListWithTeamData, error) { - ret := _m.Called(policyId, offset, limit) +// GetChannels provides a mock function with given fields: policyID, offset, limit +func (_m *RetentionPolicyStore) GetChannels(policyID string, offset int, limit int) (model.ChannelListWithTeamData, error) { + ret := _m.Called(policyID, offset, limit) if len(ret) == 0 { panic("no return value specified for GetChannels") @@ -225,10 +225,10 @@ func (_m *RetentionPolicyStore) GetChannels(policyId string, offset int, limit i var r0 model.ChannelListWithTeamData var r1 error if rf, ok := ret.Get(0).(func(string, int, int) (model.ChannelListWithTeamData, error)); ok { - return rf(policyId, offset, limit) + return rf(policyID, offset, limit) } if rf, ok := ret.Get(0).(func(string, int, int) model.ChannelListWithTeamData); ok { - r0 = rf(policyId, offset, limit) + r0 = rf(policyID, offset, limit) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(model.ChannelListWithTeamData) @@ -236,7 +236,7 @@ func (_m *RetentionPolicyStore) GetChannels(policyId string, offset int, limit i } if rf, ok := ret.Get(1).(func(string, int, int) error); ok { - r1 = rf(policyId, offset, limit) + r1 = rf(policyID, offset, limit) } else { r1 = ret.Error(1) } @@ -244,9 +244,9 @@ func (_m *RetentionPolicyStore) GetChannels(policyId string, offset int, limit i return r0, r1 } -// GetChannelsCount provides a mock function with given fields: policyId -func (_m *RetentionPolicyStore) GetChannelsCount(policyId string) (int64, error) { - ret := _m.Called(policyId) +// GetChannelsCount provides a mock function with given fields: policyID +func (_m *RetentionPolicyStore) GetChannelsCount(policyID string) (int64, error) { + ret := _m.Called(policyID) if len(ret) == 0 { panic("no return value specified for GetChannelsCount") @@ -255,16 +255,16 @@ func (_m *RetentionPolicyStore) GetChannelsCount(policyId string) (int64, error) var r0 int64 var r1 error if rf, ok := ret.Get(0).(func(string) (int64, error)); ok { - return rf(policyId) + return rf(policyID) } if rf, ok := ret.Get(0).(func(string) int64); ok { - r0 = rf(policyId) + r0 = rf(policyID) } else { r0 = ret.Get(0).(int64) } if rf, ok := ret.Get(1).(func(string) error); ok { - r1 = rf(policyId) + r1 = rf(policyID) } else { r1 = ret.Error(1) } @@ -388,9 +388,9 @@ func (_m *RetentionPolicyStore) GetTeamPoliciesForUser(userID string, offset int return r0, r1 } -// GetTeams provides a mock function with given fields: policyId, offset, limit -func (_m *RetentionPolicyStore) GetTeams(policyId string, offset int, limit int) ([]*model.Team, error) { - ret := _m.Called(policyId, offset, limit) +// GetTeams provides a mock function with given fields: policyID, offset, limit +func (_m *RetentionPolicyStore) GetTeams(policyID string, offset int, limit int) ([]*model.Team, error) { + ret := _m.Called(policyID, offset, limit) if len(ret) == 0 { panic("no return value specified for GetTeams") @@ -399,10 +399,10 @@ func (_m *RetentionPolicyStore) GetTeams(policyId string, offset int, limit int) var r0 []*model.Team var r1 error if rf, ok := ret.Get(0).(func(string, int, int) ([]*model.Team, error)); ok { - return rf(policyId, offset, limit) + return rf(policyID, offset, limit) } if rf, ok := ret.Get(0).(func(string, int, int) []*model.Team); ok { - r0 = rf(policyId, offset, limit) + r0 = rf(policyID, offset, limit) } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]*model.Team) @@ -410,7 +410,7 @@ func (_m *RetentionPolicyStore) GetTeams(policyId string, offset int, limit int) } if rf, ok := ret.Get(1).(func(string, int, int) error); ok { - r1 = rf(policyId, offset, limit) + r1 = rf(policyID, offset, limit) } else { r1 = ret.Error(1) } @@ -418,9 +418,9 @@ func (_m *RetentionPolicyStore) GetTeams(policyId string, offset int, limit int) return r0, r1 } -// GetTeamsCount provides a mock function with given fields: policyId -func (_m *RetentionPolicyStore) GetTeamsCount(policyId string) (int64, error) { - ret := _m.Called(policyId) +// GetTeamsCount provides a mock function with given fields: policyID +func (_m *RetentionPolicyStore) GetTeamsCount(policyID string) (int64, error) { + ret := _m.Called(policyID) if len(ret) == 0 { panic("no return value specified for GetTeamsCount") @@ -429,16 +429,16 @@ func (_m *RetentionPolicyStore) GetTeamsCount(policyId string) (int64, error) { var r0 int64 var r1 error if rf, ok := ret.Get(0).(func(string) (int64, error)); ok { - return rf(policyId) + return rf(policyID) } if rf, ok := ret.Get(0).(func(string) int64); ok { - r0 = rf(policyId) + r0 = rf(policyID) } else { r0 = ret.Get(0).(int64) } if rf, ok := ret.Get(1).(func(string) error); ok { - r1 = rf(policyId) + r1 = rf(policyID) } else { r1 = ret.Error(1) } @@ -476,9 +476,9 @@ func (_m *RetentionPolicyStore) Patch(patch *model.RetentionPolicyWithTeamAndCha return r0, r1 } -// RemoveChannels provides a mock function with given fields: policyId, channelIds -func (_m *RetentionPolicyStore) RemoveChannels(policyId string, channelIds []string) error { - ret := _m.Called(policyId, channelIds) +// RemoveChannels provides a mock function with given fields: policyID, channelIds +func (_m *RetentionPolicyStore) RemoveChannels(policyID string, channelIds []string) error { + ret := _m.Called(policyID, channelIds) if len(ret) == 0 { panic("no return value specified for RemoveChannels") @@ -486,7 +486,7 @@ func (_m *RetentionPolicyStore) RemoveChannels(policyId string, channelIds []str var r0 error if rf, ok := ret.Get(0).(func(string, []string) error); ok { - r0 = rf(policyId, channelIds) + r0 = rf(policyID, channelIds) } else { r0 = ret.Error(0) } @@ -494,9 +494,9 @@ func (_m *RetentionPolicyStore) RemoveChannels(policyId string, channelIds []str return r0 } -// RemoveTeams provides a mock function with given fields: policyId, teamIds -func (_m *RetentionPolicyStore) RemoveTeams(policyId string, teamIds []string) error { - ret := _m.Called(policyId, teamIds) +// RemoveTeams provides a mock function with given fields: policyID, teamIds +func (_m *RetentionPolicyStore) RemoveTeams(policyID string, teamIds []string) error { + ret := _m.Called(policyID, teamIds) if len(ret) == 0 { panic("no return value specified for RemoveTeams") @@ -504,7 +504,7 @@ func (_m *RetentionPolicyStore) RemoveTeams(policyId string, teamIds []string) e var r0 error if rf, ok := ret.Get(0).(func(string, []string) error); ok { - r0 = rf(policyId, teamIds) + r0 = rf(policyID, teamIds) } else { r0 = ret.Error(0) } diff --git a/server/channels/store/storetest/mocks/SharedChannelStore.go b/server/channels/store/storetest/mocks/SharedChannelStore.go index eeb3a888d1753..9531931f914dd 100644 --- a/server/channels/store/storetest/mocks/SharedChannelStore.go +++ b/server/channels/store/storetest/mocks/SharedChannelStore.go @@ -14,9 +14,9 @@ type SharedChannelStore struct { mock.Mock } -// Delete provides a mock function with given fields: channelId -func (_m *SharedChannelStore) Delete(channelId string) (bool, error) { - ret := _m.Called(channelId) +// Delete provides a mock function with given fields: channelID +func (_m *SharedChannelStore) Delete(channelID string) (bool, error) { + ret := _m.Called(channelID) if len(ret) == 0 { panic("no return value specified for Delete") @@ -25,16 +25,16 @@ func (_m *SharedChannelStore) Delete(channelId string) (bool, error) { var r0 bool var r1 error if rf, ok := ret.Get(0).(func(string) (bool, error)); ok { - return rf(channelId) + return rf(channelID) } if rf, ok := ret.Get(0).(func(string) bool); ok { - r0 = rf(channelId) + r0 = rf(channelID) } else { r0 = ret.Get(0).(bool) } if rf, ok := ret.Get(1).(func(string) error); ok { - r1 = rf(channelId) + r1 = rf(channelID) } else { r1 = ret.Error(1) } @@ -42,9 +42,9 @@ func (_m *SharedChannelStore) Delete(channelId string) (bool, error) { return r0, r1 } -// DeleteRemote provides a mock function with given fields: remoteId -func (_m *SharedChannelStore) DeleteRemote(remoteId string) (bool, error) { - ret := _m.Called(remoteId) +// DeleteRemote provides a mock function with given fields: remoteID +func (_m *SharedChannelStore) DeleteRemote(remoteID string) (bool, error) { + ret := _m.Called(remoteID) if len(ret) == 0 { panic("no return value specified for DeleteRemote") @@ -53,16 +53,16 @@ func (_m *SharedChannelStore) DeleteRemote(remoteId string) (bool, error) { var r0 bool var r1 error if rf, ok := ret.Get(0).(func(string) (bool, error)); ok { - return rf(remoteId) + return rf(remoteID) } if rf, ok := ret.Get(0).(func(string) bool); ok { - r0 = rf(remoteId) + r0 = rf(remoteID) } else { r0 = ret.Get(0).(bool) } if rf, ok := ret.Get(1).(func(string) error); ok { - r1 = rf(remoteId) + r1 = rf(remoteID) } else { r1 = ret.Error(1) } @@ -70,9 +70,9 @@ func (_m *SharedChannelStore) DeleteRemote(remoteId string) (bool, error) { return r0, r1 } -// Get provides a mock function with given fields: channelId -func (_m *SharedChannelStore) Get(channelId string) (*model.SharedChannel, error) { - ret := _m.Called(channelId) +// Get provides a mock function with given fields: channelID +func (_m *SharedChannelStore) Get(channelID string) (*model.SharedChannel, error) { + ret := _m.Called(channelID) if len(ret) == 0 { panic("no return value specified for Get") @@ -81,10 +81,10 @@ func (_m *SharedChannelStore) Get(channelId string) (*model.SharedChannel, error var r0 *model.SharedChannel var r1 error if rf, ok := ret.Get(0).(func(string) (*model.SharedChannel, error)); ok { - return rf(channelId) + return rf(channelID) } if rf, ok := ret.Get(0).(func(string) *model.SharedChannel); ok { - r0 = rf(channelId) + r0 = rf(channelID) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*model.SharedChannel) @@ -92,7 +92,7 @@ func (_m *SharedChannelStore) Get(channelId string) (*model.SharedChannel, error } if rf, ok := ret.Get(1).(func(string) error); ok { - r1 = rf(channelId) + r1 = rf(channelID) } else { r1 = ret.Error(1) } @@ -158,9 +158,9 @@ func (_m *SharedChannelStore) GetAllCount(opts model.SharedChannelFilterOpts) (i return r0, r1 } -// GetAttachment provides a mock function with given fields: fileId, remoteId -func (_m *SharedChannelStore) GetAttachment(fileId string, remoteId string) (*model.SharedChannelAttachment, error) { - ret := _m.Called(fileId, remoteId) +// GetAttachment provides a mock function with given fields: fileID, remoteID +func (_m *SharedChannelStore) GetAttachment(fileID string, remoteID string) (*model.SharedChannelAttachment, error) { + ret := _m.Called(fileID, remoteID) if len(ret) == 0 { panic("no return value specified for GetAttachment") @@ -169,10 +169,10 @@ func (_m *SharedChannelStore) GetAttachment(fileId string, remoteId string) (*mo var r0 *model.SharedChannelAttachment var r1 error if rf, ok := ret.Get(0).(func(string, string) (*model.SharedChannelAttachment, error)); ok { - return rf(fileId, remoteId) + return rf(fileID, remoteID) } if rf, ok := ret.Get(0).(func(string, string) *model.SharedChannelAttachment); ok { - r0 = rf(fileId, remoteId) + r0 = rf(fileID, remoteID) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*model.SharedChannelAttachment) @@ -180,7 +180,7 @@ func (_m *SharedChannelStore) GetAttachment(fileId string, remoteId string) (*mo } if rf, ok := ret.Get(1).(func(string, string) error); ok { - r1 = rf(fileId, remoteId) + r1 = rf(fileID, remoteID) } else { r1 = ret.Error(1) } @@ -218,9 +218,9 @@ func (_m *SharedChannelStore) GetRemote(id string) (*model.SharedChannelRemote, return r0, r1 } -// GetRemoteByIds provides a mock function with given fields: channelId, remoteId -func (_m *SharedChannelStore) GetRemoteByIds(channelId string, remoteId string) (*model.SharedChannelRemote, error) { - ret := _m.Called(channelId, remoteId) +// GetRemoteByIds provides a mock function with given fields: channelID, remoteID +func (_m *SharedChannelStore) GetRemoteByIds(channelID string, remoteID string) (*model.SharedChannelRemote, error) { + ret := _m.Called(channelID, remoteID) if len(ret) == 0 { panic("no return value specified for GetRemoteByIds") @@ -229,10 +229,10 @@ func (_m *SharedChannelStore) GetRemoteByIds(channelId string, remoteId string) var r0 *model.SharedChannelRemote var r1 error if rf, ok := ret.Get(0).(func(string, string) (*model.SharedChannelRemote, error)); ok { - return rf(channelId, remoteId) + return rf(channelID, remoteID) } if rf, ok := ret.Get(0).(func(string, string) *model.SharedChannelRemote); ok { - r0 = rf(channelId, remoteId) + r0 = rf(channelID, remoteID) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*model.SharedChannelRemote) @@ -240,7 +240,7 @@ func (_m *SharedChannelStore) GetRemoteByIds(channelId string, remoteId string) } if rf, ok := ret.Get(1).(func(string, string) error); ok { - r1 = rf(channelId, remoteId) + r1 = rf(channelID, remoteID) } else { r1 = ret.Error(1) } @@ -248,9 +248,9 @@ func (_m *SharedChannelStore) GetRemoteByIds(channelId string, remoteId string) return r0, r1 } -// GetRemoteForUser provides a mock function with given fields: remoteId, userId -func (_m *SharedChannelStore) GetRemoteForUser(remoteId string, userId string) (*model.RemoteCluster, error) { - ret := _m.Called(remoteId, userId) +// GetRemoteForUser provides a mock function with given fields: remoteID, userID +func (_m *SharedChannelStore) GetRemoteForUser(remoteID string, userID string) (*model.RemoteCluster, error) { + ret := _m.Called(remoteID, userID) if len(ret) == 0 { panic("no return value specified for GetRemoteForUser") @@ -259,10 +259,10 @@ func (_m *SharedChannelStore) GetRemoteForUser(remoteId string, userId string) ( var r0 *model.RemoteCluster var r1 error if rf, ok := ret.Get(0).(func(string, string) (*model.RemoteCluster, error)); ok { - return rf(remoteId, userId) + return rf(remoteID, userID) } if rf, ok := ret.Get(0).(func(string, string) *model.RemoteCluster); ok { - r0 = rf(remoteId, userId) + r0 = rf(remoteID, userID) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*model.RemoteCluster) @@ -270,7 +270,7 @@ func (_m *SharedChannelStore) GetRemoteForUser(remoteId string, userId string) ( } if rf, ok := ret.Get(1).(func(string, string) error); ok { - r1 = rf(remoteId, userId) + r1 = rf(remoteID, userID) } else { r1 = ret.Error(1) } @@ -308,9 +308,9 @@ func (_m *SharedChannelStore) GetRemotes(offset int, limit int, opts model.Share return r0, r1 } -// GetRemotesStatus provides a mock function with given fields: channelId -func (_m *SharedChannelStore) GetRemotesStatus(channelId string) ([]*model.SharedChannelRemoteStatus, error) { - ret := _m.Called(channelId) +// GetRemotesStatus provides a mock function with given fields: channelID +func (_m *SharedChannelStore) GetRemotesStatus(channelID string) ([]*model.SharedChannelRemoteStatus, error) { + ret := _m.Called(channelID) if len(ret) == 0 { panic("no return value specified for GetRemotesStatus") @@ -319,10 +319,10 @@ func (_m *SharedChannelStore) GetRemotesStatus(channelId string) ([]*model.Share var r0 []*model.SharedChannelRemoteStatus var r1 error if rf, ok := ret.Get(0).(func(string) ([]*model.SharedChannelRemoteStatus, error)); ok { - return rf(channelId) + return rf(channelID) } if rf, ok := ret.Get(0).(func(string) []*model.SharedChannelRemoteStatus); ok { - r0 = rf(channelId) + r0 = rf(channelID) } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]*model.SharedChannelRemoteStatus) @@ -330,7 +330,7 @@ func (_m *SharedChannelStore) GetRemotesStatus(channelId string) ([]*model.Share } if rf, ok := ret.Get(1).(func(string) error); ok { - r1 = rf(channelId) + r1 = rf(channelID) } else { r1 = ret.Error(1) } @@ -456,9 +456,9 @@ func (_m *SharedChannelStore) HasChannel(channelID string) (bool, error) { return r0, r1 } -// HasRemote provides a mock function with given fields: channelID, remoteId -func (_m *SharedChannelStore) HasRemote(channelID string, remoteId string) (bool, error) { - ret := _m.Called(channelID, remoteId) +// HasRemote provides a mock function with given fields: channelID, remoteID +func (_m *SharedChannelStore) HasRemote(channelID string, remoteID string) (bool, error) { + ret := _m.Called(channelID, remoteID) if len(ret) == 0 { panic("no return value specified for HasRemote") @@ -467,16 +467,16 @@ func (_m *SharedChannelStore) HasRemote(channelID string, remoteId string) (bool var r0 bool var r1 error if rf, ok := ret.Get(0).(func(string, string) (bool, error)); ok { - return rf(channelID, remoteId) + return rf(channelID, remoteID) } if rf, ok := ret.Get(0).(func(string, string) bool); ok { - r0 = rf(channelID, remoteId) + r0 = rf(channelID, remoteID) } else { r0 = ret.Get(0).(bool) } if rf, ok := ret.Get(1).(func(string, string) error); ok { - r1 = rf(channelID, remoteId) + r1 = rf(channelID, remoteID) } else { r1 = ret.Error(1) } diff --git a/server/channels/store/storetest/mocks/ThreadStore.go b/server/channels/store/storetest/mocks/ThreadStore.go index 488b631806f28..8dde1db6c6d8d 100644 --- a/server/channels/store/storetest/mocks/ThreadStore.go +++ b/server/channels/store/storetest/mocks/ThreadStore.go @@ -15,9 +15,9 @@ type ThreadStore struct { mock.Mock } -// DeleteMembershipForUser provides a mock function with given fields: userId, postID -func (_m *ThreadStore) DeleteMembershipForUser(userId string, postID string) error { - ret := _m.Called(userId, postID) +// DeleteMembershipForUser provides a mock function with given fields: userID, postID +func (_m *ThreadStore) DeleteMembershipForUser(userID string, postID string) error { + ret := _m.Called(userID, postID) if len(ret) == 0 { panic("no return value specified for DeleteMembershipForUser") @@ -25,7 +25,7 @@ func (_m *ThreadStore) DeleteMembershipForUser(userId string, postID string) err var r0 error if rf, ok := ret.Get(0).(func(string, string) error); ok { - r0 = rf(userId, postID) + r0 = rf(userID, postID) } else { r0 = ret.Error(0) } @@ -109,9 +109,9 @@ func (_m *ThreadStore) Get(id string) (*model.Thread, error) { return r0, r1 } -// GetMembershipForUser provides a mock function with given fields: userId, postID -func (_m *ThreadStore) GetMembershipForUser(userId string, postID string) (*model.ThreadMembership, error) { - ret := _m.Called(userId, postID) +// GetMembershipForUser provides a mock function with given fields: userID, postID +func (_m *ThreadStore) GetMembershipForUser(userID string, postID string) (*model.ThreadMembership, error) { + ret := _m.Called(userID, postID) if len(ret) == 0 { panic("no return value specified for GetMembershipForUser") @@ -120,10 +120,10 @@ func (_m *ThreadStore) GetMembershipForUser(userId string, postID string) (*mode var r0 *model.ThreadMembership var r1 error if rf, ok := ret.Get(0).(func(string, string) (*model.ThreadMembership, error)); ok { - return rf(userId, postID) + return rf(userID, postID) } if rf, ok := ret.Get(0).(func(string, string) *model.ThreadMembership); ok { - r0 = rf(userId, postID) + r0 = rf(userID, postID) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*model.ThreadMembership) @@ -131,7 +131,7 @@ func (_m *ThreadStore) GetMembershipForUser(userId string, postID string) (*mode } if rf, ok := ret.Get(1).(func(string, string) error); ok { - r1 = rf(userId, postID) + r1 = rf(userID, postID) } else { r1 = ret.Error(1) } @@ -139,9 +139,9 @@ func (_m *ThreadStore) GetMembershipForUser(userId string, postID string) (*mode return r0, r1 } -// GetMembershipsForUser provides a mock function with given fields: userId, teamID -func (_m *ThreadStore) GetMembershipsForUser(userId string, teamID string) ([]*model.ThreadMembership, error) { - ret := _m.Called(userId, teamID) +// GetMembershipsForUser provides a mock function with given fields: userID, teamID +func (_m *ThreadStore) GetMembershipsForUser(userID string, teamID string) ([]*model.ThreadMembership, error) { + ret := _m.Called(userID, teamID) if len(ret) == 0 { panic("no return value specified for GetMembershipsForUser") @@ -150,10 +150,10 @@ func (_m *ThreadStore) GetMembershipsForUser(userId string, teamID string) ([]*m var r0 []*model.ThreadMembership var r1 error if rf, ok := ret.Get(0).(func(string, string) ([]*model.ThreadMembership, error)); ok { - return rf(userId, teamID) + return rf(userID, teamID) } if rf, ok := ret.Get(0).(func(string, string) []*model.ThreadMembership); ok { - r0 = rf(userId, teamID) + r0 = rf(userID, teamID) } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]*model.ThreadMembership) @@ -161,7 +161,7 @@ func (_m *ThreadStore) GetMembershipsForUser(userId string, teamID string) ([]*m } if rf, ok := ret.Get(1).(func(string, string) error); ok { - r1 = rf(userId, teamID) + r1 = rf(userID, teamID) } else { r1 = ret.Error(1) } @@ -317,9 +317,9 @@ func (_m *ThreadStore) GetThreadUnreadReplyCount(threadMembership *model.ThreadM return r0, r1 } -// GetThreadsForUser provides a mock function with given fields: userId, teamID, opts -func (_m *ThreadStore) GetThreadsForUser(userId string, teamID string, opts model.GetUserThreadsOpts) ([]*model.ThreadResponse, error) { - ret := _m.Called(userId, teamID, opts) +// GetThreadsForUser provides a mock function with given fields: userID, teamID, opts +func (_m *ThreadStore) GetThreadsForUser(userID string, teamID string, opts model.GetUserThreadsOpts) ([]*model.ThreadResponse, error) { + ret := _m.Called(userID, teamID, opts) if len(ret) == 0 { panic("no return value specified for GetThreadsForUser") @@ -328,10 +328,10 @@ func (_m *ThreadStore) GetThreadsForUser(userId string, teamID string, opts mode var r0 []*model.ThreadResponse var r1 error if rf, ok := ret.Get(0).(func(string, string, model.GetUserThreadsOpts) ([]*model.ThreadResponse, error)); ok { - return rf(userId, teamID, opts) + return rf(userID, teamID, opts) } if rf, ok := ret.Get(0).(func(string, string, model.GetUserThreadsOpts) []*model.ThreadResponse); ok { - r0 = rf(userId, teamID, opts) + r0 = rf(userID, teamID, opts) } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]*model.ThreadResponse) @@ -339,7 +339,7 @@ func (_m *ThreadStore) GetThreadsForUser(userId string, teamID string, opts mode } if rf, ok := ret.Get(1).(func(string, string, model.GetUserThreadsOpts) error); ok { - r1 = rf(userId, teamID, opts) + r1 = rf(userID, teamID, opts) } else { r1 = ret.Error(1) } @@ -347,9 +347,9 @@ func (_m *ThreadStore) GetThreadsForUser(userId string, teamID string, opts mode return r0, r1 } -// GetTotalThreads provides a mock function with given fields: userId, teamID, opts -func (_m *ThreadStore) GetTotalThreads(userId string, teamID string, opts model.GetUserThreadsOpts) (int64, error) { - ret := _m.Called(userId, teamID, opts) +// GetTotalThreads provides a mock function with given fields: userID, teamID, opts +func (_m *ThreadStore) GetTotalThreads(userID string, teamID string, opts model.GetUserThreadsOpts) (int64, error) { + ret := _m.Called(userID, teamID, opts) if len(ret) == 0 { panic("no return value specified for GetTotalThreads") @@ -358,16 +358,16 @@ func (_m *ThreadStore) GetTotalThreads(userId string, teamID string, opts model. var r0 int64 var r1 error if rf, ok := ret.Get(0).(func(string, string, model.GetUserThreadsOpts) (int64, error)); ok { - return rf(userId, teamID, opts) + return rf(userID, teamID, opts) } if rf, ok := ret.Get(0).(func(string, string, model.GetUserThreadsOpts) int64); ok { - r0 = rf(userId, teamID, opts) + r0 = rf(userID, teamID, opts) } else { r0 = ret.Get(0).(int64) } if rf, ok := ret.Get(1).(func(string, string, model.GetUserThreadsOpts) error); ok { - r1 = rf(userId, teamID, opts) + r1 = rf(userID, teamID, opts) } else { r1 = ret.Error(1) } @@ -375,9 +375,9 @@ func (_m *ThreadStore) GetTotalThreads(userId string, teamID string, opts model. return r0, r1 } -// GetTotalUnreadMentions provides a mock function with given fields: userId, teamID, opts -func (_m *ThreadStore) GetTotalUnreadMentions(userId string, teamID string, opts model.GetUserThreadsOpts) (int64, error) { - ret := _m.Called(userId, teamID, opts) +// GetTotalUnreadMentions provides a mock function with given fields: userID, teamID, opts +func (_m *ThreadStore) GetTotalUnreadMentions(userID string, teamID string, opts model.GetUserThreadsOpts) (int64, error) { + ret := _m.Called(userID, teamID, opts) if len(ret) == 0 { panic("no return value specified for GetTotalUnreadMentions") @@ -386,16 +386,16 @@ func (_m *ThreadStore) GetTotalUnreadMentions(userId string, teamID string, opts var r0 int64 var r1 error if rf, ok := ret.Get(0).(func(string, string, model.GetUserThreadsOpts) (int64, error)); ok { - return rf(userId, teamID, opts) + return rf(userID, teamID, opts) } if rf, ok := ret.Get(0).(func(string, string, model.GetUserThreadsOpts) int64); ok { - r0 = rf(userId, teamID, opts) + r0 = rf(userID, teamID, opts) } else { r0 = ret.Get(0).(int64) } if rf, ok := ret.Get(1).(func(string, string, model.GetUserThreadsOpts) error); ok { - r1 = rf(userId, teamID, opts) + r1 = rf(userID, teamID, opts) } else { r1 = ret.Error(1) } @@ -403,9 +403,9 @@ func (_m *ThreadStore) GetTotalUnreadMentions(userId string, teamID string, opts return r0, r1 } -// GetTotalUnreadThreads provides a mock function with given fields: userId, teamID, opts -func (_m *ThreadStore) GetTotalUnreadThreads(userId string, teamID string, opts model.GetUserThreadsOpts) (int64, error) { - ret := _m.Called(userId, teamID, opts) +// GetTotalUnreadThreads provides a mock function with given fields: userID, teamID, opts +func (_m *ThreadStore) GetTotalUnreadThreads(userID string, teamID string, opts model.GetUserThreadsOpts) (int64, error) { + ret := _m.Called(userID, teamID, opts) if len(ret) == 0 { panic("no return value specified for GetTotalUnreadThreads") @@ -414,16 +414,16 @@ func (_m *ThreadStore) GetTotalUnreadThreads(userId string, teamID string, opts var r0 int64 var r1 error if rf, ok := ret.Get(0).(func(string, string, model.GetUserThreadsOpts) (int64, error)); ok { - return rf(userId, teamID, opts) + return rf(userID, teamID, opts) } if rf, ok := ret.Get(0).(func(string, string, model.GetUserThreadsOpts) int64); ok { - r0 = rf(userId, teamID, opts) + r0 = rf(userID, teamID, opts) } else { r0 = ret.Get(0).(int64) } if rf, ok := ret.Get(1).(func(string, string, model.GetUserThreadsOpts) error); ok { - r1 = rf(userId, teamID, opts) + r1 = rf(userID, teamID, opts) } else { r1 = ret.Error(1) } @@ -431,9 +431,9 @@ func (_m *ThreadStore) GetTotalUnreadThreads(userId string, teamID string, opts return r0, r1 } -// GetTotalUnreadUrgentMentions provides a mock function with given fields: userId, teamID, opts -func (_m *ThreadStore) GetTotalUnreadUrgentMentions(userId string, teamID string, opts model.GetUserThreadsOpts) (int64, error) { - ret := _m.Called(userId, teamID, opts) +// GetTotalUnreadUrgentMentions provides a mock function with given fields: userID, teamID, opts +func (_m *ThreadStore) GetTotalUnreadUrgentMentions(userID string, teamID string, opts model.GetUserThreadsOpts) (int64, error) { + ret := _m.Called(userID, teamID, opts) if len(ret) == 0 { panic("no return value specified for GetTotalUnreadUrgentMentions") @@ -442,16 +442,16 @@ func (_m *ThreadStore) GetTotalUnreadUrgentMentions(userId string, teamID string var r0 int64 var r1 error if rf, ok := ret.Get(0).(func(string, string, model.GetUserThreadsOpts) (int64, error)); ok { - return rf(userId, teamID, opts) + return rf(userID, teamID, opts) } if rf, ok := ret.Get(0).(func(string, string, model.GetUserThreadsOpts) int64); ok { - r0 = rf(userId, teamID, opts) + r0 = rf(userID, teamID, opts) } else { r0 = ret.Get(0).(int64) } if rf, ok := ret.Get(1).(func(string, string, model.GetUserThreadsOpts) error); ok { - r1 = rf(userId, teamID, opts) + r1 = rf(userID, teamID, opts) } else { r1 = ret.Error(1) } diff --git a/server/channels/store/storetest/mocks/UserStore.go b/server/channels/store/storetest/mocks/UserStore.go index 8bf8cbcfc3a0c..006ab5cad9ff3 100644 --- a/server/channels/store/storetest/mocks/UserStore.go +++ b/server/channels/store/storetest/mocks/UserStore.go @@ -479,9 +479,9 @@ func (_m *UserStore) GetAllProfiles(options *model.UserGetOptions) ([]*model.Use return r0, r1 } -// GetAllProfilesInChannel provides a mock function with given fields: rctx, channelID, allowFromCache -func (_m *UserStore) GetAllProfilesInChannel(rctx context.Context, channelID string, allowFromCache bool) (map[string]*model.User, error) { - ret := _m.Called(rctx, channelID, allowFromCache) +// GetAllProfilesInChannel provides a mock function with given fields: ctx, channelID, allowFromCache +func (_m *UserStore) GetAllProfilesInChannel(ctx context.Context, channelID string, allowFromCache bool) (map[string]*model.User, error) { + ret := _m.Called(ctx, channelID, allowFromCache) if len(ret) == 0 { panic("no return value specified for GetAllProfilesInChannel") @@ -490,10 +490,10 @@ func (_m *UserStore) GetAllProfilesInChannel(rctx context.Context, channelID str var r0 map[string]*model.User var r1 error if rf, ok := ret.Get(0).(func(context.Context, string, bool) (map[string]*model.User, error)); ok { - return rf(rctx, channelID, allowFromCache) + return rf(ctx, channelID, allowFromCache) } if rf, ok := ret.Get(0).(func(context.Context, string, bool) map[string]*model.User); ok { - r0 = rf(rctx, channelID, allowFromCache) + r0 = rf(ctx, channelID, allowFromCache) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(map[string]*model.User) @@ -501,7 +501,7 @@ func (_m *UserStore) GetAllProfilesInChannel(rctx context.Context, channelID str } if rf, ok := ret.Get(1).(func(context.Context, string, bool) error); ok { - r1 = rf(rctx, channelID, allowFromCache) + r1 = rf(ctx, channelID, allowFromCache) } else { r1 = ret.Error(1) } @@ -1131,9 +1131,9 @@ func (_m *UserStore) GetProfilesInChannelByStatus(options *model.UserGetOptions) return r0, r1 } -// GetProfilesNotInChannel provides a mock function with given fields: teamID, channelId, groupConstrained, offset, limit, viewRestrictions -func (_m *UserStore) GetProfilesNotInChannel(teamID string, channelId string, groupConstrained bool, offset int, limit int, viewRestrictions *model.ViewUsersRestrictions) ([]*model.User, error) { - ret := _m.Called(teamID, channelId, groupConstrained, offset, limit, viewRestrictions) +// GetProfilesNotInChannel provides a mock function with given fields: teamID, channelID, groupConstrained, offset, limit, viewRestrictions +func (_m *UserStore) GetProfilesNotInChannel(teamID string, channelID string, groupConstrained bool, offset int, limit int, viewRestrictions *model.ViewUsersRestrictions) ([]*model.User, error) { + ret := _m.Called(teamID, channelID, groupConstrained, offset, limit, viewRestrictions) if len(ret) == 0 { panic("no return value specified for GetProfilesNotInChannel") @@ -1142,10 +1142,10 @@ func (_m *UserStore) GetProfilesNotInChannel(teamID string, channelId string, gr var r0 []*model.User var r1 error if rf, ok := ret.Get(0).(func(string, string, bool, int, int, *model.ViewUsersRestrictions) ([]*model.User, error)); ok { - return rf(teamID, channelId, groupConstrained, offset, limit, viewRestrictions) + return rf(teamID, channelID, groupConstrained, offset, limit, viewRestrictions) } if rf, ok := ret.Get(0).(func(string, string, bool, int, int, *model.ViewUsersRestrictions) []*model.User); ok { - r0 = rf(teamID, channelId, groupConstrained, offset, limit, viewRestrictions) + r0 = rf(teamID, channelID, groupConstrained, offset, limit, viewRestrictions) } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]*model.User) @@ -1153,7 +1153,7 @@ func (_m *UserStore) GetProfilesNotInChannel(teamID string, channelId string, gr } if rf, ok := ret.Get(1).(func(string, string, bool, int, int, *model.ViewUsersRestrictions) error); ok { - r1 = rf(teamID, channelId, groupConstrained, offset, limit, viewRestrictions) + r1 = rf(teamID, channelID, groupConstrained, offset, limit, viewRestrictions) } else { r1 = ret.Error(1) } diff --git a/server/channels/store/storetest/mocks/UserTermsOfServiceStore.go b/server/channels/store/storetest/mocks/UserTermsOfServiceStore.go index 06ae3c10a3fbb..9241e75adf495 100644 --- a/server/channels/store/storetest/mocks/UserTermsOfServiceStore.go +++ b/server/channels/store/storetest/mocks/UserTermsOfServiceStore.go @@ -14,9 +14,9 @@ type UserTermsOfServiceStore struct { mock.Mock } -// Delete provides a mock function with given fields: userID, termsOfServiceId -func (_m *UserTermsOfServiceStore) Delete(userID string, termsOfServiceId string) error { - ret := _m.Called(userID, termsOfServiceId) +// Delete provides a mock function with given fields: userID, termsOfServiceID +func (_m *UserTermsOfServiceStore) Delete(userID string, termsOfServiceID string) error { + ret := _m.Called(userID, termsOfServiceID) if len(ret) == 0 { panic("no return value specified for Delete") @@ -24,7 +24,7 @@ func (_m *UserTermsOfServiceStore) Delete(userID string, termsOfServiceId string var r0 error if rf, ok := ret.Get(0).(func(string, string) error); ok { - r0 = rf(userID, termsOfServiceId) + r0 = rf(userID, termsOfServiceID) } else { r0 = ret.Error(0) } diff --git a/server/channels/store/storetest/notify_admin_store.go b/server/channels/store/storetest/notify_admin_store.go index f2e58616bae0c..0ea6934b42e2b 100644 --- a/server/channels/store/storetest/notify_admin_store.go +++ b/server/channels/store/storetest/notify_admin_store.go @@ -14,11 +14,11 @@ import ( "github.com/mattermost/mattermost/server/v8/channels/store" ) -const PluginIdJenkins = "jenkins" +const PluginIDJenkins = "jenkins" func TestNotifyAdminStore(t *testing.T, rctx request.CTX, ss store.Store) { t.Run("Save", func(t *testing.T) { testNotifyAdminStoreSave(t, rctx, ss) }) - t.Run("testGetDataByUserIdAndFeature", func(t *testing.T) { testGetDataByUserIdAndFeature(t, rctx, ss) }) + t.Run("testGetDataByUserIdAndFeature", func(t *testing.T) { testGetDataByUserIDAndFeature(t, rctx, ss) }) t.Run("testGet", func(t *testing.T) { testGet(t, rctx, ss) }) t.Run("testDeleteBefore", func(t *testing.T) { testDeleteBefore(t, rctx, ss) }) t.Run("testUpdate", func(t *testing.T) { testUpdate(t, rctx, ss) }) @@ -62,9 +62,9 @@ func testNotifyAdminStoreSave(t *testing.T, rctx request.CTX, ss store.Store) { require.Error(t, err) // same user requesting same feature error - singleUserId := model.NewId() + singleUserID := model.NewId() d5 := &model.NotifyAdminData{ - UserId: singleUserId, + UserId: singleUserID, RequiredPlan: model.LicenseShortSkuProfessional, RequiredFeature: model.PaidFeatureAllProfessionalfeatures, } @@ -72,7 +72,7 @@ func testNotifyAdminStoreSave(t *testing.T, rctx request.CTX, ss store.Store) { require.NoError(t, err) d6 := &model.NotifyAdminData{ - UserId: singleUserId, + UserId: singleUserID, RequiredPlan: model.LicenseShortSkuProfessional, RequiredFeature: model.PaidFeatureAllProfessionalfeatures, } @@ -83,9 +83,9 @@ func testNotifyAdminStoreSave(t *testing.T, rctx request.CTX, ss store.Store) { } func testGet(t *testing.T, rctx request.CTX, ss store.Store) { - userId1 := model.NewId() + userID1 := model.NewId() d1 := &model.NotifyAdminData{ - UserId: userId1, + UserId: userID1, RequiredPlan: model.LicenseShortSkuProfessional, RequiredFeature: model.PaidFeatureAllProfessionalfeatures, } @@ -94,7 +94,7 @@ func testGet(t *testing.T, rctx request.CTX, ss store.Store) { require.NoError(t, err) d1Trial := &model.NotifyAdminData{ - UserId: userId1, + UserId: userID1, RequiredPlan: model.LicenseShortSkuEnterprise, RequiredFeature: model.PaidFeatureAllEnterprisefeatures, Trial: true, @@ -122,10 +122,10 @@ func testGet(t *testing.T, rctx request.CTX, ss store.Store) { tearDown(t, rctx, ss) } -func testGetDataByUserIdAndFeature(t *testing.T, rctx request.CTX, ss store.Store) { - userId1 := model.NewId() +func testGetDataByUserIDAndFeature(t *testing.T, rctx request.CTX, ss store.Store) { + userID1 := model.NewId() d1 := &model.NotifyAdminData{ - UserId: userId1, + UserId: userID1, RequiredPlan: model.LicenseShortSkuProfessional, RequiredFeature: model.PaidFeatureAllProfessionalfeatures, } @@ -133,9 +133,9 @@ func testGetDataByUserIdAndFeature(t *testing.T, rctx request.CTX, ss store.Stor _, err := ss.NotifyAdmin().Save(d1) require.NoError(t, err) - userId2 := model.NewId() + userID2 := model.NewId() d2 := &model.NotifyAdminData{ - UserId: userId2, + UserId: userID2, RequiredPlan: model.LicenseShortSkuProfessional, RequiredFeature: model.PaidFeatureCustomUsergroups, } @@ -143,7 +143,7 @@ func testGetDataByUserIdAndFeature(t *testing.T, rctx request.CTX, ss store.Stor _, err = ss.NotifyAdmin().Save(d2) require.NoError(t, err) - user1Request, err := ss.NotifyAdmin().GetDataByUserIdAndFeature(userId1, model.PaidFeatureAllProfessionalfeatures) + user1Request, err := ss.NotifyAdmin().GetDataByUserIdAndFeature(userID1, model.PaidFeatureAllProfessionalfeatures) require.NoError(t, err) require.Equal(t, len(user1Request), 1) require.Equal(t, user1Request[0].RequiredFeature, model.PaidFeatureAllProfessionalfeatures) @@ -152,10 +152,10 @@ func testGetDataByUserIdAndFeature(t *testing.T, rctx request.CTX, ss store.Stor } func testUpdate(t *testing.T, rctx request.CTX, ss store.Store) { - userId1 := model.NewId() + userID1 := model.NewId() d1 := &model.NotifyAdminData{ - UserId: userId1, - RequiredPlan: PluginIdJenkins, + UserId: userID1, + RequiredPlan: PluginIDJenkins, RequiredFeature: model.PluginFeature, } _, err := ss.NotifyAdmin().Save(d1) @@ -174,9 +174,9 @@ func testUpdate(t *testing.T, rctx request.CTX, ss store.Store) { } func testDeleteBefore(t *testing.T, rctx request.CTX, ss store.Store) { - userId1 := model.NewId() + userID1 := model.NewId() d1 := &model.NotifyAdminData{ - UserId: userId1, + UserId: userID1, RequiredPlan: model.LicenseShortSkuProfessional, RequiredFeature: model.PaidFeatureAllProfessionalfeatures, } @@ -185,7 +185,7 @@ func testDeleteBefore(t *testing.T, rctx request.CTX, ss store.Store) { require.NoError(t, err) d1Trial := &model.NotifyAdminData{ - UserId: userId1, + UserId: userID1, RequiredPlan: model.LicenseShortSkuProfessional, RequiredFeature: model.PaidFeatureAllEnterprisefeatures, Trial: true, diff --git a/server/channels/store/storetest/outgoing_oauth_connection.go b/server/channels/store/storetest/outgoing_oauth_connection.go index 267c51f82e9b2..6e9412a495994 100644 --- a/server/channels/store/storetest/outgoing_oauth_connection.go +++ b/server/channels/store/storetest/outgoing_oauth_connection.go @@ -269,9 +269,9 @@ func testGetOutgoingOAuthConnection(t *testing.T, ss store.Store) { c := request.TestContext(t) t.Run("get non-existing", func(t *testing.T) { - nonExistingId := model.NewId() + nonExistingID := model.NewId() var expected *store.ErrNotFound - _, err := ss.OutgoingOAuthConnection().GetConnection(c, nonExistingId) + _, err := ss.OutgoingOAuthConnection().GetConnection(c, nonExistingID) require.ErrorAs(t, err, &expected) }) } @@ -311,9 +311,9 @@ func testGetOutgoingOAuthConnectionByAudience(t *testing.T, ss store.Store) { t.Run("get non-existing", func(t *testing.T) { c := request.TestContext(t) - nonExistingId := model.NewId() + nonExistingID := model.NewId() var expected *store.ErrNotFound - _, err := ss.OutgoingOAuthConnection().GetConnection(c, nonExistingId) + _, err := ss.OutgoingOAuthConnection().GetConnection(c, nonExistingID) require.ErrorAs(t, err, &expected) }) diff --git a/server/channels/store/storetest/plugin_store.go b/server/channels/store/storetest/plugin_store.go index 9f757d1c83de6..12ec4452c4c3d 100644 --- a/server/channels/store/storetest/plugin_store.go +++ b/server/channels/store/storetest/plugin_store.go @@ -28,13 +28,13 @@ func TestPluginStore(t *testing.T, rctx request.CTX, ss store.Store, s SqlStore) } func setupKVs(t *testing.T, rctx request.CTX, ss store.Store) (string, func()) { - pluginId := model.NewId() - otherPluginId := model.NewId() + pluginID := model.NewId() + otherPluginID := model.NewId() // otherKV is another key value for the current plugin, and used to verify other keys // aren't modified unintentionally. otherKV := &model.PluginKeyValue{ - PluginId: pluginId, + PluginId: pluginID, Key: model.NewId(), Value: []byte(model.NewId()), ExpireAt: 0, @@ -45,7 +45,7 @@ func setupKVs(t *testing.T, rctx request.CTX, ss store.Store) (string, func()) { // otherPluginKV is a key value for another plugin, and used to verify other plugins' keys // aren't modified unintentionally. otherPluginKV := &model.PluginKeyValue{ - PluginId: otherPluginId, + PluginId: otherPluginID, Key: model.NewId(), Value: []byte(model.NewId()), ExpireAt: 0, @@ -53,7 +53,7 @@ func setupKVs(t *testing.T, rctx request.CTX, ss store.Store) (string, func()) { _, err = ss.Plugin().SaveOrUpdate(otherPluginKV) require.NoError(t, err) - return pluginId, func() { + return pluginID, func() { actualOtherKV, err := ss.Plugin().Get(otherKV.PluginId, otherKV.Key) require.NoError(t, err, "failed to find other key value for same plugin") assert.Equal(t, otherKV, actualOtherKV) @@ -85,7 +85,7 @@ func doTestPluginSaveOrUpdate(t *testing.T, rctx request.CTX, ss store.Store, do }) t.Run("new key", func(t *testing.T) { - pluginId, tearDown := setupKVs(t, rctx, ss) + pluginID, tearDown := setupKVs(t, rctx, ss) defer tearDown() key := model.NewId() @@ -93,7 +93,7 @@ func doTestPluginSaveOrUpdate(t *testing.T, rctx request.CTX, ss store.Store, do expireAt := int64(0) kv := &model.PluginKeyValue{ - PluginId: pluginId, + PluginId: pluginID, Key: key, Value: []byte(value), ExpireAt: expireAt, @@ -104,18 +104,18 @@ func doTestPluginSaveOrUpdate(t *testing.T, rctx request.CTX, ss store.Store, do assert.Equal(t, kv, retKV) // SaveOrUpdate returns the kv passed in, so test each field individually for // completeness. It should probably be changed to not bother doing that. - assert.Equal(t, pluginId, kv.PluginId) + assert.Equal(t, pluginID, kv.PluginId) assert.Equal(t, key, kv.Key) assert.Equal(t, []byte(value), kv.Value) assert.Equal(t, expireAt, kv.ExpireAt) - actualKV, nErr := ss.Plugin().Get(pluginId, key) + actualKV, nErr := ss.Plugin().Get(pluginID, key) require.NoError(t, nErr) assert.Equal(t, kv, actualKV) }) t.Run("nil value for new key", func(t *testing.T) { - pluginId, tearDown := setupKVs(t, rctx, ss) + pluginID, tearDown := setupKVs(t, rctx, ss) defer tearDown() key := model.NewId() @@ -123,7 +123,7 @@ func doTestPluginSaveOrUpdate(t *testing.T, rctx request.CTX, ss store.Store, do expireAt := int64(0) kv := &model.PluginKeyValue{ - PluginId: pluginId, + PluginId: pluginID, Key: key, Value: value, ExpireAt: expireAt, @@ -134,12 +134,12 @@ func doTestPluginSaveOrUpdate(t *testing.T, rctx request.CTX, ss store.Store, do assert.Equal(t, kv, retKV) // SaveOrUpdate returns the kv passed in, so test each field individually for // completeness. It should probably be changed to not bother doing that. - assert.Equal(t, pluginId, kv.PluginId) + assert.Equal(t, pluginID, kv.PluginId) assert.Equal(t, key, kv.Key) assert.Nil(t, kv.Value) assert.Equal(t, expireAt, kv.ExpireAt) - actualKV, nErr := ss.Plugin().Get(pluginId, key) + actualKV, nErr := ss.Plugin().Get(pluginID, key) _, ok := nErr.(*store.ErrNotFound) require.Error(t, nErr) assert.True(t, ok) @@ -147,7 +147,7 @@ func doTestPluginSaveOrUpdate(t *testing.T, rctx request.CTX, ss store.Store, do }) t.Run("existing key", func(t *testing.T) { - pluginId, tearDown := setupKVs(t, rctx, ss) + pluginID, tearDown := setupKVs(t, rctx, ss) defer tearDown() key := model.NewId() @@ -155,7 +155,7 @@ func doTestPluginSaveOrUpdate(t *testing.T, rctx request.CTX, ss store.Store, do expireAt := int64(0) kv := &model.PluginKeyValue{ - PluginId: pluginId, + PluginId: pluginID, Key: key, Value: []byte(value), ExpireAt: expireAt, @@ -172,18 +172,18 @@ func doTestPluginSaveOrUpdate(t *testing.T, rctx request.CTX, ss store.Store, do assert.Equal(t, kv, retKV) // SaveOrUpdate returns the kv passed in, so test each field individually for // completeness. It should probably be changed to not bother doing that. - assert.Equal(t, pluginId, kv.PluginId) + assert.Equal(t, pluginID, kv.PluginId) assert.Equal(t, key, kv.Key) assert.Equal(t, []byte(newValue), kv.Value) assert.Equal(t, expireAt, kv.ExpireAt) - actualKV, nErr := ss.Plugin().Get(pluginId, key) + actualKV, nErr := ss.Plugin().Get(pluginID, key) require.NoError(t, nErr) assert.Equal(t, kv, actualKV) }) t.Run("nil value for existing key", func(t *testing.T) { - pluginId, tearDown := setupKVs(t, rctx, ss) + pluginID, tearDown := setupKVs(t, rctx, ss) defer tearDown() key := model.NewId() @@ -191,7 +191,7 @@ func doTestPluginSaveOrUpdate(t *testing.T, rctx request.CTX, ss store.Store, do expireAt := int64(0) kv := &model.PluginKeyValue{ - PluginId: pluginId, + PluginId: pluginID, Key: key, Value: []byte(value), ExpireAt: expireAt, @@ -207,12 +207,12 @@ func doTestPluginSaveOrUpdate(t *testing.T, rctx request.CTX, ss store.Store, do assert.Equal(t, kv, retKV) // SaveOrUpdate returns the kv passed in, so test each field individually for // completeness. It should probably be changed to not bother doing that. - assert.Equal(t, pluginId, kv.PluginId) + assert.Equal(t, pluginID, kv.PluginId) assert.Equal(t, key, kv.Key) assert.Nil(t, kv.Value) assert.Equal(t, expireAt, kv.ExpireAt) - actualKV, nErr := ss.Plugin().Get(pluginId, key) + actualKV, nErr := ss.Plugin().Get(pluginID, key) _, ok := nErr.(*store.ErrNotFound) require.Error(t, nErr) assert.True(t, ok) @@ -311,10 +311,10 @@ func doTestPluginCompareAndSet(t *testing.T, rctx request.CTX, ss store.Store, c // Non-existent keys and expired keys should behave identically. for description, setup := range map[string]func(t *testing.T) (*model.PluginKeyValue, func()){ "non-existent key": func(t *testing.T) (*model.PluginKeyValue, func()) { - pluginId, tearDown := setupKVs(t, rctx, ss) + pluginID, tearDown := setupKVs(t, rctx, ss) kv := &model.PluginKeyValue{ - PluginId: pluginId, + PluginId: pluginID, Key: model.NewId(), Value: []byte(model.NewId()), ExpireAt: 0, @@ -323,10 +323,10 @@ func doTestPluginCompareAndSet(t *testing.T, rctx request.CTX, ss store.Store, c return kv, tearDown }, "expired key": func(t *testing.T) (*model.PluginKeyValue, func()) { - pluginId, tearDown := setupKVs(t, rctx, ss) + pluginID, tearDown := setupKVs(t, rctx, ss) expiredKV := &model.PluginKeyValue{ - PluginId: pluginId, + PluginId: pluginID, Key: model.NewId(), Value: []byte(model.NewId()), ExpireAt: 1, @@ -399,10 +399,10 @@ func doTestPluginCompareAndSet(t *testing.T, rctx request.CTX, ss store.Store, c t.Run("existing key", func(t *testing.T) { setup := func(t *testing.T) (*model.PluginKeyValue, func()) { - pluginId, tearDown := setupKVs(t, rctx, ss) + pluginID, tearDown := setupKVs(t, rctx, ss) existingKV := &model.PluginKeyValue{ - PluginId: pluginId, + PluginId: pluginID, Key: model.NewId(), Value: []byte(model.NewId()), ExpireAt: 0, @@ -552,7 +552,7 @@ func testPluginCompareAndDelete(t *testing.T, rctx request.CTX, ss store.Store) }) t.Run("non-existent key should fail", func(t *testing.T) { - pluginId, tearDown := setupKVs(t, rctx, ss) + pluginID, tearDown := setupKVs(t, rctx, ss) defer tearDown() key := model.NewId() @@ -560,7 +560,7 @@ func testPluginCompareAndDelete(t *testing.T, rctx request.CTX, ss store.Store) expireAt := int64(0) kv := &model.PluginKeyValue{ - PluginId: pluginId, + PluginId: pluginID, Key: key, Value: []byte(value), ExpireAt: expireAt, @@ -581,7 +581,7 @@ func testPluginCompareAndDelete(t *testing.T, rctx request.CTX, ss store.Store) }) t.Run("expired key should fail", func(t *testing.T) { - pluginId, tearDown := setupKVs(t, rctx, ss) + pluginID, tearDown := setupKVs(t, rctx, ss) defer tearDown() key := model.NewId() @@ -589,7 +589,7 @@ func testPluginCompareAndDelete(t *testing.T, rctx request.CTX, ss store.Store) expireAt := int64(1) kv := &model.PluginKeyValue{ - PluginId: pluginId, + PluginId: pluginID, Key: key, Value: []byte(value), ExpireAt: expireAt, @@ -613,7 +613,7 @@ func testPluginCompareAndDelete(t *testing.T, rctx request.CTX, ss store.Store) }) t.Run("existing key should fail given different old value", func(t *testing.T) { - pluginId, tearDown := setupKVs(t, rctx, ss) + pluginID, tearDown := setupKVs(t, rctx, ss) defer tearDown() key := model.NewId() @@ -621,7 +621,7 @@ func testPluginCompareAndDelete(t *testing.T, rctx request.CTX, ss store.Store) expireAt := int64(0) kv := &model.PluginKeyValue{ - PluginId: pluginId, + PluginId: pluginID, Key: key, Value: []byte(value), ExpireAt: expireAt, @@ -637,7 +637,7 @@ func testPluginCompareAndDelete(t *testing.T, rctx request.CTX, ss store.Store) }) t.Run("existing key should succeed given same old value", func(t *testing.T) { - pluginId, tearDown := setupKVs(t, rctx, ss) + pluginID, tearDown := setupKVs(t, rctx, ss) defer tearDown() key := model.NewId() @@ -645,7 +645,7 @@ func testPluginCompareAndDelete(t *testing.T, rctx request.CTX, ss store.Store) expireAt := int64(0) kv := &model.PluginKeyValue{ - PluginId: pluginId, + PluginId: pluginID, Key: key, Value: []byte(value), ExpireAt: expireAt, @@ -666,7 +666,7 @@ func testPluginSetWithOptions(t *testing.T, rctx request.CTX, ss store.Store) { _, tearDown := setupKVs(t, rctx, ss) defer tearDown() - pluginId := "" + pluginID := "" key := model.NewId() value := model.NewId() options := model.PluginKVSetOptions{ @@ -674,7 +674,7 @@ func testPluginSetWithOptions(t *testing.T, rctx request.CTX, ss store.Store) { OldValue: []byte("not-nil"), } - ok, err := ss.Plugin().SetWithOptions(pluginId, key, []byte(value), options) + ok, err := ss.Plugin().SetWithOptions(pluginID, key, []byte(value), options) require.Error(t, err) assert.False(t, ok) appErr, ok := err.(*model.AppError) @@ -686,12 +686,12 @@ func testPluginSetWithOptions(t *testing.T, rctx request.CTX, ss store.Store) { _, tearDown := setupKVs(t, rctx, ss) defer tearDown() - pluginId := "" + pluginID := "" key := model.NewId() value := model.NewId() options := model.PluginKVSetOptions{} - ok, err := ss.Plugin().SetWithOptions(pluginId, key, []byte(value), options) + ok, err := ss.Plugin().SetWithOptions(pluginID, key, []byte(value), options) require.Error(t, err) assert.False(t, ok) appErr, ok := err.(*model.AppError) @@ -737,10 +737,10 @@ func testPluginSetWithOptions(t *testing.T, rctx request.CTX, ss store.Store) { func testPluginGet(t *testing.T, rctx request.CTX, ss store.Store) { t.Run("no matching key value", func(t *testing.T) { - pluginId := model.NewId() + pluginID := model.NewId() key := model.NewId() - kv, nErr := ss.Plugin().Get(pluginId, key) + kv, nErr := ss.Plugin().Get(pluginID, key) _, ok := nErr.(*store.ErrNotFound) require.Error(t, nErr) assert.True(t, ok) @@ -748,13 +748,13 @@ func testPluginGet(t *testing.T, rctx request.CTX, ss store.Store) { }) t.Run("no-matching key value for plugin id", func(t *testing.T) { - pluginId := model.NewId() + pluginID := model.NewId() key := model.NewId() value := model.NewId() expireAt := int64(0) kv := &model.PluginKeyValue{ - PluginId: pluginId, + PluginId: pluginID, Key: key, Value: []byte(value), ExpireAt: expireAt, @@ -771,13 +771,13 @@ func testPluginGet(t *testing.T, rctx request.CTX, ss store.Store) { }) t.Run("no-matching key value for key", func(t *testing.T) { - pluginId := model.NewId() + pluginID := model.NewId() key := model.NewId() value := model.NewId() expireAt := int64(0) kv := &model.PluginKeyValue{ - PluginId: pluginId, + PluginId: pluginID, Key: key, Value: []byte(value), ExpireAt: expireAt, @@ -786,7 +786,7 @@ func testPluginGet(t *testing.T, rctx request.CTX, ss store.Store) { _, err := ss.Plugin().SaveOrUpdate(kv) require.NoError(t, err) - kv, err = ss.Plugin().Get(pluginId, model.NewId()) + kv, err = ss.Plugin().Get(pluginID, model.NewId()) _, ok := err.(*store.ErrNotFound) require.Error(t, err) assert.True(t, ok) @@ -794,13 +794,13 @@ func testPluginGet(t *testing.T, rctx request.CTX, ss store.Store) { }) t.Run("old expired key value", func(t *testing.T) { - pluginId := model.NewId() + pluginID := model.NewId() key := model.NewId() value := model.NewId() expireAt := int64(1) kv := &model.PluginKeyValue{ - PluginId: pluginId, + PluginId: pluginID, Key: key, Value: []byte(value), ExpireAt: expireAt, @@ -809,7 +809,7 @@ func testPluginGet(t *testing.T, rctx request.CTX, ss store.Store) { _, err := ss.Plugin().SaveOrUpdate(kv) require.NoError(t, err) - kv, err = ss.Plugin().Get(pluginId, model.NewId()) + kv, err = ss.Plugin().Get(pluginID, model.NewId()) _, ok := err.(*store.ErrNotFound) require.Error(t, err) assert.True(t, ok) @@ -817,13 +817,13 @@ func testPluginGet(t *testing.T, rctx request.CTX, ss store.Store) { }) t.Run("recently expired key value", func(t *testing.T) { - pluginId := model.NewId() + pluginID := model.NewId() key := model.NewId() value := model.NewId() expireAt := model.GetMillis() - 15*1000 kv := &model.PluginKeyValue{ - PluginId: pluginId, + PluginId: pluginID, Key: key, Value: []byte(value), ExpireAt: expireAt, @@ -832,7 +832,7 @@ func testPluginGet(t *testing.T, rctx request.CTX, ss store.Store) { _, err := ss.Plugin().SaveOrUpdate(kv) require.NoError(t, err) - kv, err = ss.Plugin().Get(pluginId, model.NewId()) + kv, err = ss.Plugin().Get(pluginID, model.NewId()) _, ok := err.(*store.ErrNotFound) require.Error(t, err) assert.True(t, ok) @@ -840,13 +840,13 @@ func testPluginGet(t *testing.T, rctx request.CTX, ss store.Store) { }) t.Run("matching key value, non-expiring", func(t *testing.T) { - pluginId := model.NewId() + pluginID := model.NewId() key := model.NewId() value := model.NewId() expireAt := int64(0) kv := &model.PluginKeyValue{ - PluginId: pluginId, + PluginId: pluginID, Key: key, Value: []byte(value), ExpireAt: expireAt, @@ -855,19 +855,19 @@ func testPluginGet(t *testing.T, rctx request.CTX, ss store.Store) { _, err := ss.Plugin().SaveOrUpdate(kv) require.NoError(t, err) - actualKV, err := ss.Plugin().Get(pluginId, key) + actualKV, err := ss.Plugin().Get(pluginID, key) require.NoError(t, err) require.Equal(t, kv, actualKV) }) t.Run("matching key value, not yet expired", func(t *testing.T) { - pluginId := model.NewId() + pluginID := model.NewId() key := model.NewId() value := model.NewId() expireAt := model.GetMillis() + 15*1000 kv := &model.PluginKeyValue{ - PluginId: pluginId, + PluginId: pluginID, Key: key, Value: []byte(value), ExpireAt: expireAt, @@ -876,7 +876,7 @@ func testPluginGet(t *testing.T, rctx request.CTX, ss store.Store) { _, err := ss.Plugin().SaveOrUpdate(kv) require.NoError(t, err) - actualKV, err := ss.Plugin().Get(pluginId, key) + actualKV, err := ss.Plugin().Get(pluginID, key) require.NoError(t, err) require.Equal(t, kv, actualKV) }) @@ -884,15 +884,15 @@ func testPluginGet(t *testing.T, rctx request.CTX, ss store.Store) { func testPluginDelete(t *testing.T, rctx request.CTX, ss store.Store) { t.Run("no matching key value", func(t *testing.T) { - pluginId, tearDown := setupKVs(t, rctx, ss) + pluginID, tearDown := setupKVs(t, rctx, ss) defer tearDown() key := model.NewId() - err := ss.Plugin().Delete(pluginId, key) + err := ss.Plugin().Delete(pluginID, key) require.NoError(t, err) - kv, err := ss.Plugin().Get(pluginId, key) + kv, err := ss.Plugin().Get(pluginID, key) _, ok := err.(*store.ErrNotFound) require.Error(t, err) assert.True(t, ok) @@ -919,7 +919,7 @@ func testPluginDelete(t *testing.T, rctx request.CTX, ss store.Store) { for _, testCase := range testCases { t.Run(testCase.description, func(t *testing.T) { - pluginId, tearDown := setupKVs(t, rctx, ss) + pluginID, tearDown := setupKVs(t, rctx, ss) defer tearDown() key := model.NewId() @@ -927,7 +927,7 @@ func testPluginDelete(t *testing.T, rctx request.CTX, ss store.Store) { expireAt := testCase.expireAt kv := &model.PluginKeyValue{ - PluginId: pluginId, + PluginId: pluginID, Key: key, Value: []byte(value), ExpireAt: expireAt, @@ -936,10 +936,10 @@ func testPluginDelete(t *testing.T, rctx request.CTX, ss store.Store) { _, err := ss.Plugin().SaveOrUpdate(kv) require.NoError(t, err) - err = ss.Plugin().Delete(pluginId, key) + err = ss.Plugin().Delete(pluginID, key) require.NoError(t, err) - kv, err = ss.Plugin().Get(pluginId, key) + kv, err = ss.Plugin().Get(pluginID, key) _, ok := err.(*store.ErrNotFound) require.Error(t, err) assert.True(t, ok) @@ -950,13 +950,13 @@ func testPluginDelete(t *testing.T, rctx request.CTX, ss store.Store) { func testPluginDeleteAllForPlugin(t *testing.T, rctx request.CTX, ss store.Store) { setupKVsForDeleteAll := func(t *testing.T) (string, func()) { - pluginId := model.NewId() - otherPluginId := model.NewId() + pluginID := model.NewId() + otherPluginID := model.NewId() // otherPluginKV is another key value for another plugin, and used to verify other // keys aren't modified unintentionally. otherPluginKV := &model.PluginKeyValue{ - PluginId: otherPluginId, + PluginId: otherPluginID, Key: model.NewId(), Value: []byte(model.NewId()), ExpireAt: 0, @@ -964,7 +964,7 @@ func testPluginDeleteAllForPlugin(t *testing.T, rctx request.CTX, ss store.Store _, err := ss.Plugin().SaveOrUpdate(otherPluginKV) require.NoError(t, err) - return pluginId, func() { + return pluginID, func() { actualOtherPluginKV, err := ss.Plugin().Get(otherPluginKV.PluginId, otherPluginKV.Key) require.NoError(t, err, "failed to find other key value from different plugin") assert.Equal(t, otherPluginKV, actualOtherPluginKV) @@ -972,19 +972,19 @@ func testPluginDeleteAllForPlugin(t *testing.T, rctx request.CTX, ss store.Store } t.Run("no keys to delete", func(t *testing.T) { - pluginId, tearDown := setupKVsForDeleteAll(t) + pluginID, tearDown := setupKVsForDeleteAll(t) defer tearDown() - err := ss.Plugin().DeleteAllForPlugin(pluginId) + err := ss.Plugin().DeleteAllForPlugin(pluginID) require.NoError(t, err) }) t.Run("multiple keys to delete", func(t *testing.T) { - pluginId, tearDown := setupKVsForDeleteAll(t) + pluginID, tearDown := setupKVsForDeleteAll(t) defer tearDown() kv := &model.PluginKeyValue{ - PluginId: pluginId, + PluginId: pluginID, Key: model.NewId(), Value: []byte(model.NewId()), ExpireAt: 0, @@ -993,7 +993,7 @@ func testPluginDeleteAllForPlugin(t *testing.T, rctx request.CTX, ss store.Store require.NoError(t, err) kv2 := &model.PluginKeyValue{ - PluginId: pluginId, + PluginId: pluginID, Key: model.NewId(), Value: []byte(model.NewId()), ExpireAt: 0, @@ -1001,7 +1001,7 @@ func testPluginDeleteAllForPlugin(t *testing.T, rctx request.CTX, ss store.Store _, err = ss.Plugin().SaveOrUpdate(kv2) require.NoError(t, err) - err = ss.Plugin().DeleteAllForPlugin(pluginId) + err = ss.Plugin().DeleteAllForPlugin(pluginID) require.NoError(t, err) _, err = ss.Plugin().Get(kv.PluginId, kv.Key) @@ -1023,11 +1023,11 @@ func testPluginDeleteAllExpired(t *testing.T, rctx request.CTX, ss store.Store) }) t.Run("no expiring keys to delete", func(t *testing.T) { - pluginIdA := model.NewId() - pluginIdB := model.NewId() + pluginIDA := model.NewId() + pluginIDB := model.NewId() kvA1 := &model.PluginKeyValue{ - PluginId: pluginIdA, + PluginId: pluginIDA, Key: model.NewId(), Value: []byte(model.NewId()), ExpireAt: 0, @@ -1036,7 +1036,7 @@ func testPluginDeleteAllExpired(t *testing.T, rctx request.CTX, ss store.Store) require.NoError(t, err) kvA2 := &model.PluginKeyValue{ - PluginId: pluginIdA, + PluginId: pluginIDA, Key: model.NewId(), Value: []byte(model.NewId()), ExpireAt: 0, @@ -1045,7 +1045,7 @@ func testPluginDeleteAllExpired(t *testing.T, rctx request.CTX, ss store.Store) require.NoError(t, err) kvB1 := &model.PluginKeyValue{ - PluginId: pluginIdB, + PluginId: pluginIDB, Key: model.NewId(), Value: []byte(model.NewId()), ExpireAt: 0, @@ -1054,7 +1054,7 @@ func testPluginDeleteAllExpired(t *testing.T, rctx request.CTX, ss store.Store) require.NoError(t, err) kvB2 := &model.PluginKeyValue{ - PluginId: pluginIdB, + PluginId: pluginIDB, Key: model.NewId(), Value: []byte(model.NewId()), ExpireAt: 0, @@ -1065,29 +1065,29 @@ func testPluginDeleteAllExpired(t *testing.T, rctx request.CTX, ss store.Store) err = ss.Plugin().DeleteAllExpired() require.NoError(t, err) - actualKVA1, err := ss.Plugin().Get(pluginIdA, kvA1.Key) + actualKVA1, err := ss.Plugin().Get(pluginIDA, kvA1.Key) require.NoError(t, err) assert.Equal(t, kvA1, actualKVA1) - actualKVA2, err := ss.Plugin().Get(pluginIdA, kvA2.Key) + actualKVA2, err := ss.Plugin().Get(pluginIDA, kvA2.Key) require.NoError(t, err) assert.Equal(t, kvA2, actualKVA2) - actualKVB1, err := ss.Plugin().Get(pluginIdB, kvB1.Key) + actualKVB1, err := ss.Plugin().Get(pluginIDB, kvB1.Key) require.NoError(t, err) assert.Equal(t, kvB1, actualKVB1) - actualKVB2, err := ss.Plugin().Get(pluginIdB, kvB2.Key) + actualKVB2, err := ss.Plugin().Get(pluginIDB, kvB2.Key) require.NoError(t, err) assert.Equal(t, kvB2, actualKVB2) }) t.Run("no expired keys to delete", func(t *testing.T) { - pluginIdA := model.NewId() - pluginIdB := model.NewId() + pluginIDA := model.NewId() + pluginIDB := model.NewId() kvA1 := &model.PluginKeyValue{ - PluginId: pluginIdA, + PluginId: pluginIDA, Key: model.NewId(), Value: []byte(model.NewId()), ExpireAt: model.GetMillis() + 15*1000, @@ -1096,7 +1096,7 @@ func testPluginDeleteAllExpired(t *testing.T, rctx request.CTX, ss store.Store) require.NoError(t, err) kvA2 := &model.PluginKeyValue{ - PluginId: pluginIdA, + PluginId: pluginIDA, Key: model.NewId(), Value: []byte(model.NewId()), ExpireAt: model.GetMillis() + 15*1000, @@ -1105,7 +1105,7 @@ func testPluginDeleteAllExpired(t *testing.T, rctx request.CTX, ss store.Store) require.NoError(t, err) kvB1 := &model.PluginKeyValue{ - PluginId: pluginIdB, + PluginId: pluginIDB, Key: model.NewId(), Value: []byte(model.NewId()), ExpireAt: model.GetMillis() + 15*1000, @@ -1114,7 +1114,7 @@ func testPluginDeleteAllExpired(t *testing.T, rctx request.CTX, ss store.Store) require.NoError(t, err) kvB2 := &model.PluginKeyValue{ - PluginId: pluginIdB, + PluginId: pluginIDB, Key: model.NewId(), Value: []byte(model.NewId()), ExpireAt: model.GetMillis() + 15*1000, @@ -1125,29 +1125,29 @@ func testPluginDeleteAllExpired(t *testing.T, rctx request.CTX, ss store.Store) err = ss.Plugin().DeleteAllExpired() require.NoError(t, err) - actualKVA1, err := ss.Plugin().Get(pluginIdA, kvA1.Key) + actualKVA1, err := ss.Plugin().Get(pluginIDA, kvA1.Key) require.NoError(t, err) assert.Equal(t, kvA1, actualKVA1) - actualKVA2, err := ss.Plugin().Get(pluginIdA, kvA2.Key) + actualKVA2, err := ss.Plugin().Get(pluginIDA, kvA2.Key) require.NoError(t, err) assert.Equal(t, kvA2, actualKVA2) - actualKVB1, err := ss.Plugin().Get(pluginIdB, kvB1.Key) + actualKVB1, err := ss.Plugin().Get(pluginIDB, kvB1.Key) require.NoError(t, err) assert.Equal(t, kvB1, actualKVB1) - actualKVB2, err := ss.Plugin().Get(pluginIdB, kvB2.Key) + actualKVB2, err := ss.Plugin().Get(pluginIDB, kvB2.Key) require.NoError(t, err) assert.Equal(t, kvB2, actualKVB2) }) t.Run("some expired keys to delete", func(t *testing.T) { - pluginIdA := model.NewId() - pluginIdB := model.NewId() + pluginIDA := model.NewId() + pluginIDB := model.NewId() kvA1 := &model.PluginKeyValue{ - PluginId: pluginIdA, + PluginId: pluginIDA, Key: model.NewId(), Value: []byte(model.NewId()), ExpireAt: model.GetMillis() + 15*1000, @@ -1156,7 +1156,7 @@ func testPluginDeleteAllExpired(t *testing.T, rctx request.CTX, ss store.Store) require.NoError(t, err) expiredKVA2 := &model.PluginKeyValue{ - PluginId: pluginIdA, + PluginId: pluginIDA, Key: model.NewId(), Value: []byte(model.NewId()), ExpireAt: model.GetMillis() - 15*1000, @@ -1165,7 +1165,7 @@ func testPluginDeleteAllExpired(t *testing.T, rctx request.CTX, ss store.Store) require.NoError(t, err) kvB1 := &model.PluginKeyValue{ - PluginId: pluginIdB, + PluginId: pluginIDB, Key: model.NewId(), Value: []byte(model.NewId()), ExpireAt: model.GetMillis() + 15*1000, @@ -1174,7 +1174,7 @@ func testPluginDeleteAllExpired(t *testing.T, rctx request.CTX, ss store.Store) require.NoError(t, err) expiredKVB2 := &model.PluginKeyValue{ - PluginId: pluginIdB, + PluginId: pluginIDB, Key: model.NewId(), Value: []byte(model.NewId()), ExpireAt: model.GetMillis() - 15*1000, @@ -1185,21 +1185,21 @@ func testPluginDeleteAllExpired(t *testing.T, rctx request.CTX, ss store.Store) err = ss.Plugin().DeleteAllExpired() require.NoError(t, err) - actualKVA1, err := ss.Plugin().Get(pluginIdA, kvA1.Key) + actualKVA1, err := ss.Plugin().Get(pluginIDA, kvA1.Key) require.NoError(t, err) assert.Equal(t, kvA1, actualKVA1) - actualKVA2, err := ss.Plugin().Get(pluginIdA, expiredKVA2.Key) + actualKVA2, err := ss.Plugin().Get(pluginIDA, expiredKVA2.Key) _, ok := err.(*store.ErrNotFound) require.Error(t, err) assert.True(t, ok) assert.Nil(t, actualKVA2) - actualKVB1, err := ss.Plugin().Get(pluginIdB, kvB1.Key) + actualKVB1, err := ss.Plugin().Get(pluginIDB, kvB1.Key) require.NoError(t, err) assert.Equal(t, kvB1, actualKVB1) - actualKVB2, err := ss.Plugin().Get(pluginIdB, expiredKVB2.Key) + actualKVB2, err := ss.Plugin().Get(pluginIDB, expiredKVB2.Key) _, ok = err.(*store.ErrNotFound) require.Error(t, err) assert.True(t, ok) @@ -1212,9 +1212,9 @@ func testPluginList(t *testing.T, rctx request.CTX, ss store.Store) { _, tearDown := setupKVs(t, rctx, ss) defer tearDown() - // Ignore the pluginId setup by setupKVs - pluginId := model.NewId() - keys, err := ss.Plugin().List(pluginId, 0, 100) + // Ignore the pluginID setup by setupKVs + pluginID := model.NewId() + keys, err := ss.Plugin().List(pluginID, 0, 100) require.NoError(t, err) assert.Empty(t, keys) }) @@ -1223,11 +1223,11 @@ func testPluginList(t *testing.T, rctx request.CTX, ss store.Store) { _, tearDown := setupKVs(t, rctx, ss) defer tearDown() - // Ignore the pluginId setup by setupKVs - pluginId := model.NewId() + // Ignore the pluginID setup by setupKVs + pluginID := model.NewId() kv := &model.PluginKeyValue{ - PluginId: pluginId, + PluginId: pluginID, Key: model.NewId(), Value: []byte(model.NewId()), ExpireAt: 0, @@ -1235,7 +1235,7 @@ func testPluginList(t *testing.T, rctx request.CTX, ss store.Store) { _, err := ss.Plugin().SaveOrUpdate(kv) require.NoError(t, err) - keys, err := ss.Plugin().List(pluginId, 0, 100) + keys, err := ss.Plugin().List(pluginID, 0, 100) require.NoError(t, err) require.Len(t, keys, 1) assert.Equal(t, kv.Key, keys[0]) @@ -1245,14 +1245,14 @@ func testPluginList(t *testing.T, rctx request.CTX, ss store.Store) { _, tearDown := setupKVs(t, rctx, ss) defer tearDown() - // Ignore the pluginId setup by setupKVs - pluginId := model.NewId() + // Ignore the pluginID setup by setupKVs + pluginID := model.NewId() var keys []string for i := 0; i < 150; i++ { key := model.NewId() kv := &model.PluginKeyValue{ - PluginId: pluginId, + PluginId: pluginID, Key: key, Value: []byte(model.NewId()), ExpireAt: 0, @@ -1264,11 +1264,11 @@ func testPluginList(t *testing.T, rctx request.CTX, ss store.Store) { } sort.Strings(keys) - keys1, err := ss.Plugin().List(pluginId, 0, 100) + keys1, err := ss.Plugin().List(pluginID, 0, 100) require.NoError(t, err) require.Len(t, keys1, 100) - keys2, err := ss.Plugin().List(pluginId, 100, 100) + keys2, err := ss.Plugin().List(pluginID, 100, 100) require.NoError(t, err) require.Len(t, keys2, 50) @@ -1282,8 +1282,8 @@ func testPluginList(t *testing.T, rctx request.CTX, ss store.Store) { _, tearDown := setupKVs(t, rctx, ss) defer tearDown() - // Ignore the pluginId setup by setupKVs - pluginId := model.NewId() + // Ignore the pluginID setup by setupKVs + pluginID := model.NewId() var keys []string now := model.GetMillis() @@ -1300,7 +1300,7 @@ func testPluginList(t *testing.T, rctx request.CTX, ss store.Store) { } kv := &model.PluginKeyValue{ - PluginId: pluginId, + PluginId: pluginID, Key: key, Value: []byte(model.NewId()), ExpireAt: expireAt, @@ -1314,11 +1314,11 @@ func testPluginList(t *testing.T, rctx request.CTX, ss store.Store) { } sort.Strings(keys) - keys1, err := ss.Plugin().List(pluginId, 0, 100) + keys1, err := ss.Plugin().List(pluginID, 0, 100) require.NoError(t, err) require.Len(t, keys1, 100) - keys2, err := ss.Plugin().List(pluginId, 100, 100) + keys2, err := ss.Plugin().List(pluginID, 100, 100) require.NoError(t, err) require.Len(t, keys2, 35) @@ -1332,14 +1332,14 @@ func testPluginList(t *testing.T, rctx request.CTX, ss store.Store) { _, tearDown := setupKVs(t, rctx, ss) defer tearDown() - // Ignore the pluginId setup by setupKVs - pluginId := model.NewId() + // Ignore the pluginID setup by setupKVs + pluginID := model.NewId() var keys []string for i := 0; i < 150; i++ { key := model.NewId() kv := &model.PluginKeyValue{ - PluginId: pluginId, + PluginId: pluginID, Key: key, Value: []byte(model.NewId()), ExpireAt: 0, @@ -1352,19 +1352,19 @@ func testPluginList(t *testing.T, rctx request.CTX, ss store.Store) { sort.Strings(keys) t.Run("default limit", func(t *testing.T) { - keys1, err := ss.Plugin().List(pluginId, 0, 0) + keys1, err := ss.Plugin().List(pluginID, 0, 0) require.NoError(t, err) require.Len(t, keys1, 10) }) t.Run("offset 0, limit 1", func(t *testing.T) { - keys2, err := ss.Plugin().List(pluginId, 0, 1) + keys2, err := ss.Plugin().List(pluginID, 0, 1) require.NoError(t, err) require.Len(t, keys2, 1) }) t.Run("offset 1, limit 1", func(t *testing.T) { - keys2, err := ss.Plugin().List(pluginId, 1, 1) + keys2, err := ss.Plugin().List(pluginID, 1, 1) require.NoError(t, err) require.Len(t, keys2, 1) }) diff --git a/server/channels/store/storetest/post_acknowledgements_store.go b/server/channels/store/storetest/post_acknowledgements_store.go index d0a6338fc9e90..dc51735c24d6e 100644 --- a/server/channels/store/storetest/post_acknowledgements_store.go +++ b/server/channels/store/storetest/post_acknowledgements_store.go @@ -20,12 +20,12 @@ func TestPostAcknowledgementsStore(t *testing.T, rctx request.CTX, ss store.Stor } func testPostAcknowledgementsStoreSave(t *testing.T, rctx request.CTX, ss store.Store) { - userId1 := model.NewId() + userID1 := model.NewId() p1 := model.Post{} p1.ChannelId = model.NewId() p1.UserId = model.NewId() - p1.Message = NewTestId() + p1.Message = NewTestID() p1.Metadata = &model.PostMetadata{ Priority: &model.PostPriority{ Priority: model.NewPointer("important"), @@ -37,13 +37,13 @@ func testPostAcknowledgementsStoreSave(t *testing.T, rctx request.CTX, ss store. require.NoError(t, err) t.Run("consecutive saves should just update the acknowledged at", func(t *testing.T) { - _, err := ss.PostAcknowledgement().Save(post.Id, userId1, 0) + _, err := ss.PostAcknowledgement().Save(post.Id, userID1, 0) require.NoError(t, err) - _, err = ss.PostAcknowledgement().Save(post.Id, userId1, 0) + _, err = ss.PostAcknowledgement().Save(post.Id, userID1, 0) require.NoError(t, err) - ack1, err := ss.PostAcknowledgement().Save(post.Id, userId1, 0) + ack1, err := ss.PostAcknowledgement().Save(post.Id, userID1, 0) require.NoError(t, err) acknowledgements, err := ss.PostAcknowledgement().GetForPost(post.Id) @@ -53,7 +53,7 @@ func testPostAcknowledgementsStoreSave(t *testing.T, rctx request.CTX, ss store. t.Run("saving should update the update at of the post", func(t *testing.T) { oldUpdateAt := post.UpdateAt - _, err := ss.PostAcknowledgement().Save(post.Id, userId1, 0) + _, err := ss.PostAcknowledgement().Save(post.Id, userID1, 0) require.NoError(t, err) post, err = ss.Post().GetSingle(rctx, post.Id, false) @@ -63,14 +63,14 @@ func testPostAcknowledgementsStoreSave(t *testing.T, rctx request.CTX, ss store. } func testPostAcknowledgementsStoreGetForPost(t *testing.T, rctx request.CTX, ss store.Store) { - userId1 := model.NewId() - userId2 := model.NewId() - userId3 := model.NewId() + userID1 := model.NewId() + userID2 := model.NewId() + userID3 := model.NewId() p1 := model.Post{} p1.ChannelId = model.NewId() p1.UserId = model.NewId() - p1.Message = NewTestId() + p1.Message = NewTestID() p1.Metadata = &model.PostMetadata{ Priority: &model.PostPriority{ Priority: model.NewPointer("important"), @@ -82,11 +82,11 @@ func testPostAcknowledgementsStoreGetForPost(t *testing.T, rctx request.CTX, ss require.NoError(t, err) t.Run("get acknowledgements for post", func(t *testing.T) { - ack1, err := ss.PostAcknowledgement().Save(p1.Id, userId1, 0) + ack1, err := ss.PostAcknowledgement().Save(p1.Id, userID1, 0) require.NoError(t, err) - ack2, err := ss.PostAcknowledgement().Save(p1.Id, userId2, 0) + ack2, err := ss.PostAcknowledgement().Save(p1.Id, userID2, 0) require.NoError(t, err) - ack3, err := ss.PostAcknowledgement().Save(p1.Id, userId3, 0) + ack3, err := ss.PostAcknowledgement().Save(p1.Id, userID3, 0) require.NoError(t, err) acknowledgements, err := ss.PostAcknowledgement().GetForPost(p1.Id) @@ -114,14 +114,14 @@ func testPostAcknowledgementsStoreGetForPost(t *testing.T, rctx request.CTX, ss } func testPostAcknowledgementsStoreGetForPosts(t *testing.T, rctx request.CTX, ss store.Store) { - userId1 := model.NewId() - userId2 := model.NewId() - userId3 := model.NewId() + userID1 := model.NewId() + userID2 := model.NewId() + userID3 := model.NewId() p1 := model.Post{} p1.ChannelId = model.NewId() p1.UserId = model.NewId() - p1.Message = NewTestId() + p1.Message = NewTestID() p1.Metadata = &model.PostMetadata{ Priority: &model.PostPriority{ Priority: model.NewPointer("important"), @@ -132,7 +132,7 @@ func testPostAcknowledgementsStoreGetForPosts(t *testing.T, rctx request.CTX, ss p2 := model.Post{} p2.ChannelId = model.NewId() p2.UserId = model.NewId() - p2.Message = NewTestId() + p2.Message = NewTestID() p2.Metadata = &model.PostMetadata{ Priority: &model.PostPriority{ Priority: model.NewPointer(""), @@ -145,13 +145,13 @@ func testPostAcknowledgementsStoreGetForPosts(t *testing.T, rctx request.CTX, ss require.Equal(t, -1, errIdx) t.Run("get acknowledgements for post", func(t *testing.T) { - ack1, err := ss.PostAcknowledgement().Save(p1.Id, userId1, 0) + ack1, err := ss.PostAcknowledgement().Save(p1.Id, userID1, 0) require.NoError(t, err) - ack2, err := ss.PostAcknowledgement().Save(p1.Id, userId2, 0) + ack2, err := ss.PostAcknowledgement().Save(p1.Id, userID2, 0) require.NoError(t, err) - ack3, err := ss.PostAcknowledgement().Save(p2.Id, userId2, 0) + ack3, err := ss.PostAcknowledgement().Save(p2.Id, userID2, 0) require.NoError(t, err) - ack4, err := ss.PostAcknowledgement().Save(p2.Id, userId3, 0) + ack4, err := ss.PostAcknowledgement().Save(p2.Id, userID3, 0) require.NoError(t, err) acknowledgements, err := ss.PostAcknowledgement().GetForPosts([]string{p1.Id}) diff --git a/server/channels/store/storetest/post_persistent_notification_store.go b/server/channels/store/storetest/post_persistent_notification_store.go index 8fce4f2f17d1f..6c1cced5a82a9 100644 --- a/server/channels/store/storetest/post_persistent_notification_store.go +++ b/server/channels/store/storetest/post_persistent_notification_store.go @@ -24,7 +24,7 @@ func testPostPersistentNotificationStoreGet(t *testing.T, rctx request.CTX, ss s p1 := model.Post{} p1.ChannelId = model.NewId() p1.UserId = model.NewId() - p1.Message = NewTestId() + p1.Message = NewTestID() p1.CreateAt = 10 p1.Metadata = &model.PostMetadata{ Priority: &model.PostPriority{ @@ -37,7 +37,7 @@ func testPostPersistentNotificationStoreGet(t *testing.T, rctx request.CTX, ss s p2 := model.Post{} p2.ChannelId = p1.ChannelId p2.UserId = model.NewId() - p2.Message = NewTestId() + p2.Message = NewTestID() p2.CreateAt = 20 p2.Metadata = &model.PostMetadata{ Priority: &model.PostPriority{ @@ -51,14 +51,14 @@ func testPostPersistentNotificationStoreGet(t *testing.T, rctx request.CTX, ss s p3 := model.Post{} p3.ChannelId = p1.ChannelId p3.UserId = model.NewId() - p3.Message = NewTestId() + p3.Message = NewTestID() p3.CreateAt = 30 // Invalid - Notification is false p4 := model.Post{} p4.ChannelId = p1.ChannelId p4.UserId = model.NewId() - p4.Message = NewTestId() + p4.Message = NewTestID() p4.CreateAt = 40 p4.Metadata = &model.PostMetadata{ Priority: &model.PostPriority{ @@ -71,7 +71,7 @@ func testPostPersistentNotificationStoreGet(t *testing.T, rctx request.CTX, ss s p5 := model.Post{} p5.ChannelId = p1.ChannelId p5.UserId = model.NewId() - p5.Message = NewTestId() + p5.Message = NewTestID() p5.CreateAt = 50 p5.Metadata = &model.PostMetadata{ Priority: &model.PostPriority{ @@ -146,7 +146,7 @@ func testPostPersistentNotificationStoreUpdateLastSentAt(t *testing.T, rctx requ p1 := model.Post{} p1.ChannelId = model.NewId() p1.UserId = model.NewId() - p1.Message = NewTestId() + p1.Message = NewTestID() p1.CreateAt = 10 p1.Metadata = &model.PostMetadata{ Priority: &model.PostPriority{ @@ -199,7 +199,7 @@ func testPostPersistentNotificationStoreDelete(t *testing.T, rctx request.CTX, s p1 := model.Post{} p1.ChannelId = model.NewId() p1.UserId = model.NewId() - p1.Message = NewTestId() + p1.Message = NewTestID() p1.CreateAt = 10 p1.Metadata = &model.PostMetadata{ Priority: &model.PostPriority{ @@ -212,7 +212,7 @@ func testPostPersistentNotificationStoreDelete(t *testing.T, rctx request.CTX, s p2 := model.Post{} p2.ChannelId = p1.ChannelId p2.UserId = model.NewId() - p2.Message = NewTestId() + p2.Message = NewTestID() p2.CreateAt = 20 p2.Metadata = &model.PostMetadata{ Priority: &model.PostPriority{ @@ -225,7 +225,7 @@ func testPostPersistentNotificationStoreDelete(t *testing.T, rctx request.CTX, s p3 := model.Post{} p3.ChannelId = p1.ChannelId p3.UserId = model.NewId() - p3.Message = NewTestId() + p3.Message = NewTestID() p3.CreateAt = 30 p3.Metadata = &model.PostMetadata{ Priority: &model.PostPriority{ @@ -259,7 +259,7 @@ func testPostPersistentNotificationStoreDelete(t *testing.T, rctx request.CTX, s p1 := model.Post{} p1.ChannelId = model.NewId() p1.UserId = model.NewId() - p1.Message = NewTestId() + p1.Message = NewTestID() p1.CreateAt = 10 p1.Metadata = &model.PostMetadata{ Priority: &model.PostPriority{ @@ -272,7 +272,7 @@ func testPostPersistentNotificationStoreDelete(t *testing.T, rctx request.CTX, s p2 := model.Post{} p2.ChannelId = p1.ChannelId p2.UserId = model.NewId() - p2.Message = NewTestId() + p2.Message = NewTestID() p2.CreateAt = 20 p2.Metadata = &model.PostMetadata{ Priority: &model.PostPriority{ @@ -285,7 +285,7 @@ func testPostPersistentNotificationStoreDelete(t *testing.T, rctx request.CTX, s p3 := model.Post{} p3.ChannelId = p1.ChannelId p3.UserId = model.NewId() - p3.Message = NewTestId() + p3.Message = NewTestID() p3.CreateAt = 30 p3.Metadata = &model.PostMetadata{ Priority: &model.PostPriority{ @@ -298,7 +298,7 @@ func testPostPersistentNotificationStoreDelete(t *testing.T, rctx request.CTX, s p4 := model.Post{} p4.ChannelId = model.NewId() p4.UserId = model.NewId() - p4.Message = NewTestId() + p4.Message = NewTestID() p4.CreateAt = 40 p4.Metadata = &model.PostMetadata{ Priority: &model.PostPriority{ @@ -311,7 +311,7 @@ func testPostPersistentNotificationStoreDelete(t *testing.T, rctx request.CTX, s p5 := model.Post{} p5.ChannelId = p4.ChannelId p5.UserId = model.NewId() - p5.Message = NewTestId() + p5.Message = NewTestID() p5.CreateAt = 50 p5.Metadata = &model.PostMetadata{ Priority: &model.PostPriority{ @@ -343,10 +343,10 @@ func testPostPersistentNotificationStoreDelete(t *testing.T, rctx request.CTX, s }) t.Run("Delete By Team", func(t *testing.T) { - t1 := &model.Team{DisplayName: "t1", Name: NewTestId(), Email: MakeEmail(), Type: model.TeamOpen} + t1 := &model.Team{DisplayName: "t1", Name: NewTestID(), Email: MakeEmail(), Type: model.TeamOpen} _, err := ss.Team().Save(t1) require.NoError(t, err) - t2 := &model.Team{DisplayName: "t2", Name: NewTestId(), Email: MakeEmail(), Type: model.TeamOpen} + t2 := &model.Team{DisplayName: "t2", Name: NewTestID(), Email: MakeEmail(), Type: model.TeamOpen} _, err = ss.Team().Save(t2) require.NoError(t, err) @@ -363,7 +363,7 @@ func testPostPersistentNotificationStoreDelete(t *testing.T, rctx request.CTX, s p1 := model.Post{} p1.ChannelId = c1.Id p1.UserId = model.NewId() - p1.Message = NewTestId() + p1.Message = NewTestID() p1.CreateAt = 10 p1.Metadata = &model.PostMetadata{ Priority: &model.PostPriority{ @@ -376,7 +376,7 @@ func testPostPersistentNotificationStoreDelete(t *testing.T, rctx request.CTX, s p2 := model.Post{} p2.ChannelId = p1.ChannelId p2.UserId = model.NewId() - p2.Message = NewTestId() + p2.Message = NewTestID() p2.CreateAt = 20 p2.Metadata = &model.PostMetadata{ Priority: &model.PostPriority{ @@ -389,7 +389,7 @@ func testPostPersistentNotificationStoreDelete(t *testing.T, rctx request.CTX, s p3 := model.Post{} p3.ChannelId = c2.Id p3.UserId = model.NewId() - p3.Message = NewTestId() + p3.Message = NewTestID() p3.CreateAt = 30 p3.Metadata = &model.PostMetadata{ Priority: &model.PostPriority{ @@ -402,7 +402,7 @@ func testPostPersistentNotificationStoreDelete(t *testing.T, rctx request.CTX, s p4 := model.Post{} p4.ChannelId = c3.Id p4.UserId = model.NewId() - p4.Message = NewTestId() + p4.Message = NewTestID() p4.CreateAt = 40 p4.Metadata = &model.PostMetadata{ Priority: &model.PostPriority{ @@ -415,7 +415,7 @@ func testPostPersistentNotificationStoreDelete(t *testing.T, rctx request.CTX, s p5 := model.Post{} p5.ChannelId = p4.ChannelId p5.UserId = model.NewId() - p5.Message = NewTestId() + p5.Message = NewTestID() p5.CreateAt = 50 p5.Metadata = &model.PostMetadata{ Priority: &model.PostPriority{ diff --git a/server/channels/store/storetest/post_priority_store.go b/server/channels/store/storetest/post_priority_store.go index 33e402a983ec9..49aa8d1cccbf2 100644 --- a/server/channels/store/storetest/post_priority_store.go +++ b/server/channels/store/storetest/post_priority_store.go @@ -25,7 +25,7 @@ func testPostPriorityStoreGetForPost(t *testing.T, rctx request.CTX, ss store.St p1 := model.Post{} p1.ChannelId = model.NewId() p1.UserId = model.NewId() - p1.Message = NewTestId() + p1.Message = NewTestID() p1.Metadata = &model.PostMetadata{ Priority: &model.PostPriority{ Priority: model.NewPointer("important"), @@ -37,7 +37,7 @@ func testPostPriorityStoreGetForPost(t *testing.T, rctx request.CTX, ss store.St p2 := model.Post{} p2.ChannelId = model.NewId() p2.UserId = model.NewId() - p2.Message = NewTestId() + p2.Message = NewTestID() p2.Metadata = &model.PostMetadata{ Priority: &model.PostPriority{ Priority: model.NewPointer(model.PostPriorityUrgent), @@ -49,7 +49,7 @@ func testPostPriorityStoreGetForPost(t *testing.T, rctx request.CTX, ss store.St p3 := model.Post{} p3.ChannelId = model.NewId() p3.UserId = model.NewId() - p3.Message = NewTestId() + p3.Message = NewTestID() _, errIdx, err := ss.Post().SaveMultiple([]*model.Post{&p1, &p2, &p3}) require.NoError(t, err) diff --git a/server/channels/store/storetest/post_store.go b/server/channels/store/storetest/post_store.go index df7e1a58e8779..d0cc64b5e1b21 100644 --- a/server/channels/store/storetest/post_store.go +++ b/server/channels/store/storetest/post_store.go @@ -72,7 +72,7 @@ func testPostStoreSave(t *testing.T, rctx request.CTX, ss store.Store) { o1 := model.Post{} o1.ChannelId = model.NewId() o1.UserId = model.NewId() - o1.Message = NewTestId() + o1.Message = NewTestID() p, err := ss.Post().Save(rctx, &o1) require.NoError(t, err, "couldn't save item") @@ -80,9 +80,9 @@ func testPostStoreSave(t *testing.T, rctx request.CTX, ss store.Store) { }) t.Run("Save replies", func(t *testing.T) { - teamId := model.NewId() + teamID := model.NewId() channel1, err := ss.Channel().Save(rctx, &model.Channel{ - TeamId: teamId, + TeamId: teamID, DisplayName: "DisplayName1", Name: "channel" + model.NewId(), Type: model.ChannelTypeOpen, @@ -93,10 +93,10 @@ func testPostStoreSave(t *testing.T, rctx request.CTX, ss store.Store) { o1.ChannelId = channel1.Id o1.UserId = model.NewId() o1.RootId = model.NewId() - o1.Message = NewTestId() + o1.Message = NewTestID() channel2, err := ss.Channel().Save(rctx, &model.Channel{ - TeamId: teamId, + TeamId: teamID, DisplayName: "DisplayName2", Name: "channel" + model.NewId(), Type: model.ChannelTypeOpen, @@ -107,10 +107,10 @@ func testPostStoreSave(t *testing.T, rctx request.CTX, ss store.Store) { o2.ChannelId = channel2.Id o2.UserId = model.NewId() o2.RootId = o1.RootId - o2.Message = NewTestId() + o2.Message = NewTestID() channel3, err := ss.Channel().Save(rctx, &model.Channel{ - TeamId: teamId, + TeamId: teamID, DisplayName: "DisplayName3", Name: "channel" + model.NewId(), Type: model.ChannelTypeOpen, @@ -121,7 +121,7 @@ func testPostStoreSave(t *testing.T, rctx request.CTX, ss store.Store) { o3.ChannelId = channel3.Id o3.UserId = model.NewId() o3.RootId = model.NewId() - o3.Message = NewTestId() + o3.Message = NewTestID() p1, err := ss.Post().Save(rctx, &o1) require.NoError(t, err, "couldn't save item") @@ -140,7 +140,7 @@ func testPostStoreSave(t *testing.T, rctx request.CTX, ss store.Store) { o1 := model.Post{} o1.ChannelId = model.NewId() o1.UserId = model.NewId() - o1.Message = NewTestId() + o1.Message = NewTestID() _, err := ss.Post().Save(rctx, &o1) require.NoError(t, err, "couldn't save item") @@ -150,9 +150,9 @@ func testPostStoreSave(t *testing.T, rctx request.CTX, ss store.Store) { }) t.Run("Update reply should update the UpdateAt of the root post", func(t *testing.T) { - teamId := model.NewId() + teamID := model.NewId() channel, err := ss.Channel().Save(rctx, &model.Channel{ - TeamId: teamId, + TeamId: teamID, DisplayName: "DisplayName1", Name: "channel" + model.NewId(), Type: model.ChannelTypeOpen, @@ -162,7 +162,7 @@ func testPostStoreSave(t *testing.T, rctx request.CTX, ss store.Store) { rootPost := model.Post{} rootPost.ChannelId = channel.Id rootPost.UserId = model.NewId() - rootPost.Message = NewTestId() + rootPost.Message = NewTestID() _, err = ss.Post().Save(rctx, &rootPost) require.NoError(t, err) @@ -172,7 +172,7 @@ func testPostStoreSave(t *testing.T, rctx request.CTX, ss store.Store) { replyPost := model.Post{} replyPost.ChannelId = rootPost.ChannelId replyPost.UserId = model.NewId() - replyPost.Message = NewTestId() + replyPost.Message = NewTestID() replyPost.RootId = rootPost.Id // We need to sleep here to be sure the post is not created during the same millisecond @@ -187,8 +187,8 @@ func testPostStoreSave(t *testing.T, rctx request.CTX, ss store.Store) { t.Run("Create a post should update the channel LastPostAt and the total messages count by one", func(t *testing.T) { channel := model.Channel{} - channel.Name = NewTestId() - channel.DisplayName = NewTestId() + channel.Name = NewTestID() + channel.DisplayName = NewTestID() channel.Type = model.ChannelTypeOpen _, err := ss.Channel().Save(rctx, &channel, 100) @@ -197,7 +197,7 @@ func testPostStoreSave(t *testing.T, rctx request.CTX, ss store.Store) { post := model.Post{} post.ChannelId = channel.Id post.UserId = model.NewId() - post.Message = NewTestId() + post.Message = NewTestID() // We need to sleep here to be sure the post is not created during the same millisecond time.Sleep(time.Millisecond) @@ -212,7 +212,7 @@ func testPostStoreSave(t *testing.T, rctx request.CTX, ss store.Store) { post = model.Post{} post.ChannelId = channel.Id post.UserId = model.NewId() - post.Message = NewTestId() + post.Message = NewTestID() post.CreateAt = 5 // We need to sleep here to be sure the post is not created during the same millisecond @@ -228,7 +228,7 @@ func testPostStoreSave(t *testing.T, rctx request.CTX, ss store.Store) { post = model.Post{} post.ChannelId = channel.Id post.UserId = model.NewId() - post.Message = NewTestId() + post.Message = NewTestID() // We need to sleep here to be sure the post is not created during the same millisecond time.Sleep(time.Millisecond) @@ -245,7 +245,7 @@ func testPostStoreSave(t *testing.T, rctx request.CTX, ss store.Store) { o1 := model.Post{} o1.ChannelId = model.NewId() o1.UserId = model.NewId() - o1.Message = NewTestId() + o1.Message = NewTestID() o1.Metadata = &model.PostMetadata{ Priority: &model.PostPriority{ @@ -271,22 +271,22 @@ func testPostStoreSaveMultiple(t *testing.T, rctx request.CTX, ss store.Store) { p1 := model.Post{} p1.ChannelId = model.NewId() p1.UserId = model.NewId() - p1.Message = NewTestId() + p1.Message = NewTestID() p2 := model.Post{} p2.ChannelId = model.NewId() p2.UserId = model.NewId() - p2.Message = NewTestId() + p2.Message = NewTestID() p3 := model.Post{} p3.ChannelId = model.NewId() p3.UserId = model.NewId() - p3.Message = NewTestId() + p3.Message = NewTestID() p4 := model.Post{} p4.ChannelId = model.NewId() p4.UserId = model.NewId() - p4.Message = NewTestId() + p4.Message = NewTestID() t.Run("Save correctly a new set of posts", func(t *testing.T) { newPosts, errIdx, err := ss.Post().SaveMultiple([]*model.Post{&p1, &p2, &p3}) @@ -302,9 +302,9 @@ func testPostStoreSaveMultiple(t *testing.T, rctx request.CTX, ss store.Store) { }) t.Run("Save replies", func(t *testing.T) { - teamId := model.NewId() + teamID := model.NewId() channel1, err := ss.Channel().Save(rctx, &model.Channel{ - TeamId: teamId, + TeamId: teamID, DisplayName: "DisplayName1", Name: "channel" + model.NewId(), Type: model.ChannelTypeOpen, @@ -312,7 +312,7 @@ func testPostStoreSaveMultiple(t *testing.T, rctx request.CTX, ss store.Store) { require.NoError(t, err) channel2, err := ss.Channel().Save(rctx, &model.Channel{ - TeamId: teamId, + TeamId: teamID, DisplayName: "DisplayName2", Name: "channel" + model.NewId(), Type: model.ChannelTypeOpen, @@ -320,7 +320,7 @@ func testPostStoreSaveMultiple(t *testing.T, rctx request.CTX, ss store.Store) { require.NoError(t, err) channel3, err := ss.Channel().Save(rctx, &model.Channel{ - TeamId: teamId, + TeamId: teamID, DisplayName: "DisplayName3", Name: "channel" + model.NewId(), Type: model.ChannelTypeOpen, @@ -328,7 +328,7 @@ func testPostStoreSaveMultiple(t *testing.T, rctx request.CTX, ss store.Store) { require.NoError(t, err) channel4, err := ss.Channel().Save(rctx, &model.Channel{ - TeamId: teamId, + TeamId: teamID, DisplayName: "DisplayName4", Name: "channel" + model.NewId(), Type: model.ChannelTypeOpen, @@ -338,24 +338,24 @@ func testPostStoreSaveMultiple(t *testing.T, rctx request.CTX, ss store.Store) { o1.ChannelId = channel1.Id o1.UserId = model.NewId() o1.RootId = model.NewId() - o1.Message = NewTestId() + o1.Message = NewTestID() o2 := model.Post{} o2.ChannelId = channel2.Id o2.UserId = model.NewId() o2.RootId = o1.RootId - o2.Message = NewTestId() + o2.Message = NewTestID() o3 := model.Post{} o3.ChannelId = channel3.Id o3.UserId = model.NewId() o3.RootId = model.NewId() - o3.Message = NewTestId() + o3.Message = NewTestID() o4 := model.Post{} o4.ChannelId = channel4.Id o4.UserId = model.NewId() - o4.Message = NewTestId() + o4.Message = NewTestID() newPosts, errIdx, err := ss.Post().SaveMultiple([]*model.Post{&o1, &o2, &o3, &o4}) require.NoError(t, err, "couldn't save item") @@ -384,9 +384,9 @@ func testPostStoreSaveMultiple(t *testing.T, rctx request.CTX, ss store.Store) { }) t.Run("Update reply should update the UpdateAt of the root post", func(t *testing.T) { - teamId := model.NewId() + teamID := model.NewId() channel, err := ss.Channel().Save(rctx, &model.Channel{ - TeamId: teamId, + TeamId: teamID, DisplayName: "DisplayName", Name: "channel" + model.NewId(), Type: model.ChannelTypeOpen, @@ -396,12 +396,12 @@ func testPostStoreSaveMultiple(t *testing.T, rctx request.CTX, ss store.Store) { rootPost := model.Post{} rootPost.ChannelId = channel.Id rootPost.UserId = model.NewId() - rootPost.Message = NewTestId() + rootPost.Message = NewTestID() replyPost := model.Post{} replyPost.ChannelId = rootPost.ChannelId replyPost.UserId = model.NewId() - replyPost.Message = NewTestId() + replyPost.Message = NewTestID() replyPost.RootId = rootPost.Id _, _, err = ss.Post().SaveMultiple([]*model.Post{&rootPost, &replyPost}) @@ -414,13 +414,13 @@ func testPostStoreSaveMultiple(t *testing.T, rctx request.CTX, ss store.Store) { replyPost2 := model.Post{} replyPost2.ChannelId = rootPost.ChannelId replyPost2.UserId = model.NewId() - replyPost2.Message = NewTestId() + replyPost2.Message = NewTestID() replyPost2.RootId = rootPost.Id replyPost3 := model.Post{} replyPost3.ChannelId = rootPost.ChannelId replyPost3.UserId = model.NewId() - replyPost3.Message = NewTestId() + replyPost3.Message = NewTestID() replyPost3.RootId = rootPost.Id // Ensure update does not occur in the same timestamp as creation @@ -436,8 +436,8 @@ func testPostStoreSaveMultiple(t *testing.T, rctx request.CTX, ss store.Store) { t.Run("Create a post should update the channel LastPostAt and the total messages count by one", func(t *testing.T) { channel := model.Channel{} - channel.Name = NewTestId() - channel.DisplayName = NewTestId() + channel.Name = NewTestID() + channel.DisplayName = NewTestID() channel.Type = model.ChannelTypeOpen _, err := ss.Channel().Save(rctx, &channel, 100) @@ -446,18 +446,18 @@ func testPostStoreSaveMultiple(t *testing.T, rctx request.CTX, ss store.Store) { post1 := model.Post{} post1.ChannelId = channel.Id post1.UserId = model.NewId() - post1.Message = NewTestId() + post1.Message = NewTestID() post2 := model.Post{} post2.ChannelId = channel.Id post2.UserId = model.NewId() - post2.Message = NewTestId() + post2.Message = NewTestID() post2.CreateAt = 5 post3 := model.Post{} post3.ChannelId = channel.Id post3.UserId = model.NewId() - post3.Message = NewTestId() + post3.Message = NewTestID() _, _, err = ss.Post().SaveMultiple([]*model.Post{&post1, &post2, &post3}) require.NoError(t, err) @@ -469,9 +469,9 @@ func testPostStoreSaveMultiple(t *testing.T, rctx request.CTX, ss store.Store) { }) t.Run("Thread participants", func(t *testing.T) { - teamId := model.NewId() + teamID := model.NewId() channel1, err := ss.Channel().Save(rctx, &model.Channel{ - TeamId: teamId, + TeamId: teamID, DisplayName: "DisplayName1", Name: "channel" + model.NewId(), Type: model.ChannelTypeOpen, @@ -487,7 +487,7 @@ func testPostStoreSaveMultiple(t *testing.T, rctx request.CTX, ss store.Store) { require.NoError(t, err) channel2, err := ss.Channel().Save(rctx, &model.Channel{ - TeamId: teamId, + TeamId: teamID, DisplayName: "DisplayName2", Name: "channel" + model.NewId(), Type: model.ChannelTypeOpen, @@ -495,7 +495,7 @@ func testPostStoreSaveMultiple(t *testing.T, rctx request.CTX, ss store.Store) { require.NoError(t, err) channel3, err := ss.Channel().Save(rctx, &model.Channel{ - TeamId: teamId, + TeamId: teamID, DisplayName: "DisplayName3", Name: "channel" + model.NewId(), Type: model.ChannelTypeOpen, @@ -503,7 +503,7 @@ func testPostStoreSaveMultiple(t *testing.T, rctx request.CTX, ss store.Store) { require.NoError(t, err) channel4, err := ss.Channel().Save(rctx, &model.Channel{ - TeamId: teamId, + TeamId: teamID, DisplayName: "DisplayName4", Name: "channel" + model.NewId(), Type: model.ChannelTypeOpen, @@ -511,7 +511,7 @@ func testPostStoreSaveMultiple(t *testing.T, rctx request.CTX, ss store.Store) { require.NoError(t, err) channel5, err := ss.Channel().Save(rctx, &model.Channel{ - TeamId: teamId, + TeamId: teamID, DisplayName: "DisplayName5", Name: "channel" + model.NewId(), Type: model.ChannelTypeOpen, @@ -587,7 +587,7 @@ func testPostStoreSaveChannelMsgCounts(t *testing.T, rctx request.CTX, ss store. o1 := model.Post{} o1.ChannelId = c1.Id o1.UserId = model.NewId() - o1.Message = NewTestId() + o1.Message = NewTestID() _, err = ss.Post().Save(rctx, &o1) require.NoError(t, err) @@ -615,7 +615,7 @@ func testPostStoreSaveChannelMsgCounts(t *testing.T, rctx request.CTX, ss store. o2 := model.Post{} o2.ChannelId = c1.Id o2.UserId = model.NewId() - o2.Message = NewTestId() + o2.Message = NewTestID() o2.CreateAt = int64(7) _, err = ss.Post().Save(rctx, &o2) require.NoError(t, err) @@ -626,9 +626,9 @@ func testPostStoreSaveChannelMsgCounts(t *testing.T, rctx request.CTX, ss store. } func testPostStoreGet(t *testing.T, rctx request.CTX, ss store.Store) { - teamId := model.NewId() + teamID := model.NewId() channel, err := ss.Channel().Save(rctx, &model.Channel{ - TeamId: teamId, + TeamId: teamID, DisplayName: "DisplayName1", Name: "channel" + model.NewId(), Type: model.ChannelTypeOpen, @@ -637,7 +637,7 @@ func testPostStoreGet(t *testing.T, rctx request.CTX, ss store.Store) { o1 := &model.Post{} o1.ChannelId = channel.Id o1.UserId = model.NewId() - o1.Message = NewTestId() + o1.Message = NewTestID() etag1 := ss.Post().GetEtag(o1.ChannelId, false, false) require.Equal(t, 0, strings.Index(etag1, model.CurrentVersion+"."), "Invalid Etag") @@ -661,19 +661,19 @@ func testPostStoreGet(t *testing.T, rctx request.CTX, ss store.Store) { func testPostStoreGetForThread(t *testing.T, rctx request.CTX, ss store.Store) { t.Run("Post thread is followed", func(t *testing.T) { - teamId := model.NewId() + teamID := model.NewId() channel, err := ss.Channel().Save(rctx, &model.Channel{ - TeamId: teamId, + TeamId: teamID, DisplayName: "DisplayName1", Name: "channel" + model.NewId(), Type: model.ChannelTypeOpen, }, -1) require.NoError(t, err) - o1 := &model.Post{ChannelId: channel.Id, UserId: model.NewId(), Message: NewTestId()} + o1 := &model.Post{ChannelId: channel.Id, UserId: model.NewId(), Message: NewTestID()} o1, err = ss.Post().Save(rctx, o1) require.NoError(t, err) - _, err = ss.Post().Save(rctx, &model.Post{ChannelId: o1.ChannelId, UserId: model.NewId(), Message: NewTestId(), RootId: o1.Id}) + _, err = ss.Post().Save(rctx, &model.Post{ChannelId: o1.ChannelId, UserId: model.NewId(), Message: NewTestID(), RootId: o1.Id}) require.NoError(t, err) _, err = ss.Thread().MaintainMembership(o1.UserId, o1.Id, store.ThreadMembershipOpts{ @@ -691,19 +691,19 @@ func testPostStoreGetForThread(t *testing.T, rctx request.CTX, ss store.Store) { }) t.Run("Post thread is explicitly not followed", func(t *testing.T) { - teamId := model.NewId() + teamID := model.NewId() channel, err := ss.Channel().Save(rctx, &model.Channel{ - TeamId: teamId, + TeamId: teamID, DisplayName: "DisplayName1", Name: "channel" + model.NewId(), Type: model.ChannelTypeOpen, }, -1) require.NoError(t, err) - o1 := &model.Post{ChannelId: channel.Id, UserId: model.NewId(), Message: NewTestId()} + o1 := &model.Post{ChannelId: channel.Id, UserId: model.NewId(), Message: NewTestID()} o1, err = ss.Post().Save(rctx, o1) require.NoError(t, err) - _, err = ss.Post().Save(rctx, &model.Post{ChannelId: o1.ChannelId, UserId: model.NewId(), Message: NewTestId(), RootId: o1.Id}) + _, err = ss.Post().Save(rctx, &model.Post{ChannelId: o1.ChannelId, UserId: model.NewId(), Message: NewTestID(), RootId: o1.Id}) require.NoError(t, err) _, err = ss.Thread().MaintainMembership(o1.UserId, o1.Id, store.ThreadMembershipOpts{ @@ -721,19 +721,19 @@ func testPostStoreGetForThread(t *testing.T, rctx request.CTX, ss store.Store) { }) t.Run("Post threadmembership does not exist", func(t *testing.T) { - teamId := model.NewId() + teamID := model.NewId() channel, err := ss.Channel().Save(rctx, &model.Channel{ - TeamId: teamId, + TeamId: teamID, DisplayName: "DisplayName1", Name: "channel" + model.NewId(), Type: model.ChannelTypeOpen, }, -1) require.NoError(t, err) - o1 := &model.Post{ChannelId: channel.Id, UserId: model.NewId(), Message: NewTestId()} + o1 := &model.Post{ChannelId: channel.Id, UserId: model.NewId(), Message: NewTestID()} o1, err = ss.Post().Save(rctx, o1) require.NoError(t, err) - _, err = ss.Post().Save(rctx, &model.Post{ChannelId: o1.ChannelId, UserId: model.NewId(), Message: NewTestId(), RootId: o1.Id}) + _, err = ss.Post().Save(rctx, &model.Post{ChannelId: o1.ChannelId, UserId: model.NewId(), Message: NewTestID(), RootId: o1.Id}) require.NoError(t, err) opts := model.GetPostsOptions{ @@ -746,9 +746,9 @@ func testPostStoreGetForThread(t *testing.T, rctx request.CTX, ss store.Store) { }) t.Run("Pagination", func(t *testing.T) { - teamId := model.NewId() + teamID := model.NewId() channel, err := ss.Channel().Save(rctx, &model.Channel{ - TeamId: teamId, + TeamId: teamID, DisplayName: "DisplayName1", Name: "channel" + model.NewId(), Type: model.ChannelTypeOpen, @@ -756,15 +756,15 @@ func testPostStoreGetForThread(t *testing.T, rctx request.CTX, ss store.Store) { require.NoError(t, err) now := model.GetMillis() - o1, err := ss.Post().Save(rctx, &model.Post{CreateAt: now, ChannelId: channel.Id, UserId: model.NewId(), Message: NewTestId()}) + o1, err := ss.Post().Save(rctx, &model.Post{CreateAt: now, ChannelId: channel.Id, UserId: model.NewId(), Message: NewTestID()}) require.NoError(t, err) - _, err = ss.Post().Save(rctx, &model.Post{CreateAt: now + 1, ChannelId: o1.ChannelId, UserId: model.NewId(), Message: NewTestId(), RootId: o1.Id}) + _, err = ss.Post().Save(rctx, &model.Post{CreateAt: now + 1, ChannelId: o1.ChannelId, UserId: model.NewId(), Message: NewTestID(), RootId: o1.Id}) require.NoError(t, err) - m1, err := ss.Post().Save(rctx, &model.Post{CreateAt: now + 2, ChannelId: o1.ChannelId, UserId: model.NewId(), Message: NewTestId(), RootId: o1.Id}) + m1, err := ss.Post().Save(rctx, &model.Post{CreateAt: now + 2, ChannelId: o1.ChannelId, UserId: model.NewId(), Message: NewTestID(), RootId: o1.Id}) require.NoError(t, err) - _, err = ss.Post().Save(rctx, &model.Post{CreateAt: now + 3, ChannelId: o1.ChannelId, UserId: model.NewId(), Message: NewTestId(), RootId: o1.Id}) + _, err = ss.Post().Save(rctx, &model.Post{CreateAt: now + 3, ChannelId: o1.ChannelId, UserId: model.NewId(), Message: NewTestID(), RootId: o1.Id}) require.NoError(t, err) - _, err = ss.Post().Save(rctx, &model.Post{CreateAt: now + 4, ChannelId: o1.ChannelId, UserId: model.NewId(), Message: NewTestId(), RootId: o1.Id}) + _, err = ss.Post().Save(rctx, &model.Post{CreateAt: now + 4, ChannelId: o1.ChannelId, UserId: model.NewId(), Message: NewTestID(), RootId: o1.Id}) require.NoError(t, err) opts := model.GetPostsOptions{ @@ -898,9 +898,9 @@ func testPostStoreGetForThread(t *testing.T, rctx request.CTX, ss store.Store) { } func testPostStoreGetSingle(t *testing.T, rctx request.CTX, ss store.Store) { - teamId := model.NewId() + teamID := model.NewId() channel, err := ss.Channel().Save(rctx, &model.Channel{ - TeamId: teamId, + TeamId: teamID, DisplayName: "DisplayName1", Name: "channel" + model.NewId(), Type: model.ChannelTypeOpen, @@ -910,12 +910,12 @@ func testPostStoreGetSingle(t *testing.T, rctx request.CTX, ss store.Store) { o1 := &model.Post{} o1.ChannelId = channel.Id o1.UserId = model.NewId() - o1.Message = NewTestId() + o1.Message = NewTestID() o2 := &model.Post{} o2.ChannelId = o1.ChannelId o2.UserId = o1.UserId - o2.Message = NewTestId() + o2.Message = NewTestID() o1, err = ss.Post().Save(rctx, o1) require.NoError(t, err) @@ -966,9 +966,9 @@ func testPostStoreGetSingle(t *testing.T, rctx request.CTX, ss store.Store) { } func testPostStoreUpdate(t *testing.T, rctx request.CTX, ss store.Store) { - teamId := model.NewId() + teamID := model.NewId() channel, err := ss.Channel().Save(rctx, &model.Channel{ - TeamId: teamId, + TeamId: teamID, DisplayName: "DisplayName1", Name: "channel" + model.NewId(), Type: model.ChannelTypeOpen, @@ -978,14 +978,14 @@ func testPostStoreUpdate(t *testing.T, rctx request.CTX, ss store.Store) { o1 := &model.Post{} o1.ChannelId = channel.Id o1.UserId = model.NewId() - o1.Message = NewTestId() + o1.Message = NewTestID() o1, err = ss.Post().Save(rctx, o1) require.NoError(t, err) o2 := &model.Post{} o2.ChannelId = o1.ChannelId o2.UserId = model.NewId() - o2.Message = NewTestId() + o2.Message = NewTestID() o2.RootId = o1.Id o2, err = ss.Post().Save(rctx, o2) require.NoError(t, err) @@ -993,7 +993,7 @@ func testPostStoreUpdate(t *testing.T, rctx request.CTX, ss store.Store) { o3 := &model.Post{} o3.ChannelId = o1.ChannelId o3.UserId = model.NewId() - o3.Message = NewTestId() + o3.Message = NewTestID() o3, err = ss.Post().Save(rctx, o3) require.NoError(t, err) @@ -1047,7 +1047,7 @@ func testPostStoreUpdate(t *testing.T, rctx request.CTX, ss store.Store) { } channel2, err := ss.Channel().Save(rctx, &model.Channel{ - TeamId: teamId, + TeamId: teamID, DisplayName: "DisplayName1", Name: "channel" + model.NewId(), Type: model.ChannelTypeOpen, @@ -1081,9 +1081,9 @@ func testPostStoreUpdate(t *testing.T, rctx request.CTX, ss store.Store) { func testPostStoreDelete(t *testing.T, rctx request.CTX, ss store.Store) { t.Run("single post, no replies", func(t *testing.T) { - teamId := model.NewId() + teamID := model.NewId() channel, err := ss.Channel().Save(rctx, &model.Channel{ - TeamId: teamId, + TeamId: teamID, DisplayName: "DisplayName1", Name: "channel" + model.NewId(), Type: model.ChannelTypeOpen, @@ -1130,9 +1130,9 @@ func testPostStoreDelete(t *testing.T, rctx request.CTX, ss store.Store) { }) t.Run("thread with one reply", func(t *testing.T) { - teamId := model.NewId() + teamID := model.NewId() channel, err := ss.Channel().Save(rctx, &model.Channel{ - TeamId: teamId, + TeamId: teamID, DisplayName: "DisplayName1", Name: "channel" + model.NewId(), Type: model.ChannelTypeOpen, @@ -1143,7 +1143,7 @@ func testPostStoreDelete(t *testing.T, rctx request.CTX, ss store.Store) { rootPost, err := ss.Post().Save(rctx, &model.Post{ ChannelId: channel.Id, UserId: model.NewId(), - Message: NewTestId(), + Message: NewTestID(), }) require.NoError(t, err) @@ -1151,7 +1151,7 @@ func testPostStoreDelete(t *testing.T, rctx request.CTX, ss store.Store) { replyPost, err := ss.Post().Save(rctx, &model.Post{ ChannelId: rootPost.ChannelId, UserId: model.NewId(), - Message: NewTestId(), + Message: NewTestID(), RootId: rootPost.Id, }) require.NoError(t, err) @@ -1172,9 +1172,9 @@ func testPostStoreDelete(t *testing.T, rctx request.CTX, ss store.Store) { }) t.Run("thread with multiple replies", func(t *testing.T) { - teamId := model.NewId() + teamID := model.NewId() channel, err := ss.Channel().Save(rctx, &model.Channel{ - TeamId: teamId, + TeamId: teamID, DisplayName: "DisplayName1", Name: "channel" + model.NewId(), Type: model.ChannelTypeOpen, @@ -1185,7 +1185,7 @@ func testPostStoreDelete(t *testing.T, rctx request.CTX, ss store.Store) { rootPost1, err := ss.Post().Save(rctx, &model.Post{ ChannelId: channel.Id, UserId: model.NewId(), - Message: NewTestId(), + Message: NewTestID(), }) require.NoError(t, err) @@ -1193,7 +1193,7 @@ func testPostStoreDelete(t *testing.T, rctx request.CTX, ss store.Store) { replyPost1, err := ss.Post().Save(rctx, &model.Post{ ChannelId: rootPost1.ChannelId, UserId: model.NewId(), - Message: NewTestId(), + Message: NewTestID(), RootId: rootPost1.Id, }) require.NoError(t, err) @@ -1202,13 +1202,13 @@ func testPostStoreDelete(t *testing.T, rctx request.CTX, ss store.Store) { replyPost2, err := ss.Post().Save(rctx, &model.Post{ ChannelId: rootPost1.ChannelId, UserId: model.NewId(), - Message: NewTestId(), + Message: NewTestID(), RootId: rootPost1.Id, }) require.NoError(t, err) channel2, err := ss.Channel().Save(rctx, &model.Channel{ - TeamId: teamId, + TeamId: teamID, DisplayName: "DisplayName1", Name: "channel" + model.NewId(), Type: model.ChannelTypeOpen, @@ -1219,7 +1219,7 @@ func testPostStoreDelete(t *testing.T, rctx request.CTX, ss store.Store) { rootPost2, err := ss.Post().Save(rctx, &model.Post{ ChannelId: channel2.Id, UserId: model.NewId(), - Message: NewTestId(), + Message: NewTestID(), }) require.NoError(t, err) @@ -1256,7 +1256,7 @@ func testPostStoreDelete(t *testing.T, rctx request.CTX, ss store.Store) { rootPost1, err := ss.Post().Save(rctx, &model.Post{ ChannelId: channel.Id, UserId: model.NewId(), - Message: NewTestId(), + Message: NewTestID(), }) require.NoError(t, err) @@ -1264,7 +1264,7 @@ func testPostStoreDelete(t *testing.T, rctx request.CTX, ss store.Store) { _, err = ss.Post().Save(rctx, &model.Post{ ChannelId: rootPost1.ChannelId, UserId: model.NewId(), - Message: NewTestId(), + Message: NewTestID(), RootId: rootPost1.Id, }) require.NoError(t, err) @@ -1273,7 +1273,7 @@ func testPostStoreDelete(t *testing.T, rctx request.CTX, ss store.Store) { replyPost2, err := ss.Post().Save(rctx, &model.Post{ ChannelId: rootPost1.ChannelId, UserId: model.NewId(), - Message: NewTestId(), + Message: NewTestID(), RootId: rootPost1.Id, }) require.NoError(t, err) @@ -1282,7 +1282,7 @@ func testPostStoreDelete(t *testing.T, rctx request.CTX, ss store.Store) { _, err = ss.Post().Save(rctx, &model.Post{ ChannelId: rootPost1.ChannelId, UserId: model.NewId(), - Message: NewTestId(), + Message: NewTestID(), RootId: rootPost1.Id, }) require.NoError(t, err) @@ -1303,9 +1303,9 @@ func testPostStoreDelete(t *testing.T, rctx request.CTX, ss store.Store) { }) t.Run("thread with multiple replies, update thread last reply at", func(t *testing.T) { - teamId := model.NewId() + teamID := model.NewId() channel, err := ss.Channel().Save(rctx, &model.Channel{ - TeamId: teamId, + TeamId: teamID, DisplayName: "DisplayName1", Name: "channel" + model.NewId(), Type: model.ChannelTypeOpen, @@ -1316,7 +1316,7 @@ func testPostStoreDelete(t *testing.T, rctx request.CTX, ss store.Store) { rootPost1, err := ss.Post().Save(rctx, &model.Post{ ChannelId: channel.Id, UserId: model.NewId(), - Message: NewTestId(), + Message: NewTestID(), }) require.NoError(t, err) @@ -1324,7 +1324,7 @@ func testPostStoreDelete(t *testing.T, rctx request.CTX, ss store.Store) { replyPost1, err := ss.Post().Save(rctx, &model.Post{ ChannelId: rootPost1.ChannelId, UserId: model.NewId(), - Message: NewTestId(), + Message: NewTestID(), RootId: rootPost1.Id, }) require.NoError(t, err) @@ -1333,7 +1333,7 @@ func testPostStoreDelete(t *testing.T, rctx request.CTX, ss store.Store) { replyPost2, err := ss.Post().Save(rctx, &model.Post{ ChannelId: rootPost1.ChannelId, UserId: model.NewId(), - Message: NewTestId(), + Message: NewTestID(), RootId: rootPost1.Id, }) require.NoError(t, err) @@ -1342,7 +1342,7 @@ func testPostStoreDelete(t *testing.T, rctx request.CTX, ss store.Store) { replyPost3, err := ss.Post().Save(rctx, &model.Post{ ChannelId: rootPost1.ChannelId, UserId: model.NewId(), - Message: NewTestId(), + Message: NewTestID(), RootId: rootPost1.Id, }) require.NoError(t, err) @@ -1380,9 +1380,9 @@ func testPostStoreDelete(t *testing.T, rctx request.CTX, ss store.Store) { }) t.Run("thread with file attachments", func(t *testing.T) { - teamId := model.NewId() + teamID := model.NewId() channel, err := ss.Channel().Save(rctx, &model.Channel{ - TeamId: teamId, + TeamId: teamID, DisplayName: "DisplayName1", Name: "channel" + model.NewId(), Type: model.ChannelTypeOpen, @@ -1393,7 +1393,7 @@ func testPostStoreDelete(t *testing.T, rctx request.CTX, ss store.Store) { rootPost1, err := ss.Post().Save(rctx, &model.Post{ ChannelId: channel.Id, UserId: model.NewId(), - Message: NewTestId(), + Message: NewTestID(), }) require.NoError(t, err) @@ -1401,7 +1401,7 @@ func testPostStoreDelete(t *testing.T, rctx request.CTX, ss store.Store) { rootPost2, err := ss.Post().Save(rctx, &model.Post{ ChannelId: channel.Id, UserId: model.NewId(), - Message: NewTestId(), + Message: NewTestID(), }) require.NoError(t, err) @@ -1409,7 +1409,7 @@ func testPostStoreDelete(t *testing.T, rctx request.CTX, ss store.Store) { replyPost1, err := ss.Post().Save(rctx, &model.Post{ ChannelId: rootPost1.ChannelId, UserId: model.NewId(), - Message: NewTestId(), + Message: NewTestID(), RootId: rootPost1.Id, }) require.NoError(t, err) @@ -1432,7 +1432,7 @@ func testPostStoreDelete(t *testing.T, rctx request.CTX, ss store.Store) { replyPost2, err := ss.Post().Save(rctx, &model.Post{ ChannelId: rootPost2.ChannelId, UserId: model.NewId(), - Message: NewTestId(), + Message: NewTestID(), RootId: rootPost2.Id, }) require.NoError(t, err) @@ -1463,9 +1463,9 @@ func testPostStoreDelete(t *testing.T, rctx request.CTX, ss store.Store) { } func testPostStorePermDelete1Level(t *testing.T, rctx request.CTX, ss store.Store) { - teamId := model.NewId() + teamID := model.NewId() channel, err := ss.Channel().Save(rctx, &model.Channel{ - TeamId: teamId, + TeamId: teamID, DisplayName: "DisplayName1", Name: "channel" + model.NewId(), Type: model.ChannelTypeOpen, @@ -1475,14 +1475,14 @@ func testPostStorePermDelete1Level(t *testing.T, rctx request.CTX, ss store.Stor o1 := &model.Post{} o1.ChannelId = channel.Id o1.UserId = model.NewId() - o1.Message = NewTestId() + o1.Message = NewTestID() o1, err = ss.Post().Save(rctx, o1) require.NoError(t, err) o2 := &model.Post{} o2.ChannelId = o1.ChannelId o2.UserId = model.NewId() - o2.Message = NewTestId() + o2.Message = NewTestID() o2.RootId = o1.Id o2, err = ss.Post().Save(rctx, o2) require.NoError(t, err) @@ -1512,7 +1512,7 @@ func testPostStorePermDelete1Level(t *testing.T, rctx request.CTX, ss store.Stor require.NoError(t, err) channel2, err := ss.Channel().Save(rctx, &model.Channel{ - TeamId: teamId, + TeamId: teamID, DisplayName: "DisplayName2", Name: "channel" + model.NewId(), Type: model.ChannelTypeOpen, @@ -1521,7 +1521,7 @@ func testPostStorePermDelete1Level(t *testing.T, rctx request.CTX, ss store.Stor o3 := &model.Post{} o3.ChannelId = channel2.Id o3.UserId = model.NewId() - o3.Message = NewTestId() + o3.Message = NewTestID() o3, err = ss.Post().Save(rctx, o3) require.NoError(t, err) @@ -1534,7 +1534,7 @@ func testPostStorePermDelete1Level(t *testing.T, rctx request.CTX, ss store.Stor require.NoError(t, err) channel3, err := ss.Channel().Save(rctx, &model.Channel{ - TeamId: teamId, + TeamId: teamID, DisplayName: "DisplayName3", Name: "channel" + model.NewId(), Type: model.ChannelTypeOpen, @@ -1545,14 +1545,14 @@ func testPostStorePermDelete1Level(t *testing.T, rctx request.CTX, ss store.Stor o4.ChannelId = channel3.Id o4.RootId = o1.Id o4.UserId = o2.UserId - o4.Message = NewTestId() + o4.Message = NewTestID() o4, err = ss.Post().Save(rctx, o4) require.NoError(t, err) o5 := &model.Post{} o5.ChannelId = o3.ChannelId o5.UserId = model.NewId() - o5.Message = NewTestId() + o5.Message = NewTestID() o5, err = ss.Post().Save(rctx, o5) require.NoError(t, err) @@ -1560,7 +1560,7 @@ func testPostStorePermDelete1Level(t *testing.T, rctx request.CTX, ss store.Stor o6.ChannelId = o3.ChannelId o6.RootId = o5.Id o6.UserId = model.NewId() - o6.Message = NewTestId() + o6.Message = NewTestID() o6, err = ss.Post().Save(rctx, o6) require.NoError(t, err) @@ -1634,9 +1634,9 @@ func testPostStorePermDelete1Level(t *testing.T, rctx request.CTX, ss store.Stor } func testPostStorePermDelete1Level2(t *testing.T, rctx request.CTX, ss store.Store) { - teamId := model.NewId() + teamID := model.NewId() channel1, err := ss.Channel().Save(rctx, &model.Channel{ - TeamId: teamId, + TeamId: teamID, DisplayName: "DisplayName1", Name: "channel" + model.NewId(), Type: model.ChannelTypeOpen, @@ -1646,20 +1646,20 @@ func testPostStorePermDelete1Level2(t *testing.T, rctx request.CTX, ss store.Sto o1 := &model.Post{} o1.ChannelId = channel1.Id o1.UserId = model.NewId() - o1.Message = NewTestId() + o1.Message = NewTestID() o1, err = ss.Post().Save(rctx, o1) require.NoError(t, err) o2 := &model.Post{} o2.ChannelId = o1.ChannelId o2.UserId = model.NewId() - o2.Message = NewTestId() + o2.Message = NewTestID() o2.RootId = o1.Id o2, err = ss.Post().Save(rctx, o2) require.NoError(t, err) channel2, err := ss.Channel().Save(rctx, &model.Channel{ - TeamId: teamId, + TeamId: teamID, DisplayName: "DisplayName2", Name: "channel" + model.NewId(), Type: model.ChannelTypeOpen, @@ -1669,7 +1669,7 @@ func testPostStorePermDelete1Level2(t *testing.T, rctx request.CTX, ss store.Sto o3 := &model.Post{} o3.ChannelId = channel2.Id o3.UserId = model.NewId() - o3.Message = NewTestId() + o3.Message = NewTestID() o3, err = ss.Post().Save(rctx, o3) require.NoError(t, err) @@ -1687,9 +1687,9 @@ func testPostStorePermDelete1Level2(t *testing.T, rctx request.CTX, ss store.Sto } func testPostStoreGetWithChildren(t *testing.T, rctx request.CTX, ss store.Store) { - teamId := model.NewId() + teamID := model.NewId() channel1, err := ss.Channel().Save(rctx, &model.Channel{ - TeamId: teamId, + TeamId: teamID, DisplayName: "DisplayName1", Name: "channel" + model.NewId(), Type: model.ChannelTypeOpen, @@ -1699,14 +1699,14 @@ func testPostStoreGetWithChildren(t *testing.T, rctx request.CTX, ss store.Store o1 := &model.Post{} o1.ChannelId = channel1.Id o1.UserId = model.NewId() - o1.Message = NewTestId() + o1.Message = NewTestID() o1, err = ss.Post().Save(rctx, o1) require.NoError(t, err) o2 := &model.Post{} o2.ChannelId = o1.ChannelId o2.UserId = model.NewId() - o2.Message = NewTestId() + o2.Message = NewTestID() o2.RootId = o1.Id o2, err = ss.Post().Save(rctx, o2) require.NoError(t, err) @@ -1714,7 +1714,7 @@ func testPostStoreGetWithChildren(t *testing.T, rctx request.CTX, ss store.Store o3 := &model.Post{} o3.ChannelId = o1.ChannelId o3.UserId = model.NewId() - o3.Message = NewTestId() + o3.Message = NewTestID() o3.RootId = o1.Id o3, err = ss.Post().Save(rctx, o3) require.NoError(t, err) @@ -1742,9 +1742,9 @@ func testPostStoreGetWithChildren(t *testing.T, rctx request.CTX, ss store.Store } func testPostStoreGetPostsWithDetails(t *testing.T, rctx request.CTX, ss store.Store) { - teamId := model.NewId() + teamID := model.NewId() channel1, err := ss.Channel().Save(rctx, &model.Channel{ - TeamId: teamId, + TeamId: teamID, DisplayName: "DisplayName1", Name: "channel" + model.NewId(), Type: model.ChannelTypeOpen, @@ -1754,7 +1754,7 @@ func testPostStoreGetPostsWithDetails(t *testing.T, rctx request.CTX, ss store.S o1 := &model.Post{} o1.ChannelId = channel1.Id o1.UserId = model.NewId() - o1.Message = NewTestId() + o1.Message = NewTestID() o1, err = ss.Post().Save(rctx, o1) require.NoError(t, err) time.Sleep(2 * time.Millisecond) @@ -1762,7 +1762,7 @@ func testPostStoreGetPostsWithDetails(t *testing.T, rctx request.CTX, ss store.S o2 := &model.Post{} o2.ChannelId = o1.ChannelId o2.UserId = model.NewId() - o2.Message = NewTestId() + o2.Message = NewTestID() o2.RootId = o1.Id _, err = ss.Post().Save(rctx, o2) require.NoError(t, err) @@ -1771,7 +1771,7 @@ func testPostStoreGetPostsWithDetails(t *testing.T, rctx request.CTX, ss store.S o2a := &model.Post{} o2a.ChannelId = o1.ChannelId o2a.UserId = model.NewId() - o2a.Message = NewTestId() + o2a.Message = NewTestID() o2a.RootId = o1.Id o2a, err = ss.Post().Save(rctx, o2a) require.NoError(t, err) @@ -1780,7 +1780,7 @@ func testPostStoreGetPostsWithDetails(t *testing.T, rctx request.CTX, ss store.S o3 := &model.Post{} o3.ChannelId = o1.ChannelId o3.UserId = model.NewId() - o3.Message = NewTestId() + o3.Message = NewTestID() o3.RootId = o1.Id o3, err = ss.Post().Save(rctx, o3) require.NoError(t, err) @@ -1789,7 +1789,7 @@ func testPostStoreGetPostsWithDetails(t *testing.T, rctx request.CTX, ss store.S o4 := &model.Post{} o4.ChannelId = o1.ChannelId o4.UserId = model.NewId() - o4.Message = NewTestId() + o4.Message = NewTestID() o4, err = ss.Post().Save(rctx, o4) require.NoError(t, err) time.Sleep(2 * time.Millisecond) @@ -1797,7 +1797,7 @@ func testPostStoreGetPostsWithDetails(t *testing.T, rctx request.CTX, ss store.S o5 := &model.Post{} o5.ChannelId = o1.ChannelId o5.UserId = model.NewId() - o5.Message = NewTestId() + o5.Message = NewTestID() o5.RootId = o4.Id o5, err = ss.Post().Save(rctx, o5) require.NoError(t, err) @@ -1835,7 +1835,7 @@ func testPostStoreGetPostsWithDetails(t *testing.T, rctx request.CTX, ss store.S o6 := &model.Post{} o6.ChannelId = o1.ChannelId o6.UserId = model.NewId() - o6.Message = NewTestId() + o6.Message = NewTestID() _, err = ss.Post().Save(rctx, o6) require.NoError(t, err) @@ -1846,23 +1846,23 @@ func testPostStoreGetPostsWithDetails(t *testing.T, rctx request.CTX, ss store.S func testPostStoreGetPostsBeforeAfter(t *testing.T, rctx request.CTX, ss store.Store) { t.Run("without threads", func(t *testing.T) { - teamId := model.NewId() + teamID := model.NewId() channel1, err := ss.Channel().Save(rctx, &model.Channel{ - TeamId: teamId, + TeamId: teamID, DisplayName: "DisplayName1", Name: "channel" + model.NewId(), Type: model.ChannelTypeOpen, }, -1) require.NoError(t, err) - channelId := channel1.Id - userId := model.NewId() + channelID := channel1.Id + userID := model.NewId() var posts []*model.Post for i := 0; i < 10; i++ { post, err := ss.Post().Save(rctx, &model.Post{ - ChannelId: channelId, - UserId: userId, + ChannelId: channelID, + UserId: userID, Message: "message", }) require.NoError(t, err) @@ -1873,19 +1873,19 @@ func testPostStoreGetPostsBeforeAfter(t *testing.T, rctx request.CTX, ss store.S } t.Run("should return error if negative Page/PerPage options are passed", func(t *testing.T) { - postList, err := ss.Post().GetPostsAfter(model.GetPostsOptions{ChannelId: channelId, PostId: posts[0].Id, Page: 0, PerPage: -1}, map[string]bool{}) + postList, err := ss.Post().GetPostsAfter(model.GetPostsOptions{ChannelId: channelID, PostId: posts[0].Id, Page: 0, PerPage: -1}, map[string]bool{}) assert.Nil(t, postList) assert.Error(t, err) assert.IsType(t, &store.ErrInvalidInput{}, err) - postList, err = ss.Post().GetPostsAfter(model.GetPostsOptions{ChannelId: channelId, PostId: posts[0].Id, Page: -1, PerPage: 10}, map[string]bool{}) + postList, err = ss.Post().GetPostsAfter(model.GetPostsOptions{ChannelId: channelID, PostId: posts[0].Id, Page: -1, PerPage: 10}, map[string]bool{}) assert.Nil(t, postList) assert.Error(t, err) assert.IsType(t, &store.ErrInvalidInput{}, err) }) t.Run("should not return anything before the first post", func(t *testing.T) { - postList, err := ss.Post().GetPostsBefore(model.GetPostsOptions{ChannelId: channelId, PostId: posts[0].Id, Page: 0, PerPage: 10}, map[string]bool{}) + postList, err := ss.Post().GetPostsBefore(model.GetPostsOptions{ChannelId: channelID, PostId: posts[0].Id, Page: 0, PerPage: 10}, map[string]bool{}) assert.NoError(t, err) assert.Equal(t, []string{}, postList.Order) @@ -1893,7 +1893,7 @@ func testPostStoreGetPostsBeforeAfter(t *testing.T, rctx request.CTX, ss store.S }) t.Run("should return posts before a post", func(t *testing.T) { - postList, err := ss.Post().GetPostsBefore(model.GetPostsOptions{ChannelId: channelId, PostId: posts[5].Id, Page: 0, PerPage: 10}, map[string]bool{}) + postList, err := ss.Post().GetPostsBefore(model.GetPostsOptions{ChannelId: channelID, PostId: posts[5].Id, Page: 0, PerPage: 10}, map[string]bool{}) assert.NoError(t, err) assert.Equal(t, []string{posts[4].Id, posts[3].Id, posts[2].Id, posts[1].Id, posts[0].Id}, postList.Order) @@ -1907,7 +1907,7 @@ func testPostStoreGetPostsBeforeAfter(t *testing.T, rctx request.CTX, ss store.S }) t.Run("should limit posts before", func(t *testing.T) { - postList, err := ss.Post().GetPostsBefore(model.GetPostsOptions{ChannelId: channelId, PostId: posts[5].Id, PerPage: 2}, map[string]bool{}) + postList, err := ss.Post().GetPostsBefore(model.GetPostsOptions{ChannelId: channelID, PostId: posts[5].Id, PerPage: 2}, map[string]bool{}) assert.NoError(t, err) assert.Equal(t, []string{posts[4].Id, posts[3].Id}, postList.Order) @@ -1918,7 +1918,7 @@ func testPostStoreGetPostsBeforeAfter(t *testing.T, rctx request.CTX, ss store.S }) t.Run("should not return anything after the last post", func(t *testing.T) { - postList, err := ss.Post().GetPostsAfter(model.GetPostsOptions{ChannelId: channelId, PostId: posts[len(posts)-1].Id, PerPage: 10}, map[string]bool{}) + postList, err := ss.Post().GetPostsAfter(model.GetPostsOptions{ChannelId: channelID, PostId: posts[len(posts)-1].Id, PerPage: 10}, map[string]bool{}) assert.NoError(t, err) assert.Equal(t, []string{}, postList.Order) @@ -1926,7 +1926,7 @@ func testPostStoreGetPostsBeforeAfter(t *testing.T, rctx request.CTX, ss store.S }) t.Run("should return posts after a post", func(t *testing.T) { - postList, err := ss.Post().GetPostsAfter(model.GetPostsOptions{ChannelId: channelId, PostId: posts[5].Id, PerPage: 10}, map[string]bool{}) + postList, err := ss.Post().GetPostsAfter(model.GetPostsOptions{ChannelId: channelID, PostId: posts[5].Id, PerPage: 10}, map[string]bool{}) assert.NoError(t, err) assert.Equal(t, []string{posts[9].Id, posts[8].Id, posts[7].Id, posts[6].Id}, postList.Order) @@ -1939,7 +1939,7 @@ func testPostStoreGetPostsBeforeAfter(t *testing.T, rctx request.CTX, ss store.S }) t.Run("should limit posts after", func(t *testing.T) { - postList, err := ss.Post().GetPostsAfter(model.GetPostsOptions{ChannelId: channelId, PostId: posts[5].Id, PerPage: 2}, map[string]bool{}) + postList, err := ss.Post().GetPostsAfter(model.GetPostsOptions{ChannelId: channelID, PostId: posts[5].Id, PerPage: 2}, map[string]bool{}) assert.NoError(t, err) assert.Equal(t, []string{posts[7].Id, posts[6].Id}, postList.Order) @@ -1950,17 +1950,17 @@ func testPostStoreGetPostsBeforeAfter(t *testing.T, rctx request.CTX, ss store.S }) }) t.Run("with threads", func(t *testing.T) { - teamId := model.NewId() + teamID := model.NewId() channel1, err := ss.Channel().Save(rctx, &model.Channel{ - TeamId: teamId, + TeamId: teamID, DisplayName: "DisplayName1", Name: "channel" + model.NewId(), Type: model.ChannelTypeOpen, }, -1) require.NoError(t, err) - channelId := channel1.Id - userId := model.NewId() + channelID := channel1.Id + userID := model.NewId() // This creates a series of posts that looks like: // post1 @@ -1971,8 +1971,8 @@ func testPostStoreGetPostsBeforeAfter(t *testing.T, rctx request.CTX, ss store.S // post6 (in response to post2) post1, err := ss.Post().Save(rctx, &model.Post{ - ChannelId: channelId, - UserId: userId, + ChannelId: channelID, + UserId: userID, Message: "message", }) post1.ReplyCount = 1 @@ -1980,8 +1980,8 @@ func testPostStoreGetPostsBeforeAfter(t *testing.T, rctx request.CTX, ss store.S time.Sleep(time.Millisecond) post2, err := ss.Post().Save(rctx, &model.Post{ - ChannelId: channelId, - UserId: userId, + ChannelId: channelID, + UserId: userID, Message: "message", }) require.NoError(t, err) @@ -1989,8 +1989,8 @@ func testPostStoreGetPostsBeforeAfter(t *testing.T, rctx request.CTX, ss store.S time.Sleep(time.Millisecond) post3, err := ss.Post().Save(rctx, &model.Post{ - ChannelId: channelId, - UserId: userId, + ChannelId: channelID, + UserId: userID, RootId: post1.Id, Message: "message", }) @@ -1999,8 +1999,8 @@ func testPostStoreGetPostsBeforeAfter(t *testing.T, rctx request.CTX, ss store.S time.Sleep(time.Millisecond) post4, err := ss.Post().Save(rctx, &model.Post{ - ChannelId: channelId, - UserId: userId, + ChannelId: channelID, + UserId: userID, RootId: post2.Id, Message: "message", }) @@ -2009,16 +2009,16 @@ func testPostStoreGetPostsBeforeAfter(t *testing.T, rctx request.CTX, ss store.S time.Sleep(time.Millisecond) post5, err := ss.Post().Save(rctx, &model.Post{ - ChannelId: channelId, - UserId: userId, + ChannelId: channelID, + UserId: userID, Message: "message", }) require.NoError(t, err) time.Sleep(time.Millisecond) post6, err := ss.Post().Save(rctx, &model.Post{ - ChannelId: channelId, - UserId: userId, + ChannelId: channelID, + UserId: userID, RootId: post2.Id, Message: "message", }) @@ -2030,7 +2030,7 @@ func testPostStoreGetPostsBeforeAfter(t *testing.T, rctx request.CTX, ss store.S post2.UpdateAt = post6.UpdateAt t.Run("should return each post and thread before a post", func(t *testing.T) { - postList, err := ss.Post().GetPostsBefore(model.GetPostsOptions{ChannelId: channelId, PostId: post4.Id, PerPage: 2}, map[string]bool{}) + postList, err := ss.Post().GetPostsBefore(model.GetPostsOptions{ChannelId: channelID, PostId: post4.Id, PerPage: 2}, map[string]bool{}) assert.NoError(t, err) assert.Equal(t, []string{post3.Id, post2.Id}, postList.Order) @@ -2044,7 +2044,7 @@ func testPostStoreGetPostsBeforeAfter(t *testing.T, rctx request.CTX, ss store.S }) t.Run("should return each post and the root of each thread after a post", func(t *testing.T) { - postList, err := ss.Post().GetPostsAfter(model.GetPostsOptions{ChannelId: channelId, PostId: post4.Id, PerPage: 2}, map[string]bool{}) + postList, err := ss.Post().GetPostsAfter(model.GetPostsOptions{ChannelId: channelID, PostId: post4.Id, PerPage: 2}, map[string]bool{}) assert.NoError(t, err) assert.Equal(t, []string{post6.Id, post5.Id}, postList.Order) @@ -2057,17 +2057,17 @@ func testPostStoreGetPostsBeforeAfter(t *testing.T, rctx request.CTX, ss store.S }) }) t.Run("with threads (skipFetchThreads)", func(t *testing.T) { - teamId := model.NewId() + teamID := model.NewId() channel1, err := ss.Channel().Save(rctx, &model.Channel{ - TeamId: teamId, + TeamId: teamID, DisplayName: "DisplayName1", Name: "channel" + model.NewId(), Type: model.ChannelTypeOpen, }, -1) require.NoError(t, err) - channelId := channel1.Id - userId := model.NewId() + channelID := channel1.Id + userID := model.NewId() // This creates a series of posts that looks like: // post1 @@ -2078,8 +2078,8 @@ func testPostStoreGetPostsBeforeAfter(t *testing.T, rctx request.CTX, ss store.S // post6 (in response to post2) post1, err := ss.Post().Save(rctx, &model.Post{ - ChannelId: channelId, - UserId: userId, + ChannelId: channelID, + UserId: userID, Message: "post1", }) require.NoError(t, err) @@ -2087,8 +2087,8 @@ func testPostStoreGetPostsBeforeAfter(t *testing.T, rctx request.CTX, ss store.S time.Sleep(time.Millisecond) post2, err := ss.Post().Save(rctx, &model.Post{ - ChannelId: channelId, - UserId: userId, + ChannelId: channelID, + UserId: userID, Message: "post2", }) require.NoError(t, err) @@ -2096,8 +2096,8 @@ func testPostStoreGetPostsBeforeAfter(t *testing.T, rctx request.CTX, ss store.S time.Sleep(time.Millisecond) post3, err := ss.Post().Save(rctx, &model.Post{ - ChannelId: channelId, - UserId: userId, + ChannelId: channelID, + UserId: userID, RootId: post1.Id, Message: "post3", }) @@ -2106,8 +2106,8 @@ func testPostStoreGetPostsBeforeAfter(t *testing.T, rctx request.CTX, ss store.S time.Sleep(time.Millisecond) post4, err := ss.Post().Save(rctx, &model.Post{ - ChannelId: channelId, - UserId: userId, + ChannelId: channelID, + UserId: userID, RootId: post2.Id, Message: "post4", }) @@ -2116,16 +2116,16 @@ func testPostStoreGetPostsBeforeAfter(t *testing.T, rctx request.CTX, ss store.S time.Sleep(time.Millisecond) post5, err := ss.Post().Save(rctx, &model.Post{ - ChannelId: channelId, - UserId: userId, + ChannelId: channelID, + UserId: userID, Message: "post5", }) require.NoError(t, err) time.Sleep(time.Millisecond) post6, err := ss.Post().Save(rctx, &model.Post{ - ChannelId: channelId, - UserId: userId, + ChannelId: channelID, + UserId: userID, RootId: post2.Id, Message: "post6", }) @@ -2137,7 +2137,7 @@ func testPostStoreGetPostsBeforeAfter(t *testing.T, rctx request.CTX, ss store.S post2.UpdateAt = post6.UpdateAt t.Run("should return each post and thread before a post", func(t *testing.T) { - postList, err := ss.Post().GetPostsBefore(model.GetPostsOptions{ChannelId: channelId, PostId: post4.Id, PerPage: 2, SkipFetchThreads: true}, map[string]bool{}) + postList, err := ss.Post().GetPostsBefore(model.GetPostsOptions{ChannelId: channelID, PostId: post4.Id, PerPage: 2, SkipFetchThreads: true}, map[string]bool{}) assert.NoError(t, err) assert.Equal(t, []string{post3.Id, post2.Id}, postList.Order) @@ -2149,7 +2149,7 @@ func testPostStoreGetPostsBeforeAfter(t *testing.T, rctx request.CTX, ss store.S }) t.Run("should return each post and thread before a post with limit", func(t *testing.T) { - postList, err := ss.Post().GetPostsBefore(model.GetPostsOptions{ChannelId: channelId, PostId: post4.Id, PerPage: 1, SkipFetchThreads: true}, map[string]bool{}) + postList, err := ss.Post().GetPostsBefore(model.GetPostsOptions{ChannelId: channelID, PostId: post4.Id, PerPage: 1, SkipFetchThreads: true}, map[string]bool{}) assert.NoError(t, err) assert.Equal(t, []string{post3.Id}, postList.Order) @@ -2160,7 +2160,7 @@ func testPostStoreGetPostsBeforeAfter(t *testing.T, rctx request.CTX, ss store.S }) t.Run("should return each post and the root of each thread after a post", func(t *testing.T) { - postList, err := ss.Post().GetPostsAfter(model.GetPostsOptions{ChannelId: channelId, PostId: post4.Id, PerPage: 2, SkipFetchThreads: true}, map[string]bool{}) + postList, err := ss.Post().GetPostsAfter(model.GetPostsOptions{ChannelId: channelID, PostId: post4.Id, PerPage: 2, SkipFetchThreads: true}, map[string]bool{}) assert.NoError(t, err) assert.Equal(t, []string{post6.Id, post5.Id}, postList.Order) @@ -2172,17 +2172,17 @@ func testPostStoreGetPostsBeforeAfter(t *testing.T, rctx request.CTX, ss store.S }) }) t.Run("with threads (collapsedThreads)", func(t *testing.T) { - teamId := model.NewId() + teamID := model.NewId() channel1, err := ss.Channel().Save(rctx, &model.Channel{ - TeamId: teamId, + TeamId: teamID, DisplayName: "DisplayName1", Name: "channel" + model.NewId(), Type: model.ChannelTypeOpen, }, -1) require.NoError(t, err) - channelId := channel1.Id - userId := model.NewId() + channelID := channel1.Id + userID := model.NewId() // This creates a series of posts that looks like: // post1 @@ -2193,8 +2193,8 @@ func testPostStoreGetPostsBeforeAfter(t *testing.T, rctx request.CTX, ss store.S // post6 (in response to post2) post1, err := ss.Post().Save(rctx, &model.Post{ - ChannelId: channelId, - UserId: userId, + ChannelId: channelID, + UserId: userID, Message: "post1", }) require.NoError(t, err) @@ -2202,8 +2202,8 @@ func testPostStoreGetPostsBeforeAfter(t *testing.T, rctx request.CTX, ss store.S time.Sleep(time.Millisecond) post2, err := ss.Post().Save(rctx, &model.Post{ - ChannelId: channelId, - UserId: userId, + ChannelId: channelID, + UserId: userID, Message: "post2", }) require.NoError(t, err) @@ -2211,8 +2211,8 @@ func testPostStoreGetPostsBeforeAfter(t *testing.T, rctx request.CTX, ss store.S time.Sleep(time.Millisecond) post3, err := ss.Post().Save(rctx, &model.Post{ - ChannelId: channelId, - UserId: userId, + ChannelId: channelID, + UserId: userID, RootId: post1.Id, Message: "post3", }) @@ -2221,8 +2221,8 @@ func testPostStoreGetPostsBeforeAfter(t *testing.T, rctx request.CTX, ss store.S time.Sleep(time.Millisecond) post4, err := ss.Post().Save(rctx, &model.Post{ - ChannelId: channelId, - UserId: userId, + ChannelId: channelID, + UserId: userID, RootId: post2.Id, Message: "post4", }) @@ -2231,16 +2231,16 @@ func testPostStoreGetPostsBeforeAfter(t *testing.T, rctx request.CTX, ss store.S time.Sleep(time.Millisecond) post5, err := ss.Post().Save(rctx, &model.Post{ - ChannelId: channelId, - UserId: userId, + ChannelId: channelID, + UserId: userID, Message: "post5", }) require.NoError(t, err) time.Sleep(time.Millisecond) post6, err := ss.Post().Save(rctx, &model.Post{ - ChannelId: channelId, - UserId: userId, + ChannelId: channelID, + UserId: userID, RootId: post2.Id, Message: "post6", }) @@ -2252,21 +2252,21 @@ func testPostStoreGetPostsBeforeAfter(t *testing.T, rctx request.CTX, ss store.S post2.UpdateAt = post6.UpdateAt t.Run("should return each root post before a post", func(t *testing.T) { - postList, err := ss.Post().GetPostsBefore(model.GetPostsOptions{ChannelId: channelId, PostId: post4.Id, PerPage: 2, CollapsedThreads: true}, map[string]bool{}) + postList, err := ss.Post().GetPostsBefore(model.GetPostsOptions{ChannelId: channelID, PostId: post4.Id, PerPage: 2, CollapsedThreads: true}, map[string]bool{}) assert.NoError(t, err) assert.Equal(t, []string{post2.Id, post1.Id}, postList.Order) }) t.Run("should return each root post before a post with limit", func(t *testing.T) { - postList, err := ss.Post().GetPostsBefore(model.GetPostsOptions{ChannelId: channelId, PostId: post4.Id, PerPage: 1, CollapsedThreads: true}, map[string]bool{}) + postList, err := ss.Post().GetPostsBefore(model.GetPostsOptions{ChannelId: channelID, PostId: post4.Id, PerPage: 1, CollapsedThreads: true}, map[string]bool{}) assert.NoError(t, err) assert.Equal(t, []string{post2.Id}, postList.Order) }) t.Run("should return each root after a post", func(t *testing.T) { - postList, err := ss.Post().GetPostsAfter(model.GetPostsOptions{ChannelId: channelId, PostId: post4.Id, PerPage: 2, CollapsedThreads: true}, map[string]bool{}) + postList, err := ss.Post().GetPostsAfter(model.GetPostsOptions{ChannelId: channelID, PostId: post4.Id, PerPage: 2, CollapsedThreads: true}, map[string]bool{}) require.NoError(t, err) assert.Equal(t, []string{post5.Id}, postList.Order) @@ -2276,53 +2276,53 @@ func testPostStoreGetPostsBeforeAfter(t *testing.T, rctx request.CTX, ss store.S func testPostStoreGetPostsSince(t *testing.T, rctx request.CTX, ss store.Store) { t.Run("should return posts created after the given time", func(t *testing.T) { - teamId := model.NewId() + teamID := model.NewId() channel1, err := ss.Channel().Save(rctx, &model.Channel{ - TeamId: teamId, + TeamId: teamID, DisplayName: "DisplayName1", Name: "channel" + model.NewId(), Type: model.ChannelTypeOpen, }, -1) require.NoError(t, err) - channelId := channel1.Id - userId := model.NewId() + channelID := channel1.Id + userID := model.NewId() post1, err := ss.Post().Save(rctx, &model.Post{ - ChannelId: channelId, - UserId: userId, + ChannelId: channelID, + UserId: userID, Message: "message", }) require.NoError(t, err) time.Sleep(time.Millisecond) _, err = ss.Post().Save(rctx, &model.Post{ - ChannelId: channelId, - UserId: userId, + ChannelId: channelID, + UserId: userID, Message: "message", }) require.NoError(t, err) time.Sleep(time.Millisecond) post3, err := ss.Post().Save(rctx, &model.Post{ - ChannelId: channelId, - UserId: userId, + ChannelId: channelID, + UserId: userID, Message: "message", }) require.NoError(t, err) time.Sleep(time.Millisecond) post4, err := ss.Post().Save(rctx, &model.Post{ - ChannelId: channelId, - UserId: userId, + ChannelId: channelID, + UserId: userID, Message: "message", }) require.NoError(t, err) time.Sleep(time.Millisecond) post5, err := ss.Post().Save(rctx, &model.Post{ - ChannelId: channelId, - UserId: userId, + ChannelId: channelID, + UserId: userID, Message: "message", RootId: post3.Id, }) @@ -2330,15 +2330,15 @@ func testPostStoreGetPostsSince(t *testing.T, rctx request.CTX, ss store.Store) time.Sleep(time.Millisecond) post6, err := ss.Post().Save(rctx, &model.Post{ - ChannelId: channelId, - UserId: userId, + ChannelId: channelID, + UserId: userID, Message: "message", RootId: post1.Id, }) require.NoError(t, err) time.Sleep(time.Millisecond) - postList, err := ss.Post().GetPostsSince(model.GetPostsSinceOptions{ChannelId: channelId, Time: post3.CreateAt}, false, map[string]bool{}) + postList, err := ss.Post().GetPostsSince(model.GetPostsSinceOptions{ChannelId: channelID, Time: post3.CreateAt}, false, map[string]bool{}) require.NoError(t, err) assert.Equal(t, []string{ @@ -2358,27 +2358,27 @@ func testPostStoreGetPostsSince(t *testing.T, rctx request.CTX, ss store.Store) }) t.Run("should return empty list when nothing has changed", func(t *testing.T) { - teamId := model.NewId() + teamID := model.NewId() channel1, err := ss.Channel().Save(rctx, &model.Channel{ - TeamId: teamId, + TeamId: teamID, DisplayName: "DisplayName1", Name: "channel" + model.NewId(), Type: model.ChannelTypeOpen, }, -1) require.NoError(t, err) - channelId := channel1.Id - userId := model.NewId() + channelID := channel1.Id + userID := model.NewId() post1, err := ss.Post().Save(rctx, &model.Post{ - ChannelId: channelId, - UserId: userId, + ChannelId: channelID, + UserId: userID, Message: "message", }) require.NoError(t, err) time.Sleep(time.Millisecond) - postList, err := ss.Post().GetPostsSince(model.GetPostsSinceOptions{ChannelId: channelId, Time: post1.CreateAt}, false, map[string]bool{}) + postList, err := ss.Post().GetPostsSince(model.GetPostsSinceOptions{ChannelId: channelID, Time: post1.CreateAt}, false, map[string]bool{}) assert.NoError(t, err) assert.Equal(t, []string{}, postList.Order) @@ -2388,33 +2388,33 @@ func testPostStoreGetPostsSince(t *testing.T, rctx request.CTX, ss store.Store) t.Run("should not cache a timestamp of 0 when nothing has changed", func(t *testing.T) { ss.Post().ClearCaches() - teamId := model.NewId() + teamID := model.NewId() channel1, err := ss.Channel().Save(rctx, &model.Channel{ - TeamId: teamId, + TeamId: teamID, DisplayName: "DisplayName1", Name: "channel" + model.NewId(), Type: model.ChannelTypeOpen, }, -1) require.NoError(t, err) - channelId := channel1.Id - userId := model.NewId() + channelID := channel1.Id + userID := model.NewId() post1, err := ss.Post().Save(rctx, &model.Post{ - ChannelId: channelId, - UserId: userId, + ChannelId: channelID, + UserId: userID, Message: "message", }) require.NoError(t, err) time.Sleep(time.Millisecond) // Make a request that returns no results - postList, err := ss.Post().GetPostsSince(model.GetPostsSinceOptions{ChannelId: channelId, Time: post1.CreateAt}, true, map[string]bool{}) + postList, err := ss.Post().GetPostsSince(model.GetPostsSinceOptions{ChannelId: channelID, Time: post1.CreateAt}, true, map[string]bool{}) require.NoError(t, err) require.Equal(t, model.NewPostList(), postList) // And then ensure that it doesn't cause future requests to also return no results - postList, err = ss.Post().GetPostsSince(model.GetPostsSinceOptions{ChannelId: channelId, Time: post1.CreateAt - 1}, true, map[string]bool{}) + postList, err = ss.Post().GetPostsSince(model.GetPostsSinceOptions{ChannelId: channelID, Time: post1.CreateAt - 1}, true, map[string]bool{}) require.NoError(t, err) assert.Equal(t, []string{post1.Id}, postList.Order) @@ -2425,53 +2425,53 @@ func testPostStoreGetPostsSince(t *testing.T, rctx request.CTX, ss store.Store) } func testPostStoreGetPosts(t *testing.T, rctx request.CTX, ss store.Store) { - teamId := model.NewId() + teamID := model.NewId() channel1, err := ss.Channel().Save(rctx, &model.Channel{ - TeamId: teamId, + TeamId: teamID, DisplayName: "DisplayName1", Name: "channel" + model.NewId(), Type: model.ChannelTypeOpen, }, -1) require.NoError(t, err) - channelId := channel1.Id - userId := model.NewId() + channelID := channel1.Id + userID := model.NewId() post1, err := ss.Post().Save(rctx, &model.Post{ - ChannelId: channelId, - UserId: userId, + ChannelId: channelID, + UserId: userID, Message: "message", }) require.NoError(t, err) time.Sleep(time.Millisecond) post2, err := ss.Post().Save(rctx, &model.Post{ - ChannelId: channelId, - UserId: userId, + ChannelId: channelID, + UserId: userID, Message: "message", }) require.NoError(t, err) time.Sleep(time.Millisecond) post3, err := ss.Post().Save(rctx, &model.Post{ - ChannelId: channelId, - UserId: userId, + ChannelId: channelID, + UserId: userID, Message: "message", }) require.NoError(t, err) time.Sleep(time.Millisecond) post4, err := ss.Post().Save(rctx, &model.Post{ - ChannelId: channelId, - UserId: userId, + ChannelId: channelID, + UserId: userID, Message: "message", }) require.NoError(t, err) time.Sleep(time.Millisecond) post5, err := ss.Post().Save(rctx, &model.Post{ - ChannelId: channelId, - UserId: userId, + ChannelId: channelID, + UserId: userID, Message: "message", RootId: post3.Id, }) @@ -2479,15 +2479,15 @@ func testPostStoreGetPosts(t *testing.T, rctx request.CTX, ss store.Store) { time.Sleep(time.Millisecond) post6, err := ss.Post().Save(rctx, &model.Post{ - ChannelId: channelId, - UserId: userId, + ChannelId: channelID, + UserId: userID, Message: "message", RootId: post1.Id, }) require.NoError(t, err) t.Run("should return the last posts created in a channel", func(t *testing.T) { - postList, err := ss.Post().GetPosts(model.GetPostsOptions{ChannelId: channelId, Page: 0, PerPage: 30, SkipFetchThreads: false}, false, map[string]bool{}) + postList, err := ss.Post().GetPosts(model.GetPostsOptions{ChannelId: channelID, Page: 0, PerPage: 30, SkipFetchThreads: false}, false, map[string]bool{}) assert.NoError(t, err) assert.Equal(t, []string{ @@ -2509,7 +2509,7 @@ func testPostStoreGetPosts(t *testing.T, rctx request.CTX, ss store.Store) { }) t.Run("should return the last posts created in a channel and the threads and the reply count must be 0", func(t *testing.T) { - postList, err := ss.Post().GetPosts(model.GetPostsOptions{ChannelId: channelId, Page: 0, PerPage: 2, SkipFetchThreads: false}, false, map[string]bool{}) + postList, err := ss.Post().GetPosts(model.GetPostsOptions{ChannelId: channelID, Page: 0, PerPage: 2, SkipFetchThreads: false}, false, map[string]bool{}) assert.NoError(t, err) assert.Equal(t, []string{ @@ -2529,7 +2529,7 @@ func testPostStoreGetPosts(t *testing.T, rctx request.CTX, ss store.Store) { }) t.Run("should return the last posts created in a channel without the threads and the reply count must be correct", func(t *testing.T) { - postList, err := ss.Post().GetPosts(model.GetPostsOptions{ChannelId: channelId, Page: 0, PerPage: 2, SkipFetchThreads: true}, false, map[string]bool{}) + postList, err := ss.Post().GetPosts(model.GetPostsOptions{ChannelId: channelID, Page: 0, PerPage: 2, SkipFetchThreads: true}, false, map[string]bool{}) require.NoError(t, err) assert.Equal(t, []string{ @@ -2545,10 +2545,10 @@ func testPostStoreGetPosts(t *testing.T, rctx request.CTX, ss store.Store) { }) t.Run("should return all posts in a channel included deleted posts", func(t *testing.T) { - err := ss.Post().Delete(rctx, post1.Id, 1, userId) + err := ss.Post().Delete(rctx, post1.Id, 1, userID) require.NoError(t, err) - postList, err := ss.Post().GetPosts(model.GetPostsOptions{ChannelId: channelId, Page: 0, PerPage: 30, SkipFetchThreads: false, IncludeDeleted: true}, false, map[string]bool{}) + postList, err := ss.Post().GetPosts(model.GetPostsOptions{ChannelId: channelID, Page: 0, PerPage: 30, SkipFetchThreads: false, IncludeDeleted: true}, false, map[string]bool{}) require.NoError(t, err) assert.Equal(t, []string{ @@ -2570,10 +2570,10 @@ func testPostStoreGetPosts(t *testing.T, rctx request.CTX, ss store.Store) { }) t.Run("should return all posts in a channel included deleted posts without threads", func(t *testing.T) { - err := ss.Post().Delete(rctx, post5.Id, 1, userId) + err := ss.Post().Delete(rctx, post5.Id, 1, userID) require.NoError(t, err) - postList, err := ss.Post().GetPosts(model.GetPostsOptions{ChannelId: channelId, Page: 0, PerPage: 30, SkipFetchThreads: true, IncludeDeleted: true}, false, map[string]bool{}) + postList, err := ss.Post().GetPosts(model.GetPostsOptions{ChannelId: channelID, Page: 0, PerPage: 30, SkipFetchThreads: true, IncludeDeleted: true}, false, map[string]bool{}) require.NoError(t, err) assert.Equal(t, []string{ @@ -2593,10 +2593,10 @@ func testPostStoreGetPosts(t *testing.T, rctx request.CTX, ss store.Store) { }) t.Run("should return the lasts posts created in channel without include deleted posts", func(t *testing.T) { - err := ss.Post().Delete(rctx, post6.Id, 1, userId) + err := ss.Post().Delete(rctx, post6.Id, 1, userID) require.NoError(t, err) - postList, err := ss.Post().GetPosts(model.GetPostsOptions{ChannelId: channelId, Page: 0, PerPage: 30, SkipFetchThreads: true, IncludeDeleted: false}, false, map[string]bool{}) + postList, err := ss.Post().GetPosts(model.GetPostsOptions{ChannelId: channelID, Page: 0, PerPage: 30, SkipFetchThreads: true, IncludeDeleted: false}, false, map[string]bool{}) require.NoError(t, err) assert.Equal(t, []string{ @@ -2613,27 +2613,27 @@ func testPostStoreGetPosts(t *testing.T, rctx request.CTX, ss store.Store) { } func testPostStoreGetPostBeforeAfter(t *testing.T, rctx request.CTX, ss store.Store) { - teamId := model.NewId() + teamID := model.NewId() channel1, err := ss.Channel().Save(rctx, &model.Channel{ - TeamId: teamId, + TeamId: teamID, DisplayName: "DisplayName1", Name: "channel" + model.NewId(), Type: model.ChannelTypeOpen, }, -1) require.NoError(t, err) - channelId := channel1.Id + channelID := channel1.Id o0 := &model.Post{} - o0.ChannelId = channelId + o0.ChannelId = channelID o0.UserId = model.NewId() - o0.Message = NewTestId() + o0.Message = NewTestID() _, err = ss.Post().Save(rctx, o0) require.NoError(t, err) time.Sleep(2 * time.Millisecond) o1 := &model.Post{} - o1.ChannelId = channelId + o1.ChannelId = channelID o1.Type = model.PostTypeJoinChannel o1.UserId = model.NewId() o1.Message = "system_join_channel message" @@ -2642,16 +2642,16 @@ func testPostStoreGetPostBeforeAfter(t *testing.T, rctx request.CTX, ss store.St time.Sleep(2 * time.Millisecond) o0a := &model.Post{} - o0a.ChannelId = channelId + o0a.ChannelId = channelID o0a.UserId = model.NewId() - o0a.Message = NewTestId() + o0a.Message = NewTestID() o0a.RootId = o1.Id _, err = ss.Post().Save(rctx, o0a) require.NoError(t, err) time.Sleep(2 * time.Millisecond) o0b := &model.Post{} - o0b.ChannelId = channelId + o0b.ChannelId = channelID o0b.UserId = model.NewId() o0b.Message = "deleted message" o0b.RootId = o1.Id @@ -2661,7 +2661,7 @@ func testPostStoreGetPostBeforeAfter(t *testing.T, rctx request.CTX, ss store.St time.Sleep(2 * time.Millisecond) channel2, err := ss.Channel().Save(rctx, &model.Channel{ - TeamId: teamId, + TeamId: teamID, DisplayName: "DisplayName2", Name: "channel" + model.NewId(), Type: model.ChannelTypeOpen, @@ -2671,60 +2671,60 @@ func testPostStoreGetPostBeforeAfter(t *testing.T, rctx request.CTX, ss store.St otherChannelPost := &model.Post{} otherChannelPost.ChannelId = channel2.Id otherChannelPost.UserId = model.NewId() - otherChannelPost.Message = NewTestId() + otherChannelPost.Message = NewTestID() _, err = ss.Post().Save(rctx, otherChannelPost) require.NoError(t, err) time.Sleep(2 * time.Millisecond) o2 := &model.Post{} - o2.ChannelId = channelId + o2.ChannelId = channelID o2.UserId = model.NewId() - o2.Message = NewTestId() + o2.Message = NewTestID() _, err = ss.Post().Save(rctx, o2) require.NoError(t, err) time.Sleep(2 * time.Millisecond) o2a := &model.Post{} - o2a.ChannelId = channelId + o2a.ChannelId = channelID o2a.UserId = model.NewId() - o2a.Message = NewTestId() + o2a.Message = NewTestID() o2a.RootId = o2.Id _, err = ss.Post().Save(rctx, o2a) require.NoError(t, err) - rPostId1, err := ss.Post().GetPostIdBeforeTime(channelId, o0a.CreateAt, false) - require.Equal(t, rPostId1, o1.Id, "should return before post o1") + rPostID1, err := ss.Post().GetPostIdBeforeTime(channelID, o0a.CreateAt, false) + require.Equal(t, rPostID1, o1.Id, "should return before post o1") require.NoError(t, err) - rPostId1, err = ss.Post().GetPostIdAfterTime(channelId, o0b.CreateAt, false) - require.Equal(t, rPostId1, o2.Id, "should return before post o2") + rPostID1, err = ss.Post().GetPostIdAfterTime(channelID, o0b.CreateAt, false) + require.Equal(t, rPostID1, o2.Id, "should return before post o2") require.NoError(t, err) - rPost1, err := ss.Post().GetPostAfterTime(channelId, o0b.CreateAt, false) + rPost1, err := ss.Post().GetPostAfterTime(channelID, o0b.CreateAt, false) require.Equal(t, rPost1.Id, o2.Id, "should return before post o2") require.NoError(t, err) - rPostId2, err := ss.Post().GetPostIdBeforeTime(channelId, o0.CreateAt, false) - require.Empty(t, rPostId2, "should return no post") + rPostID2, err := ss.Post().GetPostIdBeforeTime(channelID, o0.CreateAt, false) + require.Empty(t, rPostID2, "should return no post") require.NoError(t, err) - rPostId2, err = ss.Post().GetPostIdAfterTime(channelId, o0.CreateAt, false) - require.Equal(t, rPostId2, o1.Id, "should return before post o1") + rPostID2, err = ss.Post().GetPostIdAfterTime(channelID, o0.CreateAt, false) + require.Equal(t, rPostID2, o1.Id, "should return before post o1") require.NoError(t, err) - rPost2, err := ss.Post().GetPostAfterTime(channelId, o0.CreateAt, false) + rPost2, err := ss.Post().GetPostAfterTime(channelID, o0.CreateAt, false) require.Equal(t, rPost2.Id, o1.Id, "should return before post o1") require.NoError(t, err) - rPostId3, err := ss.Post().GetPostIdBeforeTime(channelId, o2a.CreateAt, false) - require.Equal(t, rPostId3, o2.Id, "should return before post o2") + rPostID3, err := ss.Post().GetPostIdBeforeTime(channelID, o2a.CreateAt, false) + require.Equal(t, rPostID3, o2.Id, "should return before post o2") require.NoError(t, err) - rPostId3, err = ss.Post().GetPostIdAfterTime(channelId, o2a.CreateAt, false) - require.Empty(t, rPostId3, "should return no post") + rPostID3, err = ss.Post().GetPostIdAfterTime(channelID, o2a.CreateAt, false) + require.Empty(t, rPostID3, "should return no post") require.NoError(t, err) - rPost3, err := ss.Post().GetPostAfterTime(channelId, o2a.CreateAt, false) + rPost3, err := ss.Post().GetPostAfterTime(channelID, o2a.CreateAt, false) require.Empty(t, rPost3.Id, "should return no post") require.NoError(t, err) } @@ -2732,7 +2732,7 @@ func testPostStoreGetPostBeforeAfter(t *testing.T, rctx request.CTX, ss store.St func testUserCountsWithPostsByDay(t *testing.T, rctx request.CTX, ss store.Store) { t1 := &model.Team{} t1.DisplayName = "DisplayName" - t1.Name = NewTestId() + t1.Name = NewTestID() t1.Email = MakeEmail() t1.Type = model.TeamOpen t1, err := ss.Team().Save(t1) @@ -2741,7 +2741,7 @@ func testUserCountsWithPostsByDay(t *testing.T, rctx request.CTX, ss store.Store c1 := &model.Channel{} c1.TeamId = t1.Id c1.DisplayName = "Channel2" - c1.Name = NewTestId() + c1.Name = NewTestID() c1.Type = model.ChannelTypeOpen c1, nErr := ss.Channel().Save(rctx, c1, -1) require.NoError(t, nErr) @@ -2750,7 +2750,7 @@ func testUserCountsWithPostsByDay(t *testing.T, rctx request.CTX, ss store.Store o1.ChannelId = c1.Id o1.UserId = model.NewId() o1.CreateAt = utils.MillisFromTime(utils.Yesterday()) - o1.Message = NewTestId() + o1.Message = NewTestID() o1, nErr = ss.Post().Save(rctx, o1) require.NoError(t, nErr) @@ -2758,7 +2758,7 @@ func testUserCountsWithPostsByDay(t *testing.T, rctx request.CTX, ss store.Store o1a.ChannelId = c1.Id o1a.UserId = model.NewId() o1a.CreateAt = o1.CreateAt - o1a.Message = NewTestId() + o1a.Message = NewTestID() _, nErr = ss.Post().Save(rctx, o1a) require.NoError(t, nErr) @@ -2766,7 +2766,7 @@ func testUserCountsWithPostsByDay(t *testing.T, rctx request.CTX, ss store.Store o2.ChannelId = c1.Id o2.UserId = model.NewId() o2.CreateAt = o1.CreateAt - (1000 * 60 * 60 * 24) - o2.Message = NewTestId() + o2.Message = NewTestID() o2, nErr = ss.Post().Save(rctx, o2) require.NoError(t, nErr) @@ -2774,7 +2774,7 @@ func testUserCountsWithPostsByDay(t *testing.T, rctx request.CTX, ss store.Store o2a.ChannelId = c1.Id o2a.UserId = o2.UserId o2a.CreateAt = o1.CreateAt - (1000 * 60 * 60 * 24) - o2a.Message = NewTestId() + o2a.Message = NewTestID() _, nErr = ss.Post().Save(rctx, o2a) require.NoError(t, nErr) @@ -2791,7 +2791,7 @@ func testUserCountsWithPostsByDay(t *testing.T, rctx request.CTX, ss store.Store func testPostCountsByDay(t *testing.T, rctx request.CTX, ss store.Store) { t1 := &model.Team{} t1.DisplayName = "DisplayName" - t1.Name = NewTestId() + t1.Name = NewTestID() t1.Email = MakeEmail() t1.Type = model.TeamOpen t1, err := ss.Team().Save(t1) @@ -2800,7 +2800,7 @@ func testPostCountsByDay(t *testing.T, rctx request.CTX, ss store.Store) { c1 := &model.Channel{} c1.TeamId = t1.Id c1.DisplayName = "Channel2" - c1.Name = NewTestId() + c1.Name = NewTestID() c1.Type = model.ChannelTypeOpen c1, nErr := ss.Channel().Save(rctx, c1, -1) require.NoError(t, nErr) @@ -2809,7 +2809,7 @@ func testPostCountsByDay(t *testing.T, rctx request.CTX, ss store.Store) { o1.ChannelId = c1.Id o1.UserId = model.NewId() o1.CreateAt = utils.MillisFromTime(utils.Yesterday()) - o1.Message = NewTestId() + o1.Message = NewTestID() o1.Hashtags = "hashtag" o1, nErr = ss.Post().Save(rctx, o1) require.NoError(t, nErr) @@ -2818,7 +2818,7 @@ func testPostCountsByDay(t *testing.T, rctx request.CTX, ss store.Store) { o1a.ChannelId = c1.Id o1a.UserId = model.NewId() o1a.CreateAt = o1.CreateAt - o1a.Message = NewTestId() + o1a.Message = NewTestID() o1a.FileIds = []string{"fileId1"} _, nErr = ss.Post().Save(rctx, o1a) require.NoError(t, nErr) @@ -2827,7 +2827,7 @@ func testPostCountsByDay(t *testing.T, rctx request.CTX, ss store.Store) { o2.ChannelId = c1.Id o2.UserId = model.NewId() o2.CreateAt = o1.CreateAt - (1000 * 60 * 60 * 24 * 2) - o2.Message = NewTestId() + o2.Message = NewTestID() o2.Filenames = []string{"filename1"} o2, nErr = ss.Post().Save(rctx, o2) require.NoError(t, nErr) @@ -2836,7 +2836,7 @@ func testPostCountsByDay(t *testing.T, rctx request.CTX, ss store.Store) { o2a.ChannelId = c1.Id o2a.UserId = o2.UserId o2a.CreateAt = o1.CreateAt - (1000 * 60 * 60 * 24 * 2) - o2a.Message = NewTestId() + o2a.Message = NewTestID() o2a.Hashtags = "hashtag" o2a.FileIds = []string{"fileId2"} _, nErr = ss.Post().Save(rctx, o2a) @@ -2908,7 +2908,7 @@ func testPostCounts(t *testing.T, rctx request.CTX, ss store.Store) { t1 := &model.Team{} t1.DisplayName = "DisplayName" - t1.Name = NewTestId() + t1.Name = NewTestID() t1.Email = MakeEmail() t1.Type = model.TeamOpen t1, err := ss.Team().Save(t1) @@ -2917,7 +2917,7 @@ func testPostCounts(t *testing.T, rctx request.CTX, ss store.Store) { c1 := &model.Channel{} c1.TeamId = t1.Id c1.DisplayName = "Channel2" - c1.Name = NewTestId() + c1.Name = NewTestID() c1.Type = model.ChannelTypeOpen c1, nErr := ss.Channel().Save(rctx, c1, -1) require.NoError(t, nErr) @@ -2927,7 +2927,7 @@ func testPostCounts(t *testing.T, rctx request.CTX, ss store.Store) { p1.Type = "system_add_to_channel" p1.ChannelId = c1.Id p1.UserId = model.NewId() - p1.Message = NewTestId() + p1.Message = NewTestID() p1.CreateAt = twentyMinAgo p1.UpdateAt = twentyMinAgo _, nErr = ss.Post().Save(rctx, p1) @@ -2936,7 +2936,7 @@ func testPostCounts(t *testing.T, rctx request.CTX, ss store.Store) { p2 := &model.Post{} p2.ChannelId = c1.Id p2.UserId = model.NewId() - p2.Message = NewTestId() + p2.Message = NewTestID() p2.Hashtags = "hashtag" p2.CreateAt = twentyMinAgo p2.UpdateAt = twentyMinAgo @@ -2946,7 +2946,7 @@ func testPostCounts(t *testing.T, rctx request.CTX, ss store.Store) { p3 := &model.Post{} p3.ChannelId = c1.Id p3.UserId = model.NewId() - p3.Message = NewTestId() + p3.Message = NewTestID() p3.FileIds = []string{"fileId1"} p3.CreateAt = twentyMinAgo p3.UpdateAt = twentyMinAgo @@ -2956,7 +2956,7 @@ func testPostCounts(t *testing.T, rctx request.CTX, ss store.Store) { p4 := &model.Post{} p4.ChannelId = c1.Id p4.UserId = model.NewId() - p4.Message = NewTestId() + p4.Message = NewTestID() p4.Filenames = []string{"filename1"} p4.CreateAt = tenMinAgo p4.UpdateAt = tenMinAgo @@ -2966,7 +2966,7 @@ func testPostCounts(t *testing.T, rctx request.CTX, ss store.Store) { p5 := &model.Post{} p5.ChannelId = c1.Id p5.UserId = p4.UserId - p5.Message = NewTestId() + p5.Message = NewTestID() p5.Hashtags = "hashtag" p5.FileIds = []string{"fileId2"} p5.CreateAt = tenMinAgo @@ -3067,7 +3067,7 @@ func testPostStoreGetFlaggedPostsForTeam(t *testing.T, rctx request.CTX, ss stor c1 := &model.Channel{} c1.TeamId = model.NewId() c1.DisplayName = "Channel1" - c1.Name = NewTestId() + c1.Name = NewTestID() c1.Type = model.ChannelTypeOpen c1, err := ss.Channel().Save(rctx, c1, -1) require.NoError(t, err) @@ -3075,7 +3075,7 @@ func testPostStoreGetFlaggedPostsForTeam(t *testing.T, rctx request.CTX, ss stor o1 := &model.Post{} o1.ChannelId = c1.Id o1.UserId = model.NewId() - o1.Message = NewTestId() + o1.Message = NewTestID() o1, err = ss.Post().Save(rctx, o1) require.NoError(t, err) time.Sleep(2 * time.Millisecond) @@ -3083,7 +3083,7 @@ func testPostStoreGetFlaggedPostsForTeam(t *testing.T, rctx request.CTX, ss stor o2 := &model.Post{} o2.ChannelId = o1.ChannelId o2.UserId = model.NewId() - o2.Message = NewTestId() + o2.Message = NewTestID() o2, err = ss.Post().Save(rctx, o2) require.NoError(t, err) time.Sleep(2 * time.Millisecond) @@ -3091,7 +3091,7 @@ func testPostStoreGetFlaggedPostsForTeam(t *testing.T, rctx request.CTX, ss stor o3 := &model.Post{} o3.ChannelId = o1.ChannelId o3.UserId = model.NewId() - o3.Message = NewTestId() + o3.Message = NewTestID() o3.DeleteAt = 1 o3, err = ss.Post().Save(rctx, o3) require.NoError(t, err) @@ -3104,9 +3104,9 @@ func testPostStoreGetFlaggedPostsForTeam(t *testing.T, rctx request.CTX, ss stor _, err = ss.Channel().SaveMember(rctx, m0) require.NoError(t, err) - teamId := model.NewId() + teamID := model.NewId() channel2, err := ss.Channel().Save(rctx, &model.Channel{ - TeamId: teamId, + TeamId: teamID, DisplayName: "DisplayName2", Name: "channel" + model.NewId(), Type: model.ChannelTypeOpen, @@ -3116,14 +3116,14 @@ func testPostStoreGetFlaggedPostsForTeam(t *testing.T, rctx request.CTX, ss stor o4 := &model.Post{} o4.ChannelId = channel2.Id o4.UserId = model.NewId() - o4.Message = NewTestId() + o4.Message = NewTestID() o4, err = ss.Post().Save(rctx, o4) require.NoError(t, err) time.Sleep(2 * time.Millisecond) c2 := &model.Channel{} c2.DisplayName = "DMChannel1" - c2.Name = model.GetDMNameFromIds(NewTestId(), NewTestId()) + c2.Name = model.GetDMNameFromIds(NewTestID(), NewTestID()) c2.Type = model.ChannelTypeDirect m1 := &model.ChannelMember{} @@ -3142,14 +3142,14 @@ func testPostStoreGetFlaggedPostsForTeam(t *testing.T, rctx request.CTX, ss stor o5 := &model.Post{} o5.ChannelId = c2.Id o5.UserId = m2.UserId - o5.Message = NewTestId() + o5.Message = NewTestID() o5, err = ss.Post().Save(rctx, o5) require.NoError(t, err) time.Sleep(2 * time.Millisecond) // Post on channel where user is not a member channel3, err := ss.Channel().Save(rctx, &model.Channel{ - TeamId: teamId, + TeamId: teamID, DisplayName: "DisplayName3", Name: "channel" + model.NewId(), Type: model.ChannelTypeOpen, @@ -3159,7 +3159,7 @@ func testPostStoreGetFlaggedPostsForTeam(t *testing.T, rctx request.CTX, ss stor o6 := &model.Post{} o6.ChannelId = channel3.Id o6.UserId = m2.UserId - o6.Message = NewTestId() + o6.Message = NewTestID() o6, err = ss.Post().Save(rctx, o6) require.NoError(t, err) time.Sleep(2 * time.Millisecond) @@ -3286,7 +3286,7 @@ func testPostStoreGetFlaggedPosts(t *testing.T, rctx request.CTX, ss store.Store c1 := &model.Channel{} c1.TeamId = model.NewId() c1.DisplayName = "Channel1" - c1.Name = NewTestId() + c1.Name = NewTestID() c1.Type = model.ChannelTypeOpen c1, err := ss.Channel().Save(rctx, c1, -1) require.NoError(t, err) @@ -3294,7 +3294,7 @@ func testPostStoreGetFlaggedPosts(t *testing.T, rctx request.CTX, ss store.Store o1 := &model.Post{} o1.ChannelId = c1.Id o1.UserId = model.NewId() - o1.Message = NewTestId() + o1.Message = NewTestID() o1, err = ss.Post().Save(rctx, o1) require.NoError(t, err) time.Sleep(2 * time.Millisecond) @@ -3302,7 +3302,7 @@ func testPostStoreGetFlaggedPosts(t *testing.T, rctx request.CTX, ss store.Store o2 := &model.Post{} o2.ChannelId = o1.ChannelId o2.UserId = model.NewId() - o2.Message = NewTestId() + o2.Message = NewTestID() o2, err = ss.Post().Save(rctx, o2) require.NoError(t, err) time.Sleep(2 * time.Millisecond) @@ -3310,16 +3310,16 @@ func testPostStoreGetFlaggedPosts(t *testing.T, rctx request.CTX, ss store.Store o3 := &model.Post{} o3.ChannelId = o1.ChannelId o3.UserId = model.NewId() - o3.Message = NewTestId() + o3.Message = NewTestID() o3.DeleteAt = 1 o3, err = ss.Post().Save(rctx, o3) require.NoError(t, err) time.Sleep(2 * time.Millisecond) // Post on channel where user is not a member - teamId := model.NewId() + teamID := model.NewId() channel2, err := ss.Channel().Save(rctx, &model.Channel{ - TeamId: teamId, + TeamId: teamID, DisplayName: "DisplayName2", Name: "channel" + model.NewId(), Type: model.ChannelTypeOpen, @@ -3329,7 +3329,7 @@ func testPostStoreGetFlaggedPosts(t *testing.T, rctx request.CTX, ss store.Store o4 := &model.Post{} o4.ChannelId = channel2.Id o4.UserId = model.NewId() - o4.Message = NewTestId() + o4.Message = NewTestID() o4, err = ss.Post().Save(rctx, o4) require.NoError(t, err) time.Sleep(2 * time.Millisecond) @@ -3426,7 +3426,7 @@ func testPostStoreGetFlaggedPostsForChannel(t *testing.T, rctx request.CTX, ss s c1 := &model.Channel{} c1.TeamId = model.NewId() c1.DisplayName = "Channel1" - c1.Name = NewTestId() + c1.Name = NewTestID() c1.Type = model.ChannelTypeOpen c1, err := ss.Channel().Save(rctx, c1, -1) require.NoError(t, err) @@ -3434,7 +3434,7 @@ func testPostStoreGetFlaggedPostsForChannel(t *testing.T, rctx request.CTX, ss s c2 := &model.Channel{} c2.TeamId = model.NewId() c2.DisplayName = "Channel2" - c2.Name = NewTestId() + c2.Name = NewTestID() c2.Type = model.ChannelTypeOpen c2, err = ss.Channel().Save(rctx, c2, -1) require.NoError(t, err) @@ -3442,7 +3442,7 @@ func testPostStoreGetFlaggedPostsForChannel(t *testing.T, rctx request.CTX, ss s o1 := &model.Post{} o1.ChannelId = c1.Id o1.UserId = model.NewId() - o1.Message = NewTestId() + o1.Message = NewTestID() o1, err = ss.Post().Save(rctx, o1) require.NoError(t, err) time.Sleep(2 * time.Millisecond) @@ -3450,15 +3450,15 @@ func testPostStoreGetFlaggedPostsForChannel(t *testing.T, rctx request.CTX, ss s o2 := &model.Post{} o2.ChannelId = o1.ChannelId o2.UserId = model.NewId() - o2.Message = NewTestId() + o2.Message = NewTestID() o2, err = ss.Post().Save(rctx, o2) require.NoError(t, err) time.Sleep(2 * time.Millisecond) // deleted post - teamId := model.NewId() + teamID := model.NewId() channel3, err := ss.Channel().Save(rctx, &model.Channel{ - TeamId: teamId, + TeamId: teamID, DisplayName: "DisplayName3", Name: "channel" + model.NewId(), Type: model.ChannelTypeOpen, @@ -3468,7 +3468,7 @@ func testPostStoreGetFlaggedPostsForChannel(t *testing.T, rctx request.CTX, ss s o3 := &model.Post{} o3.ChannelId = channel3.Id o3.UserId = o1.ChannelId - o3.Message = NewTestId() + o3.Message = NewTestID() o3.DeleteAt = 1 o3, err = ss.Post().Save(rctx, o3) require.NoError(t, err) @@ -3477,14 +3477,14 @@ func testPostStoreGetFlaggedPostsForChannel(t *testing.T, rctx request.CTX, ss s o4 := &model.Post{} o4.ChannelId = c2.Id o4.UserId = model.NewId() - o4.Message = NewTestId() + o4.Message = NewTestID() o4, err = ss.Post().Save(rctx, o4) require.NoError(t, err) time.Sleep(2 * time.Millisecond) // Post on channel where user is not a member channel4, err := ss.Channel().Save(rctx, &model.Channel{ - TeamId: teamId, + TeamId: teamID, DisplayName: "DisplayName4", Name: "channel" + model.NewId(), Type: model.ChannelTypeOpen, @@ -3494,7 +3494,7 @@ func testPostStoreGetFlaggedPostsForChannel(t *testing.T, rctx request.CTX, ss s o5 := &model.Post{} o5.ChannelId = channel4.Id o5.UserId = model.NewId() - o5.Message = NewTestId() + o5.Message = NewTestID() o5, err = ss.Post().Save(rctx, o5) require.NoError(t, err) time.Sleep(2 * time.Millisecond) @@ -3573,9 +3573,9 @@ func testPostStoreGetFlaggedPostsForChannel(t *testing.T, rctx request.CTX, ss s } func testPostStoreGetPostsCreatedAt(t *testing.T, rctx request.CTX, ss store.Store) { - teamId := model.NewId() + teamID := model.NewId() channel1, err := ss.Channel().Save(rctx, &model.Channel{ - TeamId: teamId, + TeamId: teamID, DisplayName: "DisplayName1", Name: "channel" + model.NewId(), Type: model.ChannelTypeOpen, @@ -3587,7 +3587,7 @@ func testPostStoreGetPostsCreatedAt(t *testing.T, rctx request.CTX, ss store.Sto o0 := &model.Post{} o0.ChannelId = channel1.Id o0.UserId = model.NewId() - o0.Message = NewTestId() + o0.Message = NewTestID() o0.CreateAt = createTime o0, err = ss.Post().Save(rctx, o0) require.NoError(t, err) @@ -3595,7 +3595,7 @@ func testPostStoreGetPostsCreatedAt(t *testing.T, rctx request.CTX, ss store.Sto o1 := &model.Post{} o1.ChannelId = o0.ChannelId o1.UserId = model.NewId() - o1.Message = NewTestId() + o1.Message = NewTestID() o1.CreateAt = createTime o1, err = ss.Post().Save(rctx, o1) require.NoError(t, err) @@ -3603,14 +3603,14 @@ func testPostStoreGetPostsCreatedAt(t *testing.T, rctx request.CTX, ss store.Sto o2 := &model.Post{} o2.ChannelId = o1.ChannelId o2.UserId = model.NewId() - o2.Message = NewTestId() + o2.Message = NewTestID() o2.RootId = o1.Id o2.CreateAt = createTime + 1 _, err = ss.Post().Save(rctx, o2) require.NoError(t, err) channel2, err := ss.Channel().Save(rctx, &model.Channel{ - TeamId: teamId, + TeamId: teamID, DisplayName: "DisplayName2", Name: "channel" + model.NewId(), Type: model.ChannelTypeOpen, @@ -3620,7 +3620,7 @@ func testPostStoreGetPostsCreatedAt(t *testing.T, rctx request.CTX, ss store.Sto o3 := &model.Post{} o3.ChannelId = channel2.Id o3.UserId = model.NewId() - o3.Message = NewTestId() + o3.Message = NewTestID() o3.CreateAt = createTime _, err = ss.Post().Save(rctx, o3) require.NoError(t, err) @@ -3630,9 +3630,9 @@ func testPostStoreGetPostsCreatedAt(t *testing.T, rctx request.CTX, ss store.Sto } func testPostStoreOverwriteMultiple(t *testing.T, rctx request.CTX, ss store.Store) { - teamId := model.NewId() + teamID := model.NewId() channel1, err := ss.Channel().Save(rctx, &model.Channel{ - TeamId: teamId, + TeamId: teamID, DisplayName: "DisplayName1", Name: "channel" + model.NewId(), Type: model.ChannelTypeOpen, @@ -3642,14 +3642,14 @@ func testPostStoreOverwriteMultiple(t *testing.T, rctx request.CTX, ss store.Sto o1 := &model.Post{} o1.ChannelId = channel1.Id o1.UserId = model.NewId() - o1.Message = NewTestId() + o1.Message = NewTestID() o1, err = ss.Post().Save(rctx, o1) require.NoError(t, err) o2 := &model.Post{} o2.ChannelId = o1.ChannelId o2.UserId = model.NewId() - o2.Message = NewTestId() + o2.Message = NewTestID() o2.RootId = o1.Id o2, err = ss.Post().Save(rctx, o2) require.NoError(t, err) @@ -3657,12 +3657,12 @@ func testPostStoreOverwriteMultiple(t *testing.T, rctx request.CTX, ss store.Sto o3 := &model.Post{} o3.ChannelId = o1.ChannelId o3.UserId = model.NewId() - o3.Message = NewTestId() + o3.Message = NewTestID() o3, err = ss.Post().Save(rctx, o3) require.NoError(t, err) channel2, err := ss.Channel().Save(rctx, &model.Channel{ - TeamId: teamId, + TeamId: teamID, DisplayName: "DisplayName2", Name: "channel" + model.NewId(), Type: model.ChannelTypeOpen, @@ -3678,7 +3678,7 @@ func testPostStoreOverwriteMultiple(t *testing.T, rctx request.CTX, ss store.Sto require.NoError(t, err) channel3, err := ss.Channel().Save(rctx, &model.Channel{ - TeamId: teamId, + TeamId: teamID, DisplayName: "DisplayName3", Name: "channel" + model.NewId(), Type: model.ChannelTypeOpen, @@ -3780,9 +3780,9 @@ func testPostStoreOverwriteMultiple(t *testing.T, rctx request.CTX, ss store.Sto } func testPostStoreOverwrite(t *testing.T, rctx request.CTX, ss store.Store) { - teamId := model.NewId() + teamID := model.NewId() channel1, err := ss.Channel().Save(rctx, &model.Channel{ - TeamId: teamId, + TeamId: teamID, DisplayName: "DisplayName1", Name: "channel" + model.NewId(), Type: model.ChannelTypeOpen, @@ -3792,14 +3792,14 @@ func testPostStoreOverwrite(t *testing.T, rctx request.CTX, ss store.Store) { o1 := &model.Post{} o1.ChannelId = channel1.Id o1.UserId = model.NewId() - o1.Message = NewTestId() + o1.Message = NewTestID() o1, err = ss.Post().Save(rctx, o1) require.NoError(t, err) o2 := &model.Post{} o2.ChannelId = o1.ChannelId o2.UserId = model.NewId() - o2.Message = NewTestId() + o2.Message = NewTestID() o2.RootId = o1.Id o2, err = ss.Post().Save(rctx, o2) require.NoError(t, err) @@ -3807,12 +3807,12 @@ func testPostStoreOverwrite(t *testing.T, rctx request.CTX, ss store.Store) { o3 := &model.Post{} o3.ChannelId = o1.ChannelId o3.UserId = model.NewId() - o3.Message = NewTestId() + o3.Message = NewTestID() o3, err = ss.Post().Save(rctx, o3) require.NoError(t, err) channel2, err := ss.Channel().Save(rctx, &model.Channel{ - TeamId: teamId, + TeamId: teamID, DisplayName: "DisplayName2", Name: "channel" + model.NewId(), Type: model.ChannelTypeOpen, @@ -3897,9 +3897,9 @@ func testPostStoreOverwrite(t *testing.T, rctx request.CTX, ss store.Store) { } func testPostStoreGetPostsByIds(t *testing.T, rctx request.CTX, ss store.Store) { - teamId := model.NewId() + teamID := model.NewId() channel1, err := ss.Channel().Save(rctx, &model.Channel{ - TeamId: teamId, + TeamId: teamID, DisplayName: "DisplayName1", Name: "channel" + model.NewId(), Type: model.ChannelTypeOpen, @@ -3909,21 +3909,21 @@ func testPostStoreGetPostsByIds(t *testing.T, rctx request.CTX, ss store.Store) o1 := &model.Post{} o1.ChannelId = channel1.Id o1.UserId = model.NewId() - o1.Message = NewTestId() + o1.Message = NewTestID() o1, err = ss.Post().Save(rctx, o1) require.NoError(t, err) o2 := &model.Post{} o2.ChannelId = o1.ChannelId o2.UserId = model.NewId() - o2.Message = NewTestId() + o2.Message = NewTestID() o2, err = ss.Post().Save(rctx, o2) require.NoError(t, err) o3 := &model.Post{} o3.ChannelId = o1.ChannelId o3.UserId = model.NewId() - o3.Message = NewTestId() + o3.Message = NewTestID() o3, err = ss.Post().Save(rctx, o3) require.NoError(t, err) @@ -3961,28 +3961,28 @@ func testPostStoreGetPostsBatchForIndexing(t *testing.T, rctx request.CTX, ss st c1 := &model.Channel{} c1.TeamId = model.NewId() c1.DisplayName = "Channel1" - c1.Name = NewTestId() + c1.Name = NewTestID() c1.Type = model.ChannelTypeOpen c1, _ = ss.Channel().Save(rctx, c1, -1) c2 := &model.Channel{} c2.TeamId = model.NewId() c2.DisplayName = "Channel2" - c2.Name = NewTestId() + c2.Name = NewTestID() c2.Type = model.ChannelTypeOpen c2, _ = ss.Channel().Save(rctx, c2, -1) o1 := &model.Post{} o1.ChannelId = c1.Id o1.UserId = model.NewId() - o1.Message = NewTestId() + o1.Message = NewTestID() o1, err := ss.Post().Save(rctx, o1) require.NoError(t, err) o2 := &model.Post{} o2.ChannelId = c2.Id o2.UserId = model.NewId() - o2.Message = NewTestId() + o2.Message = NewTestID() _, err = ss.Post().Save(rctx, o2) require.NoError(t, err) @@ -3990,7 +3990,7 @@ func testPostStoreGetPostsBatchForIndexing(t *testing.T, rctx request.CTX, ss st o3.ChannelId = c1.Id o3.UserId = model.NewId() o3.RootId = o1.Id - o3.Message = NewTestId() + o3.Message = NewTestID() _, err = ss.Post().Save(rctx, o3) require.NoError(t, err) @@ -4036,7 +4036,7 @@ func testPostStorePermanentDeleteBatch(t *testing.T, rctx request.CTX, ss store. o1 := &model.Post{} o1.ChannelId = channel.Id o1.UserId = model.NewId() - o1.Message = NewTestId() + o1.Message = NewTestID() o1.CreateAt = 1000 o1, err = ss.Post().Save(rctx, o1) require.NoError(t, err) @@ -4044,7 +4044,7 @@ func testPostStorePermanentDeleteBatch(t *testing.T, rctx request.CTX, ss store. o2 := &model.Post{} o2.ChannelId = channel.Id o2.UserId = model.NewId() - o2.Message = NewTestId() + o2.Message = NewTestID() o2.CreateAt = 1000 o2, err = ss.Post().Save(rctx, o2) require.NoError(t, err) @@ -4052,7 +4052,7 @@ func testPostStorePermanentDeleteBatch(t *testing.T, rctx request.CTX, ss store. o3 := &model.Post{} o3.ChannelId = channel.Id o3.UserId = model.NewId() - o3.Message = NewTestId() + o3.Message = NewTestID() o3.CreateAt = 100000 o3, err = ss.Post().Save(rctx, o3) require.NoError(t, err) @@ -4200,14 +4200,14 @@ func testPostStorePermanentDeleteBatch(t *testing.T, rctx request.CTX, ss store. c1 := &model.Channel{} c1.TeamId = model.NewId() c1.DisplayName = "Channel1" - c1.Name = NewTestId() + c1.Name = NewTestID() c1.Type = model.ChannelTypeOpen c1, _ = ss.Channel().Save(rctx, c1, -1) c2 := &model.Channel{} c2.TeamId = model.NewId() c2.DisplayName = "Channel2" - c2.Name = NewTestId() + c2.Name = NewTestID() c2.Type = model.ChannelTypeOpen c2, _ = ss.Channel().Save(rctx, c2, -1) @@ -4275,9 +4275,9 @@ func testPostStorePermanentDeleteBatch(t *testing.T, rctx request.CTX, ss store. } func testPostStoreGetOldest(t *testing.T, rctx request.CTX, ss store.Store) { - teamId := model.NewId() + teamID := model.NewId() channel1, err := ss.Channel().Save(rctx, &model.Channel{ - TeamId: teamId, + TeamId: teamID, DisplayName: "DisplayName1", Name: "channel" + model.NewId(), Type: model.ChannelTypeOpen, @@ -4287,7 +4287,7 @@ func testPostStoreGetOldest(t *testing.T, rctx request.CTX, ss store.Store) { o0 := &model.Post{} o0.ChannelId = channel1.Id o0.UserId = model.NewId() - o0.Message = NewTestId() + o0.Message = NewTestID() o0.CreateAt = 3 o0, err = ss.Post().Save(rctx, o0) require.NoError(t, err) @@ -4295,7 +4295,7 @@ func testPostStoreGetOldest(t *testing.T, rctx request.CTX, ss store.Store) { o1 := &model.Post{} o1.ChannelId = o0.Id o1.UserId = model.NewId() - o1.Message = NewTestId() + o1.Message = NewTestID() o1.CreateAt = 2 o1, err = ss.Post().Save(rctx, o1) require.NoError(t, err) @@ -4303,7 +4303,7 @@ func testPostStoreGetOldest(t *testing.T, rctx request.CTX, ss store.Store) { o2 := &model.Post{} o2.ChannelId = o1.ChannelId o2.UserId = model.NewId() - o2.Message = NewTestId() + o2.Message = NewTestID() o2.CreateAt = 1 o2, err = ss.Post().Save(rctx, o2) require.NoError(t, err) @@ -4322,7 +4322,7 @@ func testGetMaxPostSize(t *testing.T, rctx request.CTX, ss store.Store) { func testPostStoreGetParentsForExportAfter(t *testing.T, rctx request.CTX, ss store.Store) { t1 := model.Team{} t1.DisplayName = "Name" - t1.Name = NewTestId() + t1.Name = NewTestID() t1.Email = MakeEmail() t1.Type = model.TeamOpen _, err := ss.Team().Save(&t1) @@ -4331,7 +4331,7 @@ func testPostStoreGetParentsForExportAfter(t *testing.T, rctx request.CTX, ss st c1 := model.Channel{} c1.TeamId = t1.Id c1.DisplayName = "Channel1" - c1.Name = NewTestId() + c1.Name = NewTestID() c1.Type = model.ChannelTypeOpen _, nErr := ss.Channel().Save(rctx, &c1, -1) require.NoError(t, nErr) @@ -4339,7 +4339,7 @@ func testPostStoreGetParentsForExportAfter(t *testing.T, rctx request.CTX, ss st c2 := model.Channel{} c2.TeamId = t1.Id c2.DisplayName = "Channel2" - c2.Name = NewTestId() + c2.Name = NewTestID() c2.Type = model.ChannelTypeOpen _, nErr = ss.Channel().Save(rctx, &c2, -1) require.NoError(t, nErr) @@ -4354,7 +4354,7 @@ func testPostStoreGetParentsForExportAfter(t *testing.T, rctx request.CTX, ss st p1 := &model.Post{} p1.ChannelId = c1.Id p1.UserId = u1.Id - p1.Message = NewTestId() + p1.Message = NewTestID() p1.CreateAt = 1000 p1, nErr = ss.Post().Save(rctx, p1) require.NoError(t, nErr) @@ -4362,7 +4362,7 @@ func testPostStoreGetParentsForExportAfter(t *testing.T, rctx request.CTX, ss st p2 := &model.Post{} p2.ChannelId = c2.Id p2.UserId = u1.Id - p2.Message = NewTestId() + p2.Message = NewTestID() p2.CreateAt = 1000 p2, nErr = ss.Post().Save(rctx, p2) require.NoError(t, nErr) @@ -4436,7 +4436,7 @@ func testPostStoreGetParentsForExportAfter(t *testing.T, rctx request.CTX, ss st func testPostStoreGetRepliesForExport(t *testing.T, rctx request.CTX, ss store.Store) { t1 := model.Team{} t1.DisplayName = "Name" - t1.Name = NewTestId() + t1.Name = NewTestID() t1.Email = MakeEmail() t1.Type = model.TeamOpen _, err := ss.Team().Save(&t1) @@ -4445,7 +4445,7 @@ func testPostStoreGetRepliesForExport(t *testing.T, rctx request.CTX, ss store.S c1 := model.Channel{} c1.TeamId = t1.Id c1.DisplayName = "Channel1" - c1.Name = NewTestId() + c1.Name = NewTestID() c1.Type = model.ChannelTypeOpen _, nErr := ss.Channel().Save(rctx, &c1, -1) require.NoError(t, nErr) @@ -4459,7 +4459,7 @@ func testPostStoreGetRepliesForExport(t *testing.T, rctx request.CTX, ss store.S p1 := &model.Post{} p1.ChannelId = c1.Id p1.UserId = u1.Id - p1.Message = NewTestId() + p1.Message = NewTestID() p1.CreateAt = 1000 p1, nErr = ss.Post().Save(rctx, p1) require.NoError(t, nErr) @@ -4467,7 +4467,7 @@ func testPostStoreGetRepliesForExport(t *testing.T, rctx request.CTX, ss store.S p2 := &model.Post{} p2.ChannelId = c1.Id p2.UserId = u1.Id - p2.Message = NewTestId() + p2.Message = NewTestID() p2.CreateAt = 1001 p2.RootId = p1.Id p2, nErr = ss.Post().Save(rctx, p2) @@ -4500,12 +4500,12 @@ func testPostStoreGetRepliesForExport(t *testing.T, rctx request.CTX, ss store.S } func testPostStoreGetDirectPostParentsForExportAfter(t *testing.T, rctx request.CTX, ss store.Store, s SqlStore) { - teamId := model.NewId() + teamID := model.NewId() o1 := model.Channel{} - o1.TeamId = teamId + o1.TeamId = teamID o1.DisplayName = "Name" - o1.Name = model.GetDMNameFromIds(NewTestId(), NewTestId()) + o1.Name = model.GetDMNameFromIds(NewTestID(), NewTestID()) o1.Type = model.ChannelTypeDirect u1 := &model.User{} @@ -4539,7 +4539,7 @@ func testPostStoreGetDirectPostParentsForExportAfter(t *testing.T, rctx request. p1 := &model.Post{} p1.ChannelId = o1.Id p1.UserId = u1.Id - p1.Message = NewTestId() + p1.Message = NewTestID() p1.CreateAt = 1000 p1, nErr = ss.Post().Save(rctx, p1) require.NoError(t, nErr) @@ -4554,12 +4554,12 @@ func testPostStoreGetDirectPostParentsForExportAfter(t *testing.T, rctx request. } func testPostStoreGetDirectPostParentsForExportAfterDeleted(t *testing.T, rctx request.CTX, ss store.Store, s SqlStore) { - teamId := model.NewId() + teamID := model.NewId() o1 := model.Channel{} - o1.TeamId = teamId + o1.TeamId = teamID o1.DisplayName = "Name" - o1.Name = model.GetDMNameFromIds(NewTestId(), NewTestId()) + o1.Name = model.GetDMNameFromIds(NewTestID(), NewTestID()) o1.Type = model.ChannelTypeDirect u1 := &model.User{} @@ -4599,7 +4599,7 @@ func testPostStoreGetDirectPostParentsForExportAfterDeleted(t *testing.T, rctx r p1 := &model.Post{} p1.ChannelId = o1.Id p1.UserId = u1.Id - p1.Message = NewTestId() + p1.Message = NewTestID() p1.CreateAt = 1000 _, nErr = ss.Post().Save(rctx, p1) require.NoError(t, nErr) @@ -4617,12 +4617,12 @@ func testPostStoreGetDirectPostParentsForExportAfterDeleted(t *testing.T, rctx r } func testPostStoreGetDirectPostParentsForExportAfterBatched(t *testing.T, rctx request.CTX, ss store.Store, s SqlStore) { - teamId := model.NewId() + teamID := model.NewId() o1 := model.Channel{} - o1.TeamId = teamId + o1.TeamId = teamID o1.DisplayName = "Name" - o1.Name = model.GetDMNameFromIds(NewTestId(), NewTestId()) + o1.Name = model.GetDMNameFromIds(NewTestID(), NewTestID()) o1.Type = model.ChannelTypeDirect var postIds []string @@ -4658,7 +4658,7 @@ func testPostStoreGetDirectPostParentsForExportAfterBatched(t *testing.T, rctx r p1 := &model.Post{} p1.ChannelId = o1.Id p1.UserId = u1.Id - p1.Message = NewTestId() + p1.Message = NewTestID() p1.CreateAt = 1000 p1, nErr = ss.Post().Save(rctx, p1) require.NoError(t, nErr) @@ -4694,21 +4694,21 @@ func testPostStoreGetDirectPostParentsForExportAfterBatched(t *testing.T, rctx r func testHasAutoResponsePostByUserSince(t *testing.T, rctx request.CTX, ss store.Store) { t.Run("should return posts created after the given time", func(t *testing.T) { - teamId := model.NewId() + teamID := model.NewId() channel1, err := ss.Channel().Save(rctx, &model.Channel{ - TeamId: teamId, + TeamId: teamID, DisplayName: "DisplayName1", Name: "channel" + model.NewId(), Type: model.ChannelTypeOpen, }, -1) require.NoError(t, err) - channelId := channel1.Id - userId := model.NewId() + channelID := channel1.Id + userID := model.NewId() _, err = ss.Post().Save(rctx, &model.Post{ - ChannelId: channelId, - UserId: userId, + ChannelId: channelID, + UserId: userID, Message: "message", }) require.NoError(t, err) @@ -4717,30 +4717,30 @@ func testHasAutoResponsePostByUserSince(t *testing.T, rctx request.CTX, ss store time.Sleep(time.Millisecond) post2, err := ss.Post().Save(rctx, &model.Post{ - ChannelId: channelId, - UserId: userId, + ChannelId: channelID, + UserId: userID, Message: "message", }) require.NoError(t, err) time.Sleep(time.Millisecond) post3, err := ss.Post().Save(rctx, &model.Post{ - ChannelId: channelId, - UserId: userId, + ChannelId: channelID, + UserId: userID, Message: "auto response message", Type: model.PostTypeAutoResponder, }) require.NoError(t, err) time.Sleep(time.Millisecond) - exists, err := ss.Post().HasAutoResponsePostByUserSince(model.GetPostsSinceOptions{ChannelId: channelId, Time: post2.CreateAt}, userId) + exists, err := ss.Post().HasAutoResponsePostByUserSince(model.GetPostsSinceOptions{ChannelId: channelID, Time: post2.CreateAt}, userID) require.NoError(t, err) assert.True(t, exists) - err = ss.Post().Delete(rctx, post3.Id, time.Now().Unix(), userId) + err = ss.Post().Delete(rctx, post3.Id, time.Now().Unix(), userID) require.NoError(t, err) - exists, err = ss.Post().HasAutoResponsePostByUserSince(model.GetPostsSinceOptions{ChannelId: channelId, Time: post2.CreateAt}, userId) + exists, err = ss.Post().HasAutoResponsePostByUserSince(model.GetPostsSinceOptions{ChannelId: channelID, Time: post2.CreateAt}, userID) require.NoError(t, err) assert.False(t, exists) }) @@ -4958,11 +4958,11 @@ func testGetPostsSinceCreateForSync(t *testing.T, rctx request.CTX, ss store.Sto func testSetPostReminder(t *testing.T, rctx request.CTX, ss store.Store, s SqlStore) { // Basic - userID := NewTestId() + userID := NewTestID() p1 := &model.Post{ UserId: userID, - ChannelId: NewTestId(), + ChannelId: NewTestID(), Message: "hi there", Type: model.PostTypeDefault, } @@ -5001,11 +5001,11 @@ func testSetPostReminder(t *testing.T, rctx request.CTX, ss store.Store, s SqlSt func testGetPostReminders(t *testing.T, rctx request.CTX, ss store.Store, s SqlStore) { times := []int64{100, 101, 102} for _, tt := range times { - userID := NewTestId() + userID := NewTestID() p1 := &model.Post{ UserId: userID, - ChannelId: NewTestId(), + ChannelId: NewTestID(), Message: "hi there", Type: model.PostTypeDefault, } @@ -5048,7 +5048,7 @@ func testGetPostReminderMetadata(t *testing.T, rctx request.CTX, ss store.Store, ch := &model.Channel{ TeamId: team.Id, DisplayName: "channeldisplay", - Name: NewTestId(), + Name: NewTestID(), Type: model.ChannelTypeOpen, } ch, err = ss.Channel().Save(rctx, ch, -1) @@ -5057,7 +5057,7 @@ func testGetPostReminderMetadata(t *testing.T, rctx request.CTX, ss store.Store, ch2 := &model.Channel{ TeamId: "", DisplayName: "GM_display", - Name: NewTestId(), + Name: NewTestID(), Type: model.ChannelTypeGroup, } ch2, err = ss.Channel().Save(rctx, ch2, -1) @@ -5092,14 +5092,14 @@ func testGetPostReminderMetadata(t *testing.T, rctx request.CTX, ss store.Store, meta, err := ss.Post().GetPostReminderMetadata(p1.Id) require.NoError(t, err) - assert.Equal(t, meta.ChannelId, ch.Id) + assert.Equal(t, meta.ChannelID, ch.Id) assert.Equal(t, meta.TeamName, team.Name) assert.Equal(t, meta.Username, u1.Username) assert.Equal(t, meta.UserLocale, u1.Locale) meta, err = ss.Post().GetPostReminderMetadata(p2.Id) require.NoError(t, err) - assert.Equal(t, meta.ChannelId, ch2.Id) + assert.Equal(t, meta.ChannelID, ch2.Id) assert.Equal(t, meta.TeamName, "") assert.Equal(t, meta.Username, u1.Username) assert.Equal(t, meta.UserLocale, u1.Locale) diff --git a/server/channels/store/storetest/status_store.go b/server/channels/store/storetest/status_store.go index 4f1c43c9158b8..afc456571dd78 100644 --- a/server/channels/store/storetest/status_store.go +++ b/server/channels/store/storetest/status_store.go @@ -66,7 +66,7 @@ func (s ByUserId) Swap(i, j int) { s[i], s[j] = s[j], s[i] } func (s ByUserId) Less(i, j int) bool { return s[i].UserId < s[j].UserId } func testUpdateExpiredDNDStatuses(t *testing.T, rctx request.CTX, ss store.Store) { - userID := NewTestId() + userID := NewTestID() status := &model.Status{UserId: userID, Status: model.StatusDnd, Manual: true, DNDEndTime: time.Now().Add(5 * time.Second).Unix(), PrevStatus: model.StatusOnline} diff --git a/server/channels/store/storetest/team_store.go b/server/channels/store/storetest/team_store.go index 499923afb1fbc..ea097600a163b 100644 --- a/server/channels/store/storetest/team_store.go +++ b/server/channels/store/storetest/team_store.go @@ -80,7 +80,7 @@ func TestTeamStore(t *testing.T, rctx request.CTX, ss store.Store) { func testTeamStoreSave(t *testing.T, rctx request.CTX, ss store.Store) { o1 := model.Team{} o1.DisplayName = "DisplayName" - o1.Name = NewTestId() + o1.Name = NewTestID() o1.Email = MakeEmail() o1.Type = model.TeamOpen @@ -98,7 +98,7 @@ func testTeamStoreSave(t *testing.T, rctx request.CTX, ss store.Store) { func testTeamStoreUpdate(t *testing.T, rctx request.CTX, ss store.Store) { o1 := model.Team{} o1.DisplayName = "DisplayName" - o1.Name = NewTestId() + o1.Name = NewTestID() o1.Email = MakeEmail() o1.Type = model.TeamOpen _, err := ss.Team().Save(&o1) @@ -121,7 +121,7 @@ func testTeamStoreUpdate(t *testing.T, rctx request.CTX, ss store.Store) { func testTeamStoreGet(t *testing.T, rctx request.CTX, ss store.Store) { o1 := model.Team{} o1.DisplayName = "DisplayName" - o1.Name = NewTestId() + o1.Name = NewTestID() o1.Email = MakeEmail() o1.Type = model.TeamOpen _, err := ss.Team().Save(&o1) @@ -138,7 +138,7 @@ func testTeamStoreGet(t *testing.T, rctx request.CTX, ss store.Store) { func testTeamStoreGetMany(t *testing.T, rctx request.CTX, ss store.Store) { o1, err := ss.Team().Save(&model.Team{ DisplayName: "DisplayName", - Name: NewTestId(), + Name: NewTestID(), Email: MakeEmail(), Type: model.TeamOpen, }) @@ -146,7 +146,7 @@ func testTeamStoreGetMany(t *testing.T, rctx request.CTX, ss store.Store) { o2, err := ss.Team().Save(&model.Team{ DisplayName: "DisplayName2", - Name: NewTestId(), + Name: NewTestID(), Email: MakeEmail(), Type: model.TeamOpen, }) @@ -169,7 +169,7 @@ func testTeamStoreGetMany(t *testing.T, rctx request.CTX, ss store.Store) { func testTeamStoreGetByNames(t *testing.T, rctx request.CTX, ss store.Store) { o1 := model.Team{} o1.DisplayName = "DisplayName" - o1.Name = NewTestId() + o1.Name = NewTestID() o1.Email = MakeEmail() o1.Type = model.TeamOpen @@ -178,7 +178,7 @@ func testTeamStoreGetByNames(t *testing.T, rctx request.CTX, ss store.Store) { o2 := model.Team{} o2.DisplayName = "DisplayName2" - o2.Name = NewTestId() + o2.Name = NewTestID() o2.Email = MakeEmail() o2.Type = model.TeamOpen @@ -222,7 +222,7 @@ func testTeamStoreGetByNames(t *testing.T, rctx request.CTX, ss store.Store) { func testTeamStoreGetByName(t *testing.T, rctx request.CTX, ss store.Store) { o1 := model.Team{} o1.DisplayName = "DisplayName" - o1.Name = NewTestId() + o1.Name = NewTestID() o1.Email = MakeEmail() o1.Type = model.TeamOpen @@ -251,8 +251,8 @@ func testTeamStoreSearchAll(t *testing.T, rctx request.CTX, ss store.Store) { cleanupTeamStore(t, rctx, ss) o := model.Team{} - o.DisplayName = "ADisplayName" + NewTestId() - o.Name = "searchterm-" + NewTestId() + o.DisplayName = "ADisplayName" + NewTestID() + o.Name = "searchterm-" + NewTestID() o.Email = MakeEmail() o.Type = model.TeamOpen o.AllowOpenInvite = true @@ -261,8 +261,8 @@ func testTeamStoreSearchAll(t *testing.T, rctx request.CTX, ss store.Store) { require.NoError(t, err) p := model.Team{} - p.DisplayName = "BDisplayName" + NewTestId() - p.Name = "searchterm-" + NewTestId() + p.DisplayName = "BDisplayName" + NewTestID() + p.Name = "searchterm-" + NewTestID() p.Email = MakeEmail() p.Type = model.TeamOpen p.AllowOpenInvite = false @@ -271,8 +271,8 @@ func testTeamStoreSearchAll(t *testing.T, rctx request.CTX, ss store.Store) { require.NoError(t, err) g := model.Team{} - g.DisplayName = "CDisplayName" + NewTestId() - g.Name = "searchterm-" + NewTestId() + g.DisplayName = "CDisplayName" + NewTestID() + g.Name = "searchterm-" + NewTestID() g.Email = MakeEmail() g.Type = model.TeamOpen g.AllowOpenInvite = false @@ -438,8 +438,8 @@ func testTeamStoreSearchAll(t *testing.T, rctx request.CTX, ss store.Store) { func testTeamStoreSearchOpen(t *testing.T, rctx request.CTX, ss store.Store) { o := model.Team{} - o.DisplayName = "ADisplayName" + NewTestId() - o.Name = NewTestId() + o.DisplayName = "ADisplayName" + NewTestID() + o.Name = NewTestID() o.Email = MakeEmail() o.Type = model.TeamOpen o.AllowOpenInvite = true @@ -448,8 +448,8 @@ func testTeamStoreSearchOpen(t *testing.T, rctx request.CTX, ss store.Store) { require.NoError(t, err) p := model.Team{} - p.DisplayName = "ADisplayName" + NewTestId() - p.Name = NewTestId() + p.DisplayName = "ADisplayName" + NewTestID() + p.Name = NewTestID() p.Email = MakeEmail() p.Type = model.TeamOpen p.AllowOpenInvite = false @@ -544,8 +544,8 @@ func testTeamStoreSearchOpen(t *testing.T, rctx request.CTX, ss store.Store) { func testTeamStoreSearchPrivate(t *testing.T, rctx request.CTX, ss store.Store) { o := model.Team{} - o.DisplayName = "ADisplayName" + NewTestId() - o.Name = NewTestId() + o.DisplayName = "ADisplayName" + NewTestID() + o.Name = NewTestID() o.Email = MakeEmail() o.Type = model.TeamOpen o.AllowOpenInvite = true @@ -554,8 +554,8 @@ func testTeamStoreSearchPrivate(t *testing.T, rctx request.CTX, ss store.Store) require.NoError(t, err) p := model.Team{} - p.DisplayName = "ADisplayName" + NewTestId() - p.Name = NewTestId() + p.DisplayName = "ADisplayName" + NewTestID() + p.Name = NewTestID() p.Email = MakeEmail() p.Type = model.TeamOpen p.AllowOpenInvite = false @@ -651,7 +651,7 @@ func testTeamStoreSearchPrivate(t *testing.T, rctx request.CTX, ss store.Store) func testTeamStoreGetByInviteId(t *testing.T, rctx request.CTX, ss store.Store) { o1 := model.Team{} o1.DisplayName = "DisplayName" - o1.Name = NewTestId() + o1.Name = NewTestID() o1.Email = MakeEmail() o1.Type = model.TeamOpen o1.InviteId = model.NewId() @@ -670,7 +670,7 @@ func testTeamStoreGetByInviteId(t *testing.T, rctx request.CTX, ss store.Store) func testTeamStoreByUserId(t *testing.T, rctx request.CTX, ss store.Store) { o1 := &model.Team{} o1.DisplayName = "DisplayName" - o1.Name = NewTestId() + o1.Name = NewTestID() o1.Email = MakeEmail() o1.Type = model.TeamOpen o1.InviteId = model.NewId() @@ -748,7 +748,7 @@ func testTeamStoreGetAllPage(t *testing.T, rctx request.CTX, ss store.Store) { func testGetAllTeamListing(t *testing.T, rctx request.CTX, ss store.Store) { o1 := model.Team{} o1.DisplayName = "DisplayName" - o1.Name = NewTestId() + o1.Name = NewTestID() o1.Email = MakeEmail() o1.Type = model.TeamOpen o1.AllowOpenInvite = true @@ -757,7 +757,7 @@ func testGetAllTeamListing(t *testing.T, rctx request.CTX, ss store.Store) { o2 := model.Team{} o2.DisplayName = "DisplayName" - o2.Name = NewTestId() + o2.Name = NewTestID() o2.Email = MakeEmail() o2.Type = model.TeamOpen _, err = ss.Team().Save(&o2) @@ -765,7 +765,7 @@ func testGetAllTeamListing(t *testing.T, rctx request.CTX, ss store.Store) { o3 := model.Team{} o3.DisplayName = "DisplayName" - o3.Name = NewTestId() + o3.Name = NewTestID() o3.Email = MakeEmail() o3.Type = model.TeamInvite o3.AllowOpenInvite = true @@ -774,7 +774,7 @@ func testGetAllTeamListing(t *testing.T, rctx request.CTX, ss store.Store) { o4 := model.Team{} o4.DisplayName = "DisplayName" - o4.Name = NewTestId() + o4.Name = NewTestID() o4.Email = MakeEmail() o4.Type = model.TeamInvite _, err = ss.Team().Save(&o4) @@ -792,7 +792,7 @@ func testGetAllTeamListing(t *testing.T, rctx request.CTX, ss store.Store) { func testGetAllTeamPageListing(t *testing.T, rctx request.CTX, ss store.Store) { o1 := model.Team{} o1.DisplayName = "DisplayName" - o1.Name = NewTestId() + o1.Name = NewTestID() o1.Email = MakeEmail() o1.Type = model.TeamOpen o1.AllowOpenInvite = true @@ -801,7 +801,7 @@ func testGetAllTeamPageListing(t *testing.T, rctx request.CTX, ss store.Store) { o2 := model.Team{} o2.DisplayName = "DisplayName" - o2.Name = NewTestId() + o2.Name = NewTestID() o2.Email = MakeEmail() o2.Type = model.TeamOpen o2.AllowOpenInvite = false @@ -810,7 +810,7 @@ func testGetAllTeamPageListing(t *testing.T, rctx request.CTX, ss store.Store) { o3 := model.Team{} o3.DisplayName = "DisplayName" - o3.Name = NewTestId() + o3.Name = NewTestID() o3.Email = MakeEmail() o3.Type = model.TeamInvite o3.AllowOpenInvite = true @@ -819,7 +819,7 @@ func testGetAllTeamPageListing(t *testing.T, rctx request.CTX, ss store.Store) { o4 := model.Team{} o4.DisplayName = "DisplayName" - o4.Name = NewTestId() + o4.Name = NewTestID() o4.Email = MakeEmail() o4.Type = model.TeamInvite o4.AllowOpenInvite = false @@ -839,7 +839,7 @@ func testGetAllTeamPageListing(t *testing.T, rctx request.CTX, ss store.Store) { o5 := model.Team{} o5.DisplayName = "DisplayName" - o5.Name = NewTestId() + o5.Name = NewTestID() o5.Email = MakeEmail() o5.Type = model.TeamOpen o5.AllowOpenInvite = true @@ -868,7 +868,7 @@ func testGetAllTeamPageListing(t *testing.T, rctx request.CTX, ss store.Store) { func testGetAllPrivateTeamListing(t *testing.T, rctx request.CTX, ss store.Store) { o1 := model.Team{} o1.DisplayName = "DisplayName" - o1.Name = NewTestId() + o1.Name = NewTestID() o1.Email = MakeEmail() o1.Type = model.TeamOpen o1.AllowOpenInvite = true @@ -877,7 +877,7 @@ func testGetAllPrivateTeamListing(t *testing.T, rctx request.CTX, ss store.Store o2 := model.Team{} o2.DisplayName = "DisplayName" - o2.Name = NewTestId() + o2.Name = NewTestID() o2.Email = MakeEmail() o2.Type = model.TeamOpen _, err = ss.Team().Save(&o2) @@ -885,7 +885,7 @@ func testGetAllPrivateTeamListing(t *testing.T, rctx request.CTX, ss store.Store o3 := model.Team{} o3.DisplayName = "DisplayName" - o3.Name = NewTestId() + o3.Name = NewTestID() o3.Email = MakeEmail() o3.Type = model.TeamInvite o3.AllowOpenInvite = true @@ -894,7 +894,7 @@ func testGetAllPrivateTeamListing(t *testing.T, rctx request.CTX, ss store.Store o4 := model.Team{} o4.DisplayName = "DisplayName" - o4.Name = NewTestId() + o4.Name = NewTestID() o4.Email = MakeEmail() o4.Type = model.TeamInvite _, err = ss.Team().Save(&o4) @@ -912,7 +912,7 @@ func testGetAllPrivateTeamListing(t *testing.T, rctx request.CTX, ss store.Store func testGetAllPrivateTeamPageListing(t *testing.T, rctx request.CTX, ss store.Store) { o1 := model.Team{} o1.DisplayName = "DisplayName" - o1.Name = NewTestId() + o1.Name = NewTestID() o1.Email = MakeEmail() o1.Type = model.TeamOpen o1.AllowOpenInvite = true @@ -921,7 +921,7 @@ func testGetAllPrivateTeamPageListing(t *testing.T, rctx request.CTX, ss store.S o2 := model.Team{} o2.DisplayName = "DisplayName" - o2.Name = NewTestId() + o2.Name = NewTestID() o2.Email = MakeEmail() o2.Type = model.TeamOpen o2.AllowOpenInvite = false @@ -930,7 +930,7 @@ func testGetAllPrivateTeamPageListing(t *testing.T, rctx request.CTX, ss store.S o3 := model.Team{} o3.DisplayName = "DisplayName" - o3.Name = NewTestId() + o3.Name = NewTestID() o3.Email = MakeEmail() o3.Type = model.TeamInvite o3.AllowOpenInvite = true @@ -939,7 +939,7 @@ func testGetAllPrivateTeamPageListing(t *testing.T, rctx request.CTX, ss store.S o4 := model.Team{} o4.DisplayName = "DisplayName" - o4.Name = NewTestId() + o4.Name = NewTestID() o4.Email = MakeEmail() o4.Type = model.TeamInvite o4.AllowOpenInvite = false @@ -958,7 +958,7 @@ func testGetAllPrivateTeamPageListing(t *testing.T, rctx request.CTX, ss store.S o5 := model.Team{} o5.DisplayName = "DisplayName" - o5.Name = NewTestId() + o5.Name = NewTestID() o5.Email = MakeEmail() o5.Type = model.TeamOpen o5.AllowOpenInvite = true @@ -987,7 +987,7 @@ func testGetAllPublicTeamPageListing(t *testing.T, rctx request.CTX, ss store.St o1 := model.Team{} o1.DisplayName = "DisplayName1" - o1.Name = NewTestId() + o1.Name = NewTestID() o1.Email = MakeEmail() o1.Type = model.TeamOpen o1.AllowOpenInvite = true @@ -996,7 +996,7 @@ func testGetAllPublicTeamPageListing(t *testing.T, rctx request.CTX, ss store.St o2 := model.Team{} o2.DisplayName = "DisplayName2" - o2.Name = NewTestId() + o2.Name = NewTestID() o2.Email = MakeEmail() o2.Type = model.TeamOpen o2.AllowOpenInvite = false @@ -1005,7 +1005,7 @@ func testGetAllPublicTeamPageListing(t *testing.T, rctx request.CTX, ss store.St o3 := model.Team{} o3.DisplayName = "DisplayName3" - o3.Name = NewTestId() + o3.Name = NewTestID() o3.Email = MakeEmail() o3.Type = model.TeamInvite o3.AllowOpenInvite = true @@ -1014,7 +1014,7 @@ func testGetAllPublicTeamPageListing(t *testing.T, rctx request.CTX, ss store.St o4 := model.Team{} o4.DisplayName = "DisplayName4" - o4.Name = NewTestId() + o4.Name = NewTestID() o4.Email = MakeEmail() o4.Type = model.TeamInvite o4.AllowOpenInvite = false @@ -1029,7 +1029,7 @@ func testGetAllPublicTeamPageListing(t *testing.T, rctx request.CTX, ss store.St o5 := model.Team{} o5.DisplayName = "DisplayName5" - o5.Name = NewTestId() + o5.Name = NewTestID() o5.Email = MakeEmail() o5.Type = model.TeamOpen o5.AllowOpenInvite = true @@ -1047,7 +1047,7 @@ func testGetAllPublicTeamPageListing(t *testing.T, rctx request.CTX, ss store.St func testDelete(t *testing.T, rctx request.CTX, ss store.Store) { o1 := model.Team{} o1.DisplayName = "DisplayName" - o1.Name = NewTestId() + o1.Name = NewTestID() o1.Email = MakeEmail() o1.Type = model.TeamOpen o1.AllowOpenInvite = true @@ -1056,7 +1056,7 @@ func testDelete(t *testing.T, rctx request.CTX, ss store.Store) { o2 := model.Team{} o2.DisplayName = "DisplayName" - o2.Name = NewTestId() + o2.Name = NewTestID() o2.Email = MakeEmail() o2.Type = model.TeamOpen _, err = ss.Team().Save(&o2) @@ -1071,7 +1071,7 @@ func testPublicTeamCount(t *testing.T, rctx request.CTX, ss store.Store) { o1 := model.Team{} o1.DisplayName = "DisplayName" - o1.Name = NewTestId() + o1.Name = NewTestID() o1.Email = MakeEmail() o1.Type = model.TeamOpen o1.AllowOpenInvite = true @@ -1080,7 +1080,7 @@ func testPublicTeamCount(t *testing.T, rctx request.CTX, ss store.Store) { o2 := model.Team{} o2.DisplayName = "DisplayName" - o2.Name = NewTestId() + o2.Name = NewTestID() o2.Email = MakeEmail() o2.Type = model.TeamOpen o2.AllowOpenInvite = false @@ -1089,7 +1089,7 @@ func testPublicTeamCount(t *testing.T, rctx request.CTX, ss store.Store) { o3 := model.Team{} o3.DisplayName = "DisplayName" - o3.Name = NewTestId() + o3.Name = NewTestID() o3.Email = MakeEmail() o3.Type = model.TeamOpen o3.AllowOpenInvite = true @@ -1106,7 +1106,7 @@ func testPrivateTeamCount(t *testing.T, rctx request.CTX, ss store.Store) { o1 := model.Team{} o1.DisplayName = "DisplayName" - o1.Name = NewTestId() + o1.Name = NewTestID() o1.Email = MakeEmail() o1.Type = model.TeamOpen o1.AllowOpenInvite = false @@ -1115,7 +1115,7 @@ func testPrivateTeamCount(t *testing.T, rctx request.CTX, ss store.Store) { o2 := model.Team{} o2.DisplayName = "DisplayName" - o2.Name = NewTestId() + o2.Name = NewTestID() o2.Email = MakeEmail() o2.Type = model.TeamOpen o2.AllowOpenInvite = true @@ -1124,7 +1124,7 @@ func testPrivateTeamCount(t *testing.T, rctx request.CTX, ss store.Store) { o3 := model.Team{} o3.DisplayName = "DisplayName" - o3.Name = NewTestId() + o3.Name = NewTestID() o3.Email = MakeEmail() o3.Type = model.TeamOpen o3.AllowOpenInvite = false @@ -1139,7 +1139,7 @@ func testPrivateTeamCount(t *testing.T, rctx request.CTX, ss store.Store) { func testTeamCount(t *testing.T, rctx request.CTX, ss store.Store) { o1 := model.Team{} o1.DisplayName = "DisplayName" - o1.Name = NewTestId() + o1.Name = NewTestID() o1.Email = MakeEmail() o1.Type = model.TeamOpen o1.AllowOpenInvite = true @@ -1422,7 +1422,7 @@ func testTeamSaveMember(t *testing.T, rctx request.CTX, ss store.Store) { t.Run("insert member correctly (in team without scheme)", func(t *testing.T) { team := &model.Team{ DisplayName: "Name", - Name: NewTestId(), + Name: NewTestID(), Email: MakeEmail(), Type: model.TeamOpen, } @@ -1562,9 +1562,9 @@ func testTeamSaveMember(t *testing.T, rctx request.CTX, ss store.Store) { t.Run("insert member correctly (in team with scheme)", func(t *testing.T) { ts := &model.Scheme{ - Name: NewTestId(), - DisplayName: NewTestId(), - Description: NewTestId(), + Name: NewTestID(), + DisplayName: NewTestID(), + Description: NewTestID(), Scope: model.SchemeScopeTeam, } ts, nErr := ss.Scheme().Save(ts) @@ -1572,7 +1572,7 @@ func testTeamSaveMember(t *testing.T, rctx request.CTX, ss store.Store) { team := &model.Team{ DisplayName: "Name", - Name: NewTestId(), + Name: NewTestID(), Email: MakeEmail(), Type: model.TeamOpen, SchemeId: &ts.Id, @@ -1778,7 +1778,7 @@ func testTeamSaveMultipleMembers(t *testing.T, rctx request.CTX, ss store.Store) t.Run("insert members correctly (in team without scheme)", func(t *testing.T) { team := &model.Team{ DisplayName: "Name", - Name: NewTestId(), + Name: NewTestID(), Email: MakeEmail(), Type: model.TeamOpen, } @@ -1930,9 +1930,9 @@ func testTeamSaveMultipleMembers(t *testing.T, rctx request.CTX, ss store.Store) t.Run("insert members correctly (in team with scheme)", func(t *testing.T) { ts := &model.Scheme{ - Name: NewTestId(), - DisplayName: NewTestId(), - Description: NewTestId(), + Name: NewTestID(), + DisplayName: NewTestID(), + Description: NewTestID(), Scope: model.SchemeScopeTeam, } ts, nErr := ss.Scheme().Save(ts) @@ -1940,7 +1940,7 @@ func testTeamSaveMultipleMembers(t *testing.T, rctx request.CTX, ss store.Store) team := &model.Team{ DisplayName: "Name", - Name: NewTestId(), + Name: NewTestID(), Email: MakeEmail(), Type: model.TeamOpen, SchemeId: &ts.Id, @@ -2107,7 +2107,7 @@ func testTeamUpdateMember(t *testing.T, rctx request.CTX, ss store.Store) { t.Run("insert member correctly (in team without scheme)", func(t *testing.T) { team := &model.Team{ DisplayName: "Name", - Name: NewTestId(), + Name: NewTestID(), Email: MakeEmail(), Type: model.TeamOpen, } @@ -2247,9 +2247,9 @@ func testTeamUpdateMember(t *testing.T, rctx request.CTX, ss store.Store) { t.Run("insert member correctly (in team with scheme)", func(t *testing.T) { ts := &model.Scheme{ - Name: NewTestId(), - DisplayName: NewTestId(), - Description: NewTestId(), + Name: NewTestID(), + DisplayName: NewTestID(), + Description: NewTestID(), Scope: model.SchemeScopeTeam, } ts, nErr := ss.Scheme().Save(ts) @@ -2257,7 +2257,7 @@ func testTeamUpdateMember(t *testing.T, rctx request.CTX, ss store.Store) { team := &model.Team{ DisplayName: "Name", - Name: NewTestId(), + Name: NewTestID(), Email: MakeEmail(), Type: model.TeamOpen, SchemeId: &ts.Id, @@ -2416,7 +2416,7 @@ func testTeamUpdateMultipleMembers(t *testing.T, rctx request.CTX, ss store.Stor t.Run("update members correctly (in team without scheme)", func(t *testing.T) { team := &model.Team{ DisplayName: "Name", - Name: NewTestId(), + Name: NewTestID(), Email: MakeEmail(), Type: model.TeamOpen, } @@ -2564,9 +2564,9 @@ func testTeamUpdateMultipleMembers(t *testing.T, rctx request.CTX, ss store.Stor t.Run("insert members correctly (in team with scheme)", func(t *testing.T) { ts := &model.Scheme{ - Name: NewTestId(), - DisplayName: NewTestId(), - Description: NewTestId(), + Name: NewTestID(), + DisplayName: NewTestID(), + Description: NewTestID(), Scope: model.SchemeScopeTeam, } ts, nErr := ss.Scheme().Save(ts) @@ -2574,7 +2574,7 @@ func testTeamUpdateMultipleMembers(t *testing.T, rctx request.CTX, ss store.Stor team := &model.Team{ DisplayName: "Name", - Name: NewTestId(), + Name: NewTestID(), Email: MakeEmail(), Type: model.TeamOpen, SchemeId: &ts.Id, @@ -2876,7 +2876,7 @@ func testSaveTeamMemberMaxMembers(t *testing.T, rctx request.CTX, ss store.Store team, errSave := ss.Team().Save(&model.Team{ DisplayName: "DisplayName", - Name: NewTestId(), + Name: NewTestID(), Type: model.TeamOpen, }) require.NoError(t, errSave) @@ -2888,7 +2888,7 @@ func testSaveTeamMemberMaxMembers(t *testing.T, rctx request.CTX, ss store.Store for i := 0; i < maxUsersPerTeam; i++ { user, err := ss.User().Save(rctx, &model.User{ - Username: "a" + NewTestId(), + Username: "a" + NewTestID(), Email: MakeEmail(), }) require.NoError(t, err) @@ -2914,7 +2914,7 @@ func testSaveTeamMemberMaxMembers(t *testing.T, rctx request.CTX, ss store.Store require.Equal(t, int(totalMemberCount), maxUsersPerTeam, "should start with 5 team members, had %v instead", totalMemberCount) user, nErr := ss.User().Save(rctx, &model.User{ - Username: "a" + NewTestId(), + Username: "a" + NewTestID(), Email: MakeEmail(), }) require.NoError(t, nErr) @@ -2962,7 +2962,7 @@ func testSaveTeamMemberMaxMembers(t *testing.T, rctx request.CTX, ss store.Store require.NoError(t, nErr) user, nErr = ss.User().Save(rctx, &model.User{ - Username: "a" + NewTestId(), + Username: "a" + NewTestID(), Email: MakeEmail(), }) require.NoError(t, nErr) @@ -2996,9 +2996,9 @@ func testGetTeamMember(t *testing.T, rctx request.CTX, ss store.Store) { // Test with a custom team scheme. s2 := &model.Scheme{ - Name: NewTestId(), - DisplayName: NewTestId(), - Description: NewTestId(), + Name: NewTestID(), + DisplayName: NewTestID(), + Description: NewTestID(), Scope: model.SchemeScopeTeam, } s2, nErr = ss.Scheme().Save(s2) @@ -3007,7 +3007,7 @@ func testGetTeamMember(t *testing.T, rctx request.CTX, ss store.Store) { t2, nErr := ss.Team().Save(&model.Team{ DisplayName: "DisplayName", - Name: NewTestId(), + Name: NewTestID(), Type: model.TeamOpen, SchemeId: &s2.Id, }) @@ -3224,16 +3224,16 @@ func testUpdateLastTeamIconUpdate(t *testing.T, rctx request.CTX, ss store.Store func testGetTeamsByScheme(t *testing.T, rctx request.CTX, ss store.Store) { // Create some schemes. s1 := &model.Scheme{ - DisplayName: NewTestId(), - Name: NewTestId(), - Description: NewTestId(), + DisplayName: NewTestID(), + Name: NewTestID(), + Description: NewTestID(), Scope: model.SchemeScopeTeam, } s2 := &model.Scheme{ - DisplayName: NewTestId(), - Name: NewTestId(), - Description: NewTestId(), + DisplayName: NewTestID(), + Name: NewTestID(), + Description: NewTestID(), Scope: model.SchemeScopeTeam, } @@ -3244,24 +3244,24 @@ func testGetTeamsByScheme(t *testing.T, rctx request.CTX, ss store.Store) { // Create and save some teams. t1 := &model.Team{ - Name: NewTestId(), - DisplayName: NewTestId(), + Name: NewTestID(), + DisplayName: NewTestID(), Email: MakeEmail(), Type: model.TeamOpen, SchemeId: &s1.Id, } t2 := &model.Team{ - Name: NewTestId(), - DisplayName: NewTestId(), + Name: NewTestID(), + DisplayName: NewTestID(), Email: MakeEmail(), Type: model.TeamOpen, SchemeId: &s1.Id, } t3 := &model.Team{ - Name: NewTestId(), - DisplayName: NewTestId(), + Name: NewTestID(), + DisplayName: NewTestID(), Email: MakeEmail(), Type: model.TeamOpen, } @@ -3295,7 +3295,7 @@ func testTeamStoreMigrateTeamMembers(t *testing.T, rctx request.CTX, ss store.St s1 := model.NewId() t1 := &model.Team{ DisplayName: "Name", - Name: NewTestId(), + Name: NewTestID(), Email: MakeEmail(), Type: model.TeamOpen, InviteId: model.NewId(), @@ -3306,17 +3306,17 @@ func testTeamStoreMigrateTeamMembers(t *testing.T, rctx request.CTX, ss store.St tm1 := &model.TeamMember{ TeamId: t1.Id, - UserId: NewTestId(), + UserId: NewTestID(), ExplicitRoles: "team_admin team_user", } tm2 := &model.TeamMember{ TeamId: t1.Id, - UserId: NewTestId(), + UserId: NewTestID(), ExplicitRoles: "team_user", } tm3 := &model.TeamMember{ TeamId: t1.Id, - UserId: NewTestId(), + UserId: NewTestID(), ExplicitRoles: "something_else", } @@ -3362,25 +3362,25 @@ func testTeamStoreMigrateTeamMembers(t *testing.T, rctx request.CTX, ss store.St func testResetAllTeamSchemes(t *testing.T, rctx request.CTX, ss store.Store) { s1 := &model.Scheme{ - Name: NewTestId(), - DisplayName: NewTestId(), - Description: NewTestId(), + Name: NewTestID(), + DisplayName: NewTestID(), + Description: NewTestID(), Scope: model.SchemeScopeTeam, } s1, err := ss.Scheme().Save(s1) require.NoError(t, err) t1 := &model.Team{ - Name: NewTestId(), - DisplayName: NewTestId(), + Name: NewTestID(), + DisplayName: NewTestID(), Email: MakeEmail(), Type: model.TeamOpen, SchemeId: &s1.Id, } t2 := &model.Team{ - Name: NewTestId(), - DisplayName: NewTestId(), + Name: NewTestID(), + DisplayName: NewTestID(), Email: MakeEmail(), Type: model.TeamOpen, SchemeId: &s1.Id, @@ -3453,9 +3453,9 @@ func testTeamStoreClearAllCustomRoleAssignments(t *testing.T, rctx request.CTX, func testTeamStoreAnalyticsGetTeamCountForScheme(t *testing.T, rctx request.CTX, ss store.Store) { s1 := &model.Scheme{ - DisplayName: NewTestId(), - Name: NewTestId(), - Description: NewTestId(), + DisplayName: NewTestID(), + Name: NewTestID(), + Description: NewTestID(), Scope: model.SchemeScopeTeam, } s1, err := ss.Scheme().Save(s1) @@ -3466,8 +3466,8 @@ func testTeamStoreAnalyticsGetTeamCountForScheme(t *testing.T, rctx request.CTX, assert.Equal(t, int64(0), count1) t1 := &model.Team{ - Name: NewTestId(), - DisplayName: NewTestId(), + Name: NewTestID(), + DisplayName: NewTestID(), Email: MakeEmail(), Type: model.TeamOpen, SchemeId: &s1.Id, @@ -3480,8 +3480,8 @@ func testTeamStoreAnalyticsGetTeamCountForScheme(t *testing.T, rctx request.CTX, assert.Equal(t, int64(1), count2) t2 := &model.Team{ - Name: NewTestId(), - DisplayName: NewTestId(), + Name: NewTestID(), + DisplayName: NewTestID(), Email: MakeEmail(), Type: model.TeamOpen, SchemeId: &s1.Id, @@ -3494,8 +3494,8 @@ func testTeamStoreAnalyticsGetTeamCountForScheme(t *testing.T, rctx request.CTX, assert.Equal(t, int64(2), count3) t3 := &model.Team{ - Name: NewTestId(), - DisplayName: NewTestId(), + Name: NewTestID(), + DisplayName: NewTestID(), Email: MakeEmail(), Type: model.TeamOpen, } @@ -3507,8 +3507,8 @@ func testTeamStoreAnalyticsGetTeamCountForScheme(t *testing.T, rctx request.CTX, assert.Equal(t, int64(2), count4) t4 := &model.Team{ - Name: NewTestId(), - DisplayName: NewTestId(), + Name: NewTestID(), + DisplayName: NewTestID(), Email: MakeEmail(), Type: model.TeamOpen, SchemeId: &s1.Id, @@ -3525,7 +3525,7 @@ func testTeamStoreAnalyticsGetTeamCountForScheme(t *testing.T, rctx request.CTX, func testTeamStoreGetAllForExportAfter(t *testing.T, rctx request.CTX, ss store.Store) { t1 := model.Team{} t1.DisplayName = "Name" - t1.Name = NewTestId() + t1.Name = NewTestID() t1.Email = MakeEmail() t1.Type = model.TeamOpen _, err := ss.Team().Save(&t1) @@ -3549,7 +3549,7 @@ func testTeamStoreGetAllForExportAfter(t *testing.T, rctx request.CTX, ss store. func testTeamStoreGetTeamMembersForExport(t *testing.T, rctx request.CTX, ss store.Store) { t1 := model.Team{} t1.DisplayName = "Name" - t1.Name = NewTestId() + t1.Name = NewTestID() t1.Email = MakeEmail() t1.Type = model.TeamOpen _, err := ss.Team().Save(&t1) @@ -3557,13 +3557,13 @@ func testTeamStoreGetTeamMembersForExport(t *testing.T, rctx request.CTX, ss sto u1 := model.User{} u1.Email = MakeEmail() - u1.Nickname = NewTestId() + u1.Nickname = NewTestID() _, err = ss.User().Save(rctx, &u1) require.NoError(t, err) u2 := model.User{} u2.Email = MakeEmail() - u2.Nickname = NewTestId() + u2.Nickname = NewTestID() _, err = ss.User().Save(rctx, &u2) require.NoError(t, err) @@ -3585,8 +3585,8 @@ func testTeamStoreGetTeamMembersForExport(t *testing.T, rctx request.CTX, ss sto func testGroupSyncedTeamCount(t *testing.T, rctx request.CTX, ss store.Store) { team1, err := ss.Team().Save(&model.Team{ - DisplayName: NewTestId(), - Name: NewTestId(), + DisplayName: NewTestID(), + Name: NewTestID(), Email: MakeEmail(), Type: model.TeamInvite, GroupConstrained: model.NewPointer(true), @@ -3596,7 +3596,7 @@ func testGroupSyncedTeamCount(t *testing.T, rctx request.CTX, ss store.Store) { defer ss.Team().PermanentDelete(team1.Id) team2, err := ss.Team().Save(&model.Team{ - DisplayName: NewTestId(), + DisplayName: NewTestID(), Name: "zz" + model.NewId(), Email: MakeEmail(), Type: model.TeamInvite, @@ -3625,7 +3625,7 @@ func testGetCommonTeamIDsForMultipleUsers(t *testing.T, rctx request.CTX, ss sto // Team 1 t1 := model.Team{} t1.DisplayName = "Team 1" - t1.Name = NewTestId() + t1.Name = NewTestID() t1.Email = MakeEmail() t1.Type = model.TeamOpen _, err := ss.Team().Save(&t1) @@ -3634,7 +3634,7 @@ func testGetCommonTeamIDsForMultipleUsers(t *testing.T, rctx request.CTX, ss sto // Team 2 t2 := model.Team{} t2.DisplayName = "Team 2" - t2.Name = NewTestId() + t2.Name = NewTestID() t2.Email = MakeEmail() t2.Type = model.TeamOpen _, err = ss.Team().Save(&t2) @@ -3643,7 +3643,7 @@ func testGetCommonTeamIDsForMultipleUsers(t *testing.T, rctx request.CTX, ss sto // Team 3 t3 := model.Team{} t3.DisplayName = "Team 3" - t3.Name = NewTestId() + t3.Name = NewTestID() t3.Email = MakeEmail() t3.Type = model.TeamOpen _, err = ss.Team().Save(&t3) @@ -3654,14 +3654,14 @@ func testGetCommonTeamIDsForMultipleUsers(t *testing.T, rctx request.CTX, ss sto // User 1 u1 := model.User{} u1.Email = MakeEmail() - u1.Nickname = NewTestId() + u1.Nickname = NewTestID() _, err = ss.User().Save(rctx, &u1) require.NoError(t, err) // User 2 u2 := model.User{} u2.Email = MakeEmail() - u2.Nickname = NewTestId() + u2.Nickname = NewTestID() _, err = ss.User().Save(rctx, &u2) require.NoError(t, err) @@ -3771,14 +3771,14 @@ func testGetCommonTeamIDsForMultipleUsers(t *testing.T, rctx request.CTX, ss sto // User 3 u3 := model.User{} u3.Email = MakeEmail() - u3.Nickname = NewTestId() + u3.Nickname = NewTestID() _, err = ss.User().Save(rctx, &u3) require.NoError(t, err) // User 4 u4 := model.User{} u4.Email = MakeEmail() - u4.Nickname = NewTestId() + u4.Nickname = NewTestID() _, err = ss.User().Save(rctx, &u4) require.NoError(t, err) diff --git a/server/channels/store/storetest/thread_store.go b/server/channels/store/storetest/thread_store.go index 75ebca667b603..4b65f70c19748 100644 --- a/server/channels/store/storetest/thread_store.go +++ b/server/channels/store/storetest/thread_store.go @@ -61,7 +61,7 @@ func testThreadStorePopulation(t *testing.T, rctx request.CTX, ss store.Store) { o := model.Post{} o.ChannelId = c.Id o.UserId = u.Id - o.Message = NewTestId() + o.Message = NewTestID() if urgent { o.Metadata = &model.PostMetadata{ @@ -79,18 +79,18 @@ func testThreadStorePopulation(t *testing.T, rctx request.CTX, ss store.Store) { o2.ChannelId = c.Id o2.UserId = model.NewId() o2.RootId = otmp.Id - o2.Message = NewTestId() + o2.Message = NewTestID() o3 := model.Post{} o3.ChannelId = c.Id o3.UserId = u.Id o3.RootId = otmp.Id - o3.Message = NewTestId() + o3.Message = NewTestID() o4 := model.Post{} o4.ChannelId = c.Id o4.UserId = model.NewId() - o4.Message = NewTestId() + o4.Message = NewTestID() newPosts, errIdx, err3 := ss.Post().SaveMultiple([]*model.Post{&o2, &o3, &o4}) @@ -132,7 +132,7 @@ func testThreadStorePopulation(t *testing.T, rctx request.CTX, ss store.Store) { o5.ChannelId = channel.Id o5.UserId = model.NewId() o5.RootId = newPosts[0].Id - o5.Message = NewTestId() + o5.Message = NewTestID() _, _, err = ss.Post().SaveMultiple([]*model.Post{&o5}) require.NoError(t, err, "couldn't save item") @@ -176,12 +176,12 @@ func testThreadStorePopulation(t *testing.T, rctx request.CTX, ss store.Store) { rootPost.RootId = model.NewId() rootPost.ChannelId = channel.Id rootPost.UserId = model.NewId() - rootPost.Message = NewTestId() + rootPost.Message = NewTestID() replyPost := model.Post{} replyPost.ChannelId = rootPost.ChannelId replyPost.UserId = model.NewId() - replyPost.Message = NewTestId() + replyPost.Message = NewTestID() replyPost.RootId = rootPost.RootId newPosts, _, err := ss.Post().SaveMultiple([]*model.Post{&rootPost, &replyPost}) @@ -197,13 +197,13 @@ func testThreadStorePopulation(t *testing.T, rctx request.CTX, ss store.Store) { replyPost2 := model.Post{} replyPost2.ChannelId = rootPost.ChannelId replyPost2.UserId = model.NewId() - replyPost2.Message = NewTestId() + replyPost2.Message = NewTestID() replyPost2.RootId = rootPost.Id replyPost3 := model.Post{} replyPost3.ChannelId = rootPost.ChannelId replyPost3.UserId = model.NewId() - replyPost3.Message = NewTestId() + replyPost3.Message = NewTestID() replyPost3.RootId = rootPost.Id _, _, err = ss.Post().SaveMultiple([]*model.Post{&replyPost2, &replyPost3}) @@ -231,7 +231,7 @@ func testThreadStorePopulation(t *testing.T, rctx request.CTX, ss store.Store) { o1 := model.Post{} o1.ChannelId = channel.Id o1.UserId = model.NewId() - o1.Message = NewTestId() + o1.Message = NewTestID() rootPost, err := ss.Post().Save(rctx, &o1) require.NoError(t, err) @@ -239,7 +239,7 @@ func testThreadStorePopulation(t *testing.T, rctx request.CTX, ss store.Store) { o2.RootId = rootPost.Id o2.ChannelId = rootPost.ChannelId o2.UserId = model.NewId() - o2.Message = NewTestId() + o2.Message = NewTestID() replyPost, err := ss.Post().Save(rctx, &o2) require.NoError(t, err) @@ -247,7 +247,7 @@ func testThreadStorePopulation(t *testing.T, rctx request.CTX, ss store.Store) { o3.RootId = rootPost.Id o3.ChannelId = rootPost.ChannelId o3.UserId = o2.UserId - o3.Message = NewTestId() + o3.Message = NewTestID() replyPost2, err := ss.Post().Save(rctx, &o3) require.NoError(t, err) @@ -255,7 +255,7 @@ func testThreadStorePopulation(t *testing.T, rctx request.CTX, ss store.Store) { o4.RootId = rootPost.Id o4.ChannelId = rootPost.ChannelId o4.UserId = model.NewId() - o4.Message = NewTestId() + o4.Message = NewTestID() replyPost3, err := ss.Post().Save(rctx, &o4) require.NoError(t, err) @@ -292,7 +292,7 @@ func testThreadStorePopulation(t *testing.T, rctx request.CTX, ss store.Store) { rootPost := model.Post{} rootPost.ChannelId = channel.Id rootPost.UserId = model.NewId() - rootPost.Message = NewTestId() + rootPost.Message = NewTestID() newPosts1, _, err := ss.Post().SaveMultiple([]*model.Post{&rootPost}) require.NoError(t, err) @@ -300,7 +300,7 @@ func testThreadStorePopulation(t *testing.T, rctx request.CTX, ss store.Store) { replyPost := model.Post{} replyPost.ChannelId = rootPost.ChannelId replyPost.UserId = model.NewId() - replyPost.Message = NewTestId() + replyPost.Message = NewTestID() replyPost.RootId = newPosts1[0].Id _, _, err = ss.Post().SaveMultiple([]*model.Post{&replyPost}) diff --git a/server/channels/store/storetest/user_store.go b/server/channels/store/storetest/user_store.go index 39aea80139985..a68231a84b8b3 100644 --- a/server/channels/store/storetest/user_store.go +++ b/server/channels/store/storetest/user_store.go @@ -106,7 +106,7 @@ func TestUserStore(t *testing.T, rctx request.CTX, ss store.Store, s SqlStore) { } func testUserStoreSave(t *testing.T, rctx request.CTX, ss store.Store) { - teamId := model.NewId() + teamID := model.NewId() maxUsersPerTeam := 50 u1 := model.User{ @@ -119,7 +119,7 @@ func testUserStoreSave(t *testing.T, rctx request.CTX, ss store.Store) { defer func() { require.NoError(t, ss.User().PermanentDelete(rctx, u1.Id)) }() - _, nErr := ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamId, UserId: u1.Id}, maxUsersPerTeam) + _, nErr := ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamID, UserId: u1.Id}, maxUsersPerTeam) require.NoError(t, nErr) _, err = ss.User().Save(rctx, &u1) @@ -161,7 +161,7 @@ func testUserStoreSave(t *testing.T, rctx request.CTX, ss store.Store) { defer func() { require.NoError(t, ss.User().PermanentDelete(rctx, u.Id)) }() - _, nErr = ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamId, UserId: u.Id}, maxUsersPerTeam) + _, nErr = ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamID, UserId: u.Id}, maxUsersPerTeam) require.NoError(t, nErr) } @@ -173,7 +173,7 @@ func testUserStoreSave(t *testing.T, rctx request.CTX, ss store.Store) { defer func() { require.NoError(t, ss.User().PermanentDelete(rctx, u2.Id)) }() - _, nErr = ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamId, UserId: u1.Id}, maxUsersPerTeam) + _, nErr = ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamID, UserId: u1.Id}, maxUsersPerTeam) require.Error(t, nErr, "should be the limit") } @@ -204,10 +204,10 @@ func testUserStoreUpdate(t *testing.T, rctx request.CTX, ss store.Store) { _, err = ss.User().Update(rctx, missing, false) require.Error(t, err, "Update should have failed because of missing key") - newId := &model.User{ + newID := &model.User{ Id: model.NewId(), } - _, err = ss.User().Update(rctx, newId, false) + _, err = ss.User().Update(rctx, newID, false) require.Error(t, err, "Update should have failed because id change") u2.Email = MakeEmail() @@ -353,7 +353,7 @@ func testUserStoreGet(t *testing.T, rctx request.CTX, ss store.Store) { } func testGetAllUsingAuthService(t *testing.T, rctx request.CTX, ss store.Store) { - teamId := model.NewId() + teamID := model.NewId() u1, err := ss.User().Save(rctx, &model.User{ Email: MakeEmail(), @@ -362,7 +362,7 @@ func testGetAllUsingAuthService(t *testing.T, rctx request.CTX, ss store.Store) }) require.NoError(t, err) defer func() { require.NoError(t, ss.User().PermanentDelete(rctx, u1.Id)) }() - _, nErr := ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamId, UserId: u1.Id}, -1) + _, nErr := ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamID, UserId: u1.Id}, -1) require.NoError(t, nErr) u2, err := ss.User().Save(rctx, &model.User{ @@ -372,7 +372,7 @@ func testGetAllUsingAuthService(t *testing.T, rctx request.CTX, ss store.Store) }) require.NoError(t, err) defer func() { require.NoError(t, ss.User().PermanentDelete(rctx, u2.Id)) }() - _, nErr = ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamId, UserId: u2.Id}, -1) + _, nErr = ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamID, UserId: u2.Id}, -1) require.NoError(t, nErr) u3, err := ss.User().Save(rctx, &model.User{ @@ -382,7 +382,7 @@ func testGetAllUsingAuthService(t *testing.T, rctx request.CTX, ss store.Store) }) require.NoError(t, err) defer func() { require.NoError(t, ss.User().PermanentDelete(rctx, u3.Id)) }() - _, nErr = ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamId, UserId: u3.Id}, -1) + _, nErr = ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamID, UserId: u3.Id}, -1) require.NoError(t, nErr) _, nErr = ss.Bot().Save(&model.Bot{ UserId: u3.Id, @@ -681,7 +681,7 @@ func testUserStoreGetAllProfiles(t *testing.T, rctx request.CTX, ss store.Store) } func testUserStoreGetProfiles(t *testing.T, rctx request.CTX, ss store.Store) { - teamId := model.NewId() + teamID := model.NewId() u1, err := ss.User().Save(rctx, &model.User{ Email: MakeEmail(), @@ -689,7 +689,7 @@ func testUserStoreGetProfiles(t *testing.T, rctx request.CTX, ss store.Store) { }) require.NoError(t, err) defer func() { require.NoError(t, ss.User().PermanentDelete(rctx, u1.Id)) }() - _, nErr := ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamId, UserId: u1.Id}, -1) + _, nErr := ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamID, UserId: u1.Id}, -1) require.NoError(t, nErr) u2, err := ss.User().Save(rctx, &model.User{ @@ -698,7 +698,7 @@ func testUserStoreGetProfiles(t *testing.T, rctx request.CTX, ss store.Store) { }) require.NoError(t, err) defer func() { require.NoError(t, ss.User().PermanentDelete(rctx, u2.Id)) }() - _, nErr = ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamId, UserId: u2.Id}, -1) + _, nErr = ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamID, UserId: u2.Id}, -1) require.NoError(t, nErr) u3, err := ss.User().Save(rctx, &model.User{ @@ -715,7 +715,7 @@ func testUserStoreGetProfiles(t *testing.T, rctx request.CTX, ss store.Store) { u3.IsBot = true defer func() { require.NoError(t, ss.Bot().PermanentDelete(u3.Id)) }() defer func() { require.NoError(t, ss.User().PermanentDelete(rctx, u3.Id)) }() - _, nErr = ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamId, UserId: u3.Id}, -1) + _, nErr = ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamID, UserId: u3.Id}, -1) require.NoError(t, nErr) u4, err := ss.User().Save(rctx, &model.User{ @@ -725,7 +725,7 @@ func testUserStoreGetProfiles(t *testing.T, rctx request.CTX, ss store.Store) { }) require.NoError(t, err) defer func() { require.NoError(t, ss.User().PermanentDelete(rctx, u4.Id)) }() - _, nErr = ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamId, UserId: u4.Id}, -1) + _, nErr = ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamID, UserId: u4.Id}, -1) require.NoError(t, nErr) u5, err := ss.User().Save(rctx, &model.User{ @@ -735,12 +735,12 @@ func testUserStoreGetProfiles(t *testing.T, rctx request.CTX, ss store.Store) { }) require.NoError(t, err) defer func() { require.NoError(t, ss.User().PermanentDelete(rctx, u5.Id)) }() - _, nErr = ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamId, UserId: u5.Id}, -1) + _, nErr = ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamID, UserId: u5.Id}, -1) require.NoError(t, nErr) t.Run("get page 0, perPage 100", func(t *testing.T) { actual, err := ss.User().GetProfiles(&model.UserGetOptions{ - InTeamId: teamId, + InTeamId: teamID, Page: 0, PerPage: 100, }) @@ -757,7 +757,7 @@ func testUserStoreGetProfiles(t *testing.T, rctx request.CTX, ss store.Store) { t.Run("get page 0, perPage 1", func(t *testing.T) { actual, err := ss.User().GetProfiles(&model.UserGetOptions{ - InTeamId: teamId, + InTeamId: teamID, Page: 0, PerPage: 1, }) @@ -778,23 +778,23 @@ func testUserStoreGetProfiles(t *testing.T, rctx request.CTX, ss store.Store) { }) t.Run("etag changes for all after user creation", func(t *testing.T) { - etag := ss.User().GetEtagForProfiles(teamId) + etag := ss.User().GetEtagForProfiles(teamID) uNew := &model.User{} uNew.Email = MakeEmail() _, err := ss.User().Save(rctx, uNew) require.NoError(t, err) defer func() { require.NoError(t, ss.User().PermanentDelete(rctx, uNew.Id)) }() - _, nErr = ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamId, UserId: uNew.Id}, -1) + _, nErr = ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamID, UserId: uNew.Id}, -1) require.NoError(t, nErr) - updatedEtag := ss.User().GetEtagForProfiles(teamId) + updatedEtag := ss.User().GetEtagForProfiles(teamID) require.NotEqual(t, etag, updatedEtag) }) t.Run("filter to system_admin role", func(t *testing.T) { actual, err := ss.User().GetProfiles(&model.UserGetOptions{ - InTeamId: teamId, + InTeamId: teamID, Page: 0, PerPage: 10, Role: "system_admin", @@ -807,7 +807,7 @@ func testUserStoreGetProfiles(t *testing.T, rctx request.CTX, ss store.Store) { t.Run("filter to inactive", func(t *testing.T) { actual, err := ss.User().GetProfiles(&model.UserGetOptions{ - InTeamId: teamId, + InTeamId: teamID, Page: 0, PerPage: 10, Inactive: true, @@ -820,7 +820,7 @@ func testUserStoreGetProfiles(t *testing.T, rctx request.CTX, ss store.Store) { t.Run("filter to active", func(t *testing.T) { actual, err := ss.User().GetProfiles(&model.UserGetOptions{ - InTeamId: teamId, + InTeamId: teamID, Page: 0, PerPage: 10, Active: true, @@ -836,7 +836,7 @@ func testUserStoreGetProfiles(t *testing.T, rctx request.CTX, ss store.Store) { t.Run("try to filter to active and inactive", func(t *testing.T) { actual, err := ss.User().GetProfiles(&model.UserGetOptions{ - InTeamId: teamId, + InTeamId: teamID, Page: 0, PerPage: 10, Inactive: true, @@ -850,7 +850,7 @@ func testUserStoreGetProfiles(t *testing.T, rctx request.CTX, ss store.Store) { } func testUserStoreGetProfilesInChannel(t *testing.T, rctx request.CTX, ss store.Store) { - teamId := model.NewId() + teamID := model.NewId() u1, err := ss.User().Save(rctx, &model.User{ Email: MakeEmail(), @@ -858,7 +858,7 @@ func testUserStoreGetProfilesInChannel(t *testing.T, rctx request.CTX, ss store. }) require.NoError(t, err) defer func() { require.NoError(t, ss.User().PermanentDelete(rctx, u1.Id)) }() - _, nErr := ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamId, UserId: u1.Id}, -1) + _, nErr := ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamID, UserId: u1.Id}, -1) require.NoError(t, nErr) u2, err := ss.User().Save(rctx, &model.User{ @@ -867,7 +867,7 @@ func testUserStoreGetProfilesInChannel(t *testing.T, rctx request.CTX, ss store. }) require.NoError(t, err) defer func() { require.NoError(t, ss.User().PermanentDelete(rctx, u2.Id)) }() - _, nErr = ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamId, UserId: u2.Id}, -1) + _, nErr = ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamID, UserId: u2.Id}, -1) require.NoError(t, nErr) u3, err := ss.User().Save(rctx, &model.User{ @@ -876,7 +876,7 @@ func testUserStoreGetProfilesInChannel(t *testing.T, rctx request.CTX, ss store. }) require.NoError(t, err) defer func() { require.NoError(t, ss.User().PermanentDelete(rctx, u3.Id)) }() - _, nErr = ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamId, UserId: u3.Id}, -1) + _, nErr = ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamID, UserId: u3.Id}, -1) require.NoError(t, nErr) _, nErr = ss.Bot().Save(&model.Bot{ UserId: u3.Id, @@ -893,11 +893,11 @@ func testUserStoreGetProfilesInChannel(t *testing.T, rctx request.CTX, ss store. }) require.NoError(t, err) defer func() { require.NoError(t, ss.User().PermanentDelete(rctx, u4.Id)) }() - _, nErr = ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamId, UserId: u4.Id}, -1) + _, nErr = ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamID, UserId: u4.Id}, -1) require.NoError(t, nErr) ch1 := &model.Channel{ - TeamId: teamId, + TeamId: teamID, DisplayName: "Profiles in channel", Name: "profiles-" + model.NewId(), Type: model.ChannelTypeOpen, @@ -906,7 +906,7 @@ func testUserStoreGetProfilesInChannel(t *testing.T, rctx request.CTX, ss store. require.NoError(t, nErr) ch2 := &model.Channel{ - TeamId: teamId, + TeamId: teamID, DisplayName: "Profiles in private", Name: "profiles-" + model.NewId(), Type: model.ChannelTypePrivate, @@ -992,13 +992,13 @@ func testUserStoreGetProfilesInChannel(t *testing.T, rctx request.CTX, ss store. PerPage: 1, }) require.NoError(t, err) - users_p2, err2 := ss.User().GetProfilesInChannel(&model.UserGetOptions{ + usersP2, err2 := ss.User().GetProfilesInChannel(&model.UserGetOptions{ InChannelId: c1.Id, Page: 2, PerPage: 1, }) require.NoError(t, err2) - users = append(users, users_p2...) + users = append(users, usersP2...) assert.Equal(t, []*model.User{sanitized(u2), sanitized(u3)}, users) }) @@ -1020,7 +1020,7 @@ func testUserStoreGetProfilesInChannel(t *testing.T, rctx request.CTX, ss store. }) require.NoError(t, err) defer func() { require.NoError(t, ss.User().PermanentDelete(rctx, user2Admin.Id)) }() - _, nErr = ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamId, UserId: user2Admin.Id}, -1) + _, nErr = ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamID, UserId: user2Admin.Id}, -1) require.NoError(t, nErr) _, nErr = ss.Channel().SaveMember(rctx, &model.ChannelMember{ @@ -1046,7 +1046,7 @@ func testUserStoreGetProfilesInChannel(t *testing.T, rctx request.CTX, ss store. func testUserStoreGetProfilesInChannelByAdmin(t *testing.T, rctx request.CTX, ss store.Store, s SqlStore) { cleanupStatusStore(t, s) - teamId := model.NewId() + teamID := model.NewId() user1, err := ss.User().Save(rctx, &model.User{ Email: MakeEmail(), @@ -1054,7 +1054,7 @@ func testUserStoreGetProfilesInChannelByAdmin(t *testing.T, rctx request.CTX, ss }) require.NoError(t, err) defer func() { require.NoError(t, ss.User().PermanentDelete(rctx, user1.Id)) }() - _, nErr := ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamId, UserId: user1.Id}, -1) + _, nErr := ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamID, UserId: user1.Id}, -1) require.NoError(t, nErr) user2Admin, err := ss.User().Save(rctx, &model.User{ @@ -1063,7 +1063,7 @@ func testUserStoreGetProfilesInChannelByAdmin(t *testing.T, rctx request.CTX, ss }) require.NoError(t, err) defer func() { require.NoError(t, ss.User().PermanentDelete(rctx, user2Admin.Id)) }() - _, nErr = ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamId, UserId: user2Admin.Id}, -1) + _, nErr = ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamID, UserId: user2Admin.Id}, -1) require.NoError(t, nErr) user3, err := ss.User().Save(rctx, &model.User{ @@ -1072,11 +1072,11 @@ func testUserStoreGetProfilesInChannelByAdmin(t *testing.T, rctx request.CTX, ss }) require.NoError(t, err) defer func() { require.NoError(t, ss.User().PermanentDelete(rctx, user3.Id)) }() - _, nErr = ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamId, UserId: user3.Id}, -1) + _, nErr = ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamID, UserId: user3.Id}, -1) require.NoError(t, nErr) ch1 := &model.Channel{ - TeamId: teamId, + TeamId: teamID, DisplayName: "Profiles in channel by admin", Name: "profiles-" + model.NewId(), Type: model.ChannelTypeOpen, @@ -1124,7 +1124,7 @@ func testUserStoreGetProfilesInChannelByAdmin(t *testing.T, rctx request.CTX, ss func testUserStoreGetProfilesInChannelByStatus(t *testing.T, rctx request.CTX, ss store.Store, s SqlStore) { cleanupStatusStore(t, s) - teamId := model.NewId() + teamID := model.NewId() u1, err := ss.User().Save(rctx, &model.User{ Email: MakeEmail(), @@ -1132,7 +1132,7 @@ func testUserStoreGetProfilesInChannelByStatus(t *testing.T, rctx request.CTX, s }) require.NoError(t, err) defer func() { require.NoError(t, ss.User().PermanentDelete(rctx, u1.Id)) }() - _, nErr := ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamId, UserId: u1.Id}, -1) + _, nErr := ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamID, UserId: u1.Id}, -1) require.NoError(t, nErr) u2, err := ss.User().Save(rctx, &model.User{ @@ -1141,7 +1141,7 @@ func testUserStoreGetProfilesInChannelByStatus(t *testing.T, rctx request.CTX, s }) require.NoError(t, err) defer func() { require.NoError(t, ss.User().PermanentDelete(rctx, u2.Id)) }() - _, nErr = ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamId, UserId: u2.Id}, -1) + _, nErr = ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamID, UserId: u2.Id}, -1) require.NoError(t, nErr) u3, err := ss.User().Save(rctx, &model.User{ @@ -1150,7 +1150,7 @@ func testUserStoreGetProfilesInChannelByStatus(t *testing.T, rctx request.CTX, s }) require.NoError(t, err) defer func() { require.NoError(t, ss.User().PermanentDelete(rctx, u3.Id)) }() - _, nErr = ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamId, UserId: u3.Id}, -1) + _, nErr = ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamID, UserId: u3.Id}, -1) require.NoError(t, nErr) _, nErr = ss.Bot().Save(&model.Bot{ UserId: u3.Id, @@ -1167,11 +1167,11 @@ func testUserStoreGetProfilesInChannelByStatus(t *testing.T, rctx request.CTX, s }) require.NoError(t, err) defer func() { require.NoError(t, ss.User().PermanentDelete(rctx, u4.Id)) }() - _, nErr = ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamId, UserId: u4.Id}, -1) + _, nErr = ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamID, UserId: u4.Id}, -1) require.NoError(t, nErr) ch1 := &model.Channel{ - TeamId: teamId, + TeamId: teamID, DisplayName: "Profiles in channel", Name: "profiles-" + model.NewId(), Type: model.ChannelTypeOpen, @@ -1180,7 +1180,7 @@ func testUserStoreGetProfilesInChannelByStatus(t *testing.T, rctx request.CTX, s require.NoError(t, nErr) ch2 := &model.Channel{ - TeamId: teamId, + TeamId: teamID, DisplayName: "Profiles in private", Name: "profiles-" + model.NewId(), Type: model.ChannelTypePrivate, @@ -1283,7 +1283,7 @@ func testUserStoreGetProfilesInChannelByStatus(t *testing.T, rctx request.CTX, s } func testUserStoreGetProfilesWithoutTeam(t *testing.T, rctx request.CTX, ss store.Store) { - teamId := model.NewId() + teamID := model.NewId() u1, err := ss.User().Save(rctx, &model.User{ Email: MakeEmail(), @@ -1291,7 +1291,7 @@ func testUserStoreGetProfilesWithoutTeam(t *testing.T, rctx request.CTX, ss stor }) require.NoError(t, err) defer func() { require.NoError(t, ss.User().PermanentDelete(rctx, u1.Id)) }() - _, nErr := ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamId, UserId: u1.Id}, -1) + _, nErr := ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamID, UserId: u1.Id}, -1) require.NoError(t, nErr) u2, err := ss.User().Save(rctx, &model.User{ @@ -1350,7 +1350,7 @@ func testUserStoreGetProfilesWithoutTeam(t *testing.T, rctx request.CTX, ss stor } func testUserStoreGetAllProfilesInChannel(t *testing.T, rctx request.CTX, ss store.Store) { - teamId := model.NewId() + teamID := model.NewId() u1, err := ss.User().Save(rctx, &model.User{ Email: MakeEmail(), @@ -1358,7 +1358,7 @@ func testUserStoreGetAllProfilesInChannel(t *testing.T, rctx request.CTX, ss sto }) require.NoError(t, err) defer func() { require.NoError(t, ss.User().PermanentDelete(rctx, u1.Id)) }() - _, nErr := ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamId, UserId: u1.Id}, -1) + _, nErr := ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamID, UserId: u1.Id}, -1) require.NoError(t, nErr) u2, err := ss.User().Save(rctx, &model.User{ @@ -1367,7 +1367,7 @@ func testUserStoreGetAllProfilesInChannel(t *testing.T, rctx request.CTX, ss sto }) require.NoError(t, err) defer func() { require.NoError(t, ss.User().PermanentDelete(rctx, u2.Id)) }() - _, nErr = ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamId, UserId: u2.Id}, -1) + _, nErr = ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamID, UserId: u2.Id}, -1) require.NoError(t, nErr) u3, err := ss.User().Save(rctx, &model.User{ @@ -1376,7 +1376,7 @@ func testUserStoreGetAllProfilesInChannel(t *testing.T, rctx request.CTX, ss sto }) require.NoError(t, err) defer func() { require.NoError(t, ss.User().PermanentDelete(rctx, u3.Id)) }() - _, nErr = ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamId, UserId: u3.Id}, -1) + _, nErr = ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamID, UserId: u3.Id}, -1) require.NoError(t, nErr) _, nErr = ss.Bot().Save(&model.Bot{ UserId: u3.Id, @@ -1388,7 +1388,7 @@ func testUserStoreGetAllProfilesInChannel(t *testing.T, rctx request.CTX, ss sto defer func() { require.NoError(t, ss.Bot().PermanentDelete(u3.Id)) }() ch1 := &model.Channel{ - TeamId: teamId, + TeamId: teamID, DisplayName: "Profiles in channel", Name: "profiles-" + model.NewId(), Type: model.ChannelTypeOpen, @@ -1397,7 +1397,7 @@ func testUserStoreGetAllProfilesInChannel(t *testing.T, rctx request.CTX, ss sto require.NoError(t, nErr) ch2 := &model.Channel{ - TeamId: teamId, + TeamId: teamID, DisplayName: "Profiles in private", Name: "profiles-" + model.NewId(), Type: model.ChannelTypePrivate, @@ -1476,7 +1476,7 @@ func testUserStoreGetAllProfilesInChannel(t *testing.T, rctx request.CTX, ss sto } func testUserStoreGetProfilesNotInChannel(t *testing.T, rctx request.CTX, ss store.Store) { - teamId := model.NewId() + teamID := model.NewId() u1, err := ss.User().Save(rctx, &model.User{ Email: MakeEmail(), @@ -1484,7 +1484,7 @@ func testUserStoreGetProfilesNotInChannel(t *testing.T, rctx request.CTX, ss sto }) require.NoError(t, err) defer func() { require.NoError(t, ss.User().PermanentDelete(rctx, u1.Id)) }() - _, nErr := ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamId, UserId: u1.Id}, -1) + _, nErr := ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamID, UserId: u1.Id}, -1) require.NoError(t, nErr) u2, err := ss.User().Save(rctx, &model.User{ @@ -1493,7 +1493,7 @@ func testUserStoreGetProfilesNotInChannel(t *testing.T, rctx request.CTX, ss sto }) require.NoError(t, err) defer func() { require.NoError(t, ss.User().PermanentDelete(rctx, u2.Id)) }() - _, nErr = ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamId, UserId: u2.Id}, -1) + _, nErr = ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamID, UserId: u2.Id}, -1) require.NoError(t, nErr) u3, err := ss.User().Save(rctx, &model.User{ @@ -1502,7 +1502,7 @@ func testUserStoreGetProfilesNotInChannel(t *testing.T, rctx request.CTX, ss sto }) require.NoError(t, err) defer func() { require.NoError(t, ss.User().PermanentDelete(rctx, u3.Id)) }() - _, nErr = ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamId, UserId: u3.Id}, -1) + _, nErr = ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamID, UserId: u3.Id}, -1) require.NoError(t, nErr) _, nErr = ss.Bot().Save(&model.Bot{ UserId: u3.Id, @@ -1514,7 +1514,7 @@ func testUserStoreGetProfilesNotInChannel(t *testing.T, rctx request.CTX, ss sto defer func() { require.NoError(t, ss.Bot().PermanentDelete(u3.Id)) }() ch1 := &model.Channel{ - TeamId: teamId, + TeamId: teamID, DisplayName: "Profiles in channel", Name: "profiles-" + model.NewId(), Type: model.ChannelTypeOpen, @@ -1523,7 +1523,7 @@ func testUserStoreGetProfilesNotInChannel(t *testing.T, rctx request.CTX, ss sto require.NoError(t, nErr) ch2 := &model.Channel{ - TeamId: teamId, + TeamId: teamID, DisplayName: "Profiles in private", Name: "profiles-" + model.NewId(), Type: model.ChannelTypePrivate, @@ -1533,7 +1533,7 @@ func testUserStoreGetProfilesNotInChannel(t *testing.T, rctx request.CTX, ss sto t.Run("get team 1, channel 1, offset 0, limit 100", func(t *testing.T) { var profiles []*model.User - profiles, err = ss.User().GetProfilesNotInChannel(teamId, c1.Id, false, 0, 100, nil) + profiles, err = ss.User().GetProfilesNotInChannel(teamID, c1.Id, false, 0, 100, nil) require.NoError(t, err) assert.Equal(t, []*model.User{ sanitized(u1), @@ -1544,7 +1544,7 @@ func testUserStoreGetProfilesNotInChannel(t *testing.T, rctx request.CTX, ss sto t.Run("get team 1, channel 2, offset 0, limit 100", func(t *testing.T) { var profiles []*model.User - profiles, err = ss.User().GetProfilesNotInChannel(teamId, c2.Id, false, 0, 100, nil) + profiles, err = ss.User().GetProfilesNotInChannel(teamID, c2.Id, false, 0, 100, nil) require.NoError(t, err) assert.Equal(t, []*model.User{ sanitized(u1), @@ -1583,14 +1583,14 @@ func testUserStoreGetProfilesNotInChannel(t *testing.T, rctx request.CTX, ss sto t.Run("get team 1, channel 1, offset 0, limit 100, after update", func(t *testing.T) { var profiles []*model.User - profiles, err = ss.User().GetProfilesNotInChannel(teamId, c1.Id, false, 0, 100, nil) + profiles, err = ss.User().GetProfilesNotInChannel(teamID, c1.Id, false, 0, 100, nil) require.NoError(t, err) assert.Equal(t, []*model.User{}, profiles) }) t.Run("get team 1, channel 2, offset 0, limit 100, after update", func(t *testing.T) { var profiles []*model.User - profiles, err = ss.User().GetProfilesNotInChannel(teamId, c2.Id, false, 0, 100, nil) + profiles, err = ss.User().GetProfilesNotInChannel(teamID, c2.Id, false, 0, 100, nil) require.NoError(t, err) assert.Equal(t, []*model.User{ sanitized(u2), @@ -1600,7 +1600,7 @@ func testUserStoreGetProfilesNotInChannel(t *testing.T, rctx request.CTX, ss sto t.Run("get team 1, channel 2, offset 0, limit 0, setting group constrained when it's not", func(t *testing.T) { var profiles []*model.User - profiles, err = ss.User().GetProfilesNotInChannel(teamId, c2.Id, true, 0, 100, nil) + profiles, err = ss.User().GetProfilesNotInChannel(teamID, c2.Id, true, 0, 100, nil) require.NoError(t, err) assert.Empty(t, profiles) }) @@ -1629,7 +1629,7 @@ func testUserStoreGetProfilesNotInChannel(t *testing.T, rctx request.CTX, ss sto require.NoError(t, err) t.Run("get team 1, channel 2, offset 0, limit 0, setting group constrained", func(t *testing.T) { - profiles, err := ss.User().GetProfilesNotInChannel(teamId, c2.Id, true, 0, 100, nil) + profiles, err := ss.User().GetProfilesNotInChannel(teamID, c2.Id, true, 0, 100, nil) require.NoError(t, err) assert.Equal(t, []*model.User{ sanitized(u2), @@ -1638,7 +1638,7 @@ func testUserStoreGetProfilesNotInChannel(t *testing.T, rctx request.CTX, ss sto } func testUserStoreGetProfilesByIds(t *testing.T, rctx request.CTX, ss store.Store) { - teamId := model.NewId() + teamID := model.NewId() u1, err := ss.User().Save(rctx, &model.User{ Email: MakeEmail(), @@ -1646,7 +1646,7 @@ func testUserStoreGetProfilesByIds(t *testing.T, rctx request.CTX, ss store.Stor }) require.NoError(t, err) defer func() { require.NoError(t, ss.User().PermanentDelete(rctx, u1.Id)) }() - _, nErr := ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamId, UserId: u1.Id}, -1) + _, nErr := ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamID, UserId: u1.Id}, -1) require.NoError(t, nErr) u2, err := ss.User().Save(rctx, &model.User{ @@ -1655,7 +1655,7 @@ func testUserStoreGetProfilesByIds(t *testing.T, rctx request.CTX, ss store.Stor }) require.NoError(t, err) defer func() { require.NoError(t, ss.User().PermanentDelete(rctx, u2.Id)) }() - _, nErr = ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamId, UserId: u2.Id}, -1) + _, nErr = ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamID, UserId: u2.Id}, -1) require.NoError(t, nErr) time.Sleep(time.Millisecond) @@ -1665,7 +1665,7 @@ func testUserStoreGetProfilesByIds(t *testing.T, rctx request.CTX, ss store.Stor }) require.NoError(t, err) defer func() { require.NoError(t, ss.User().PermanentDelete(rctx, u3.Id)) }() - _, nErr = ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamId, UserId: u3.Id}, -1) + _, nErr = ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamID, UserId: u3.Id}, -1) require.NoError(t, nErr) _, nErr = ss.Bot().Save(&model.Bot{ UserId: u3.Id, @@ -1760,10 +1760,10 @@ func testUserStoreGetProfileByGroupChannelIdsForUser(t *testing.T, rctx request. }, -1) require.NoError(t, nErr) - for _, uId := range []string{u1.Id, u2.Id, u3.Id} { + for _, uID := range []string{u1.Id, u2.Id, u3.Id} { _, nErr = ss.Channel().SaveMember(rctx, &model.ChannelMember{ ChannelId: gc1.Id, - UserId: uId, + UserId: uID, NotifyProps: model.GetDefaultChannelNotifyProps(), }) require.NoError(t, nErr) @@ -1776,10 +1776,10 @@ func testUserStoreGetProfileByGroupChannelIdsForUser(t *testing.T, rctx request. }, -1) require.NoError(t, nErr) - for _, uId := range []string{u1.Id, u3.Id, u4.Id} { + for _, uID := range []string{u1.Id, u3.Id, u4.Id} { _, nErr = ss.Channel().SaveMember(rctx, &model.ChannelMember{ ChannelId: gc2.Id, - UserId: uId, + UserId: uID, NotifyProps: model.GetDefaultChannelNotifyProps(), }) require.NoError(t, nErr) @@ -1787,14 +1787,14 @@ func testUserStoreGetProfileByGroupChannelIdsForUser(t *testing.T, rctx request. testCases := []struct { Name string - UserId string + UserID string ChannelIds []string ExpectedUserIdsByChannel map[string][]string EnsureChannelsNotInResults []string }{ { Name: "Get group 1 as user 1", - UserId: u1.Id, + UserID: u1.Id, ChannelIds: []string{gc1.Id}, ExpectedUserIdsByChannel: map[string][]string{ gc1.Id: {u2.Id, u3.Id}, @@ -1803,7 +1803,7 @@ func testUserStoreGetProfileByGroupChannelIdsForUser(t *testing.T, rctx request. }, { Name: "Get groups 1 and 2 as user 1", - UserId: u1.Id, + UserID: u1.Id, ChannelIds: []string{gc1.Id, gc2.Id}, ExpectedUserIdsByChannel: map[string][]string{ gc1.Id: {u2.Id, u3.Id}, @@ -1813,7 +1813,7 @@ func testUserStoreGetProfileByGroupChannelIdsForUser(t *testing.T, rctx request. }, { Name: "Get groups 1 and 2 as user 2", - UserId: u2.Id, + UserID: u2.Id, ChannelIds: []string{gc1.Id, gc2.Id}, ExpectedUserIdsByChannel: map[string][]string{ gc1.Id: {u1.Id, u3.Id}, @@ -1824,11 +1824,11 @@ func testUserStoreGetProfileByGroupChannelIdsForUser(t *testing.T, rctx request. for _, tc := range testCases { t.Run(tc.Name, func(t *testing.T) { - res, err := ss.User().GetProfileByGroupChannelIdsForUser(tc.UserId, tc.ChannelIds) + res, err := ss.User().GetProfileByGroupChannelIdsForUser(tc.UserID, tc.ChannelIds) require.NoError(t, err) - for channelId, expectedUsers := range tc.ExpectedUserIdsByChannel { - users, ok := res[channelId] + for channelID, expectedUsers := range tc.ExpectedUserIdsByChannel { + users, ok := res[channelID] require.True(t, ok) var userIds []string @@ -1838,8 +1838,8 @@ func testUserStoreGetProfileByGroupChannelIdsForUser(t *testing.T, rctx request. require.ElementsMatch(t, expectedUsers, userIds) } - for _, channelId := range tc.EnsureChannelsNotInResults { - _, ok := res[channelId] + for _, channelID := range tc.EnsureChannelsNotInResults { + _, ok := res[channelID] require.False(t, ok) } }) @@ -1847,7 +1847,7 @@ func testUserStoreGetProfileByGroupChannelIdsForUser(t *testing.T, rctx request. } func testUserStoreGetProfilesByUsernames(t *testing.T, rctx request.CTX, ss store.Store) { - teamId := model.NewId() + teamID := model.NewId() team2Id := model.NewId() u1, err := ss.User().Save(rctx, &model.User{ @@ -1856,7 +1856,7 @@ func testUserStoreGetProfilesByUsernames(t *testing.T, rctx request.CTX, ss stor }) require.NoError(t, err) defer func() { require.NoError(t, ss.User().PermanentDelete(rctx, u1.Id)) }() - _, nErr := ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamId, UserId: u1.Id}, -1) + _, nErr := ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamID, UserId: u1.Id}, -1) require.NoError(t, nErr) u2, err := ss.User().Save(rctx, &model.User{ @@ -1865,7 +1865,7 @@ func testUserStoreGetProfilesByUsernames(t *testing.T, rctx request.CTX, ss stor }) require.NoError(t, err) defer func() { require.NoError(t, ss.User().PermanentDelete(rctx, u2.Id)) }() - _, nErr = ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamId, UserId: u2.Id}, -1) + _, nErr = ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamID, UserId: u2.Id}, -1) require.NoError(t, nErr) u3, err := ss.User().Save(rctx, &model.User{ @@ -1886,13 +1886,13 @@ func testUserStoreGetProfilesByUsernames(t *testing.T, rctx request.CTX, ss stor defer func() { require.NoError(t, ss.Bot().PermanentDelete(u3.Id)) }() t.Run("get by u1 and u2 usernames, team id 1", func(t *testing.T) { - users, err := ss.User().GetProfilesByUsernames([]string{u1.Username, u2.Username}, &model.ViewUsersRestrictions{Teams: []string{teamId}}) + users, err := ss.User().GetProfilesByUsernames([]string{u1.Username, u2.Username}, &model.ViewUsersRestrictions{Teams: []string{teamID}}) require.NoError(t, err) assert.Equal(t, []*model.User{u1, u2}, users) }) t.Run("get by u1 username, team id 1", func(t *testing.T) { - users, err := ss.User().GetProfilesByUsernames([]string{u1.Username}, &model.ViewUsersRestrictions{Teams: []string{teamId}}) + users, err := ss.User().GetProfilesByUsernames([]string{u1.Username}, &model.ViewUsersRestrictions{Teams: []string{teamID}}) require.NoError(t, err) assert.Equal(t, []*model.User{u1}, users) }) @@ -1904,7 +1904,7 @@ func testUserStoreGetProfilesByUsernames(t *testing.T, rctx request.CTX, ss stor }) t.Run("get by u1 and u3 usernames, team id 1", func(t *testing.T) { - users, err := ss.User().GetProfilesByUsernames([]string{u1.Username, u3.Username}, &model.ViewUsersRestrictions{Teams: []string{teamId}}) + users, err := ss.User().GetProfilesByUsernames([]string{u1.Username, u3.Username}, &model.ViewUsersRestrictions{Teams: []string{teamID}}) require.NoError(t, err) assert.Equal(t, []*model.User{u1}, users) }) @@ -1917,7 +1917,7 @@ func testUserStoreGetProfilesByUsernames(t *testing.T, rctx request.CTX, ss stor } func testUserStoreGetSystemAdminProfiles(t *testing.T, rctx request.CTX, ss store.Store) { - teamId := model.NewId() + teamID := model.NewId() u1, err := ss.User().Save(rctx, &model.User{ Email: MakeEmail(), @@ -1926,7 +1926,7 @@ func testUserStoreGetSystemAdminProfiles(t *testing.T, rctx request.CTX, ss stor }) require.NoError(t, err) defer func() { require.NoError(t, ss.User().PermanentDelete(rctx, u1.Id)) }() - _, nErr := ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamId, UserId: u1.Id}, -1) + _, nErr := ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamID, UserId: u1.Id}, -1) require.NoError(t, nErr) u2, err := ss.User().Save(rctx, &model.User{ @@ -1935,7 +1935,7 @@ func testUserStoreGetSystemAdminProfiles(t *testing.T, rctx request.CTX, ss stor }) require.NoError(t, err) defer func() { require.NoError(t, ss.User().PermanentDelete(rctx, u2.Id)) }() - _, nErr = ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamId, UserId: u2.Id}, -1) + _, nErr = ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamID, UserId: u2.Id}, -1) require.NoError(t, nErr) u3, err := ss.User().Save(rctx, &model.User{ @@ -1945,7 +1945,7 @@ func testUserStoreGetSystemAdminProfiles(t *testing.T, rctx request.CTX, ss stor }) require.NoError(t, err) defer func() { require.NoError(t, ss.User().PermanentDelete(rctx, u3.Id)) }() - _, nErr = ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamId, UserId: u3.Id}, -1) + _, nErr = ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamID, UserId: u3.Id}, -1) require.NoError(t, nErr) _, nErr = ss.Bot().Save(&model.Bot{ UserId: u3.Id, @@ -1967,7 +1967,7 @@ func testUserStoreGetSystemAdminProfiles(t *testing.T, rctx request.CTX, ss stor } func testUserStoreGetByEmail(t *testing.T, rctx request.CTX, ss store.Store) { - teamId := model.NewId() + teamID := model.NewId() u1, err := ss.User().Save(rctx, &model.User{ Email: MakeEmail(), @@ -1975,7 +1975,7 @@ func testUserStoreGetByEmail(t *testing.T, rctx request.CTX, ss store.Store) { }) require.NoError(t, err) defer func() { require.NoError(t, ss.User().PermanentDelete(rctx, u1.Id)) }() - _, nErr := ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamId, UserId: u1.Id}, -1) + _, nErr := ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamID, UserId: u1.Id}, -1) require.NoError(t, nErr) u2, err := ss.User().Save(rctx, &model.User{ @@ -1984,7 +1984,7 @@ func testUserStoreGetByEmail(t *testing.T, rctx request.CTX, ss store.Store) { }) require.NoError(t, err) defer func() { require.NoError(t, ss.User().PermanentDelete(rctx, u2.Id)) }() - _, nErr = ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamId, UserId: u2.Id}, -1) + _, nErr = ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamID, UserId: u2.Id}, -1) require.NoError(t, nErr) u3, err := ss.User().Save(rctx, &model.User{ @@ -1993,7 +1993,7 @@ func testUserStoreGetByEmail(t *testing.T, rctx request.CTX, ss store.Store) { }) require.NoError(t, err) defer func() { require.NoError(t, ss.User().PermanentDelete(rctx, u3.Id)) }() - _, nErr = ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamId, UserId: u3.Id}, -1) + _, nErr = ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamID, UserId: u3.Id}, -1) require.NoError(t, nErr) _, nErr = ss.Bot().Save(&model.Bot{ UserId: u3.Id, @@ -2034,7 +2034,7 @@ func testUserStoreGetByEmail(t *testing.T, rctx request.CTX, ss store.Store) { } func testUserStoreGetByAuthData(t *testing.T, rctx request.CTX, ss store.Store) { - teamId := model.NewId() + teamID := model.NewId() auth1 := model.NewId() auth3 := model.NewId() @@ -2046,7 +2046,7 @@ func testUserStoreGetByAuthData(t *testing.T, rctx request.CTX, ss store.Store) }) require.NoError(t, err) defer func() { require.NoError(t, ss.User().PermanentDelete(rctx, u1.Id)) }() - _, nErr := ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamId, UserId: u1.Id}, -1) + _, nErr := ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamID, UserId: u1.Id}, -1) require.NoError(t, nErr) u2, err := ss.User().Save(rctx, &model.User{ @@ -2055,7 +2055,7 @@ func testUserStoreGetByAuthData(t *testing.T, rctx request.CTX, ss store.Store) }) require.NoError(t, err) defer func() { require.NoError(t, ss.User().PermanentDelete(rctx, u2.Id)) }() - _, nErr = ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamId, UserId: u2.Id}, -1) + _, nErr = ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamID, UserId: u2.Id}, -1) require.NoError(t, nErr) u3, err := ss.User().Save(rctx, &model.User{ @@ -2066,7 +2066,7 @@ func testUserStoreGetByAuthData(t *testing.T, rctx request.CTX, ss store.Store) }) require.NoError(t, err) defer func() { require.NoError(t, ss.User().PermanentDelete(rctx, u3.Id)) }() - _, nErr = ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamId, UserId: u3.Id}, -1) + _, nErr = ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamID, UserId: u3.Id}, -1) require.NoError(t, nErr) _, nErr = ss.Bot().Save(&model.Bot{ UserId: u3.Id, @@ -2114,7 +2114,7 @@ func testUserStoreGetByAuthData(t *testing.T, rctx request.CTX, ss store.Store) } func testUserStoreGetByUsername(t *testing.T, rctx request.CTX, ss store.Store) { - teamId := model.NewId() + teamID := model.NewId() u1, err := ss.User().Save(rctx, &model.User{ Email: MakeEmail(), @@ -2122,7 +2122,7 @@ func testUserStoreGetByUsername(t *testing.T, rctx request.CTX, ss store.Store) }) require.NoError(t, err) defer func() { require.NoError(t, ss.User().PermanentDelete(rctx, u1.Id)) }() - _, nErr := ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamId, UserId: u1.Id}, -1) + _, nErr := ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamID, UserId: u1.Id}, -1) require.NoError(t, nErr) u2, err := ss.User().Save(rctx, &model.User{ @@ -2131,7 +2131,7 @@ func testUserStoreGetByUsername(t *testing.T, rctx request.CTX, ss store.Store) }) require.NoError(t, err) defer func() { require.NoError(t, ss.User().PermanentDelete(rctx, u2.Id)) }() - _, nErr = ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamId, UserId: u2.Id}, -1) + _, nErr = ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamID, UserId: u2.Id}, -1) require.NoError(t, nErr) u3, err := ss.User().Save(rctx, &model.User{ @@ -2140,7 +2140,7 @@ func testUserStoreGetByUsername(t *testing.T, rctx request.CTX, ss store.Store) }) require.NoError(t, err) defer func() { require.NoError(t, ss.User().PermanentDelete(rctx, u3.Id)) }() - _, nErr = ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamId, UserId: u3.Id}, -1) + _, nErr = ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamID, UserId: u3.Id}, -1) require.NoError(t, nErr) _, nErr = ss.Bot().Save(&model.Bot{ UserId: u3.Id, @@ -2185,7 +2185,7 @@ func testUserStoreGetByUsername(t *testing.T, rctx request.CTX, ss store.Store) } func testUserStoreGetForLogin(t *testing.T, rctx request.CTX, ss store.Store) { - teamId := model.NewId() + teamID := model.NewId() auth := model.NewId() auth2 := model.NewId() auth3 := model.NewId() @@ -2199,7 +2199,7 @@ func testUserStoreGetForLogin(t *testing.T, rctx request.CTX, ss store.Store) { require.NoError(t, err) defer func() { require.NoError(t, ss.User().PermanentDelete(rctx, u1.Id)) }() - _, nErr := ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamId, UserId: u1.Id}, -1) + _, nErr := ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamID, UserId: u1.Id}, -1) require.NoError(t, nErr) u2, err := ss.User().Save(rctx, &model.User{ @@ -2210,7 +2210,7 @@ func testUserStoreGetForLogin(t *testing.T, rctx request.CTX, ss store.Store) { }) require.NoError(t, err) defer func() { require.NoError(t, ss.User().PermanentDelete(rctx, u2.Id)) }() - _, nErr = ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamId, UserId: u2.Id}, -1) + _, nErr = ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamID, UserId: u2.Id}, -1) require.NoError(t, nErr) u3, err := ss.User().Save(rctx, &model.User{ @@ -2221,7 +2221,7 @@ func testUserStoreGetForLogin(t *testing.T, rctx request.CTX, ss store.Store) { }) require.NoError(t, err) defer func() { require.NoError(t, ss.User().PermanentDelete(rctx, u3.Id)) }() - _, nErr = ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamId, UserId: u3.Id}, -1) + _, nErr = ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamID, UserId: u3.Id}, -1) require.NoError(t, nErr) _, nErr = ss.Bot().Save(&model.Bot{ UserId: u3.Id, @@ -2288,14 +2288,14 @@ func testUserStoreGetForLogin(t *testing.T, rctx request.CTX, ss store.Store) { } func testUserStoreUpdatePassword(t *testing.T, rctx request.CTX, ss store.Store) { - teamId := model.NewId() + teamID := model.NewId() u1 := &model.User{} u1.Email = MakeEmail() _, err := ss.User().Save(rctx, u1) require.NoError(t, err) defer func() { require.NoError(t, ss.User().PermanentDelete(rctx, u1.Id)) }() - _, nErr := ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamId, UserId: u1.Id}, -1) + _, nErr := ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamID, UserId: u1.Id}, -1) require.NoError(t, nErr) _, err = model.HashPassword(strings.Repeat("1234567890", 8)) @@ -2326,14 +2326,14 @@ func testUserStoreDelete(t *testing.T, rctx request.CTX, ss store.Store) { } func testUserStoreUpdateAuthData(t *testing.T, rctx request.CTX, ss store.Store) { - teamId := model.NewId() + teamID := model.NewId() u1 := &model.User{} u1.Email = MakeEmail() _, err := ss.User().Save(rctx, u1) require.NoError(t, err) defer func() { require.NoError(t, ss.User().PermanentDelete(rctx, u1.Id)) }() - _, nErr := ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamId, UserId: u1.Id}, -1) + _, nErr := ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamID, UserId: u1.Id}, -1) require.NoError(t, nErr) service := "someservice" @@ -2399,18 +2399,18 @@ func testUserStoreResetAuthDataToEmailForUsers(t *testing.T, rctx request.CTX, s } func testUserUnreadCount(t *testing.T, rctx request.CTX, ss store.Store) { - teamId := model.NewId() + teamID := model.NewId() c1 := model.Channel{} - c1.TeamId = teamId + c1.TeamId = teamID c1.DisplayName = "Unread Messages" c1.Name = "unread-messages-" + model.NewId() c1.Type = model.ChannelTypeOpen c2 := model.Channel{} - c2.TeamId = teamId + c2.TeamId = teamID c2.DisplayName = "Unread Direct" - c2.Name = model.GetDMNameFromIds(NewTestId(), NewTestId()) + c2.Name = model.GetDMNameFromIds(NewTestID(), NewTestID()) c2.Type = model.ChannelTypeDirect u1 := &model.User{} @@ -2419,7 +2419,7 @@ func testUserUnreadCount(t *testing.T, rctx request.CTX, ss store.Store) { _, err := ss.User().Save(rctx, u1) require.NoError(t, err) defer func() { require.NoError(t, ss.User().PermanentDelete(rctx, u1.Id)) }() - _, nErr := ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamId, UserId: u1.Id}, -1) + _, nErr := ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamID, UserId: u1.Id}, -1) require.NoError(t, nErr) u2 := &model.User{} @@ -2428,7 +2428,7 @@ func testUserUnreadCount(t *testing.T, rctx request.CTX, ss store.Store) { _, err = ss.User().Save(rctx, u2) require.NoError(t, err) defer func() { require.NoError(t, ss.User().PermanentDelete(rctx, u2.Id)) }() - _, nErr = ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamId, UserId: u2.Id}, -1) + _, nErr = ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamID, UserId: u2.Id}, -1) require.NoError(t, nErr) u3 := &model.User{} @@ -2437,7 +2437,7 @@ func testUserUnreadCount(t *testing.T, rctx request.CTX, ss store.Store) { _, err = ss.User().Save(rctx, u3) require.NoError(t, err) defer func() { require.NoError(t, ss.User().PermanentDelete(rctx, u3.Id)) }() - _, nErr = ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamId, UserId: u3.Id}, -1) + _, nErr = ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamID, UserId: u3.Id}, -1) require.NoError(t, nErr) _, nErr = ss.Channel().Save(rctx, &c1, -1) @@ -2566,7 +2566,7 @@ func testUserStoreUpdateMfaActive(t *testing.T, rctx request.CTX, ss store.Store func testUserStoreGetRecentlyActiveUsersForTeam(t *testing.T, rctx request.CTX, ss store.Store, s SqlStore) { cleanupStatusStore(t, s) - teamId := model.NewId() + teamID := model.NewId() u1, err := ss.User().Save(rctx, &model.User{ Email: MakeEmail(), @@ -2574,7 +2574,7 @@ func testUserStoreGetRecentlyActiveUsersForTeam(t *testing.T, rctx request.CTX, }) require.NoError(t, err) defer func() { require.NoError(t, ss.User().PermanentDelete(rctx, u1.Id)) }() - _, nErr := ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamId, UserId: u1.Id}, -1) + _, nErr := ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamID, UserId: u1.Id}, -1) require.NoError(t, nErr) u2, err := ss.User().Save(rctx, &model.User{ @@ -2583,7 +2583,7 @@ func testUserStoreGetRecentlyActiveUsersForTeam(t *testing.T, rctx request.CTX, }) require.NoError(t, err) defer func() { require.NoError(t, ss.User().PermanentDelete(rctx, u2.Id)) }() - _, nErr = ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamId, UserId: u2.Id}, -1) + _, nErr = ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamID, UserId: u2.Id}, -1) require.NoError(t, nErr) u3, err := ss.User().Save(rctx, &model.User{ @@ -2592,7 +2592,7 @@ func testUserStoreGetRecentlyActiveUsersForTeam(t *testing.T, rctx request.CTX, }) require.NoError(t, err) defer func() { require.NoError(t, ss.User().PermanentDelete(rctx, u3.Id)) }() - _, nErr = ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamId, UserId: u3.Id}, -1) + _, nErr = ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamID, UserId: u3.Id}, -1) require.NoError(t, nErr) _, nErr = ss.Bot().Save(&model.Bot{ UserId: u3.Id, @@ -2613,7 +2613,7 @@ func testUserStoreGetRecentlyActiveUsersForTeam(t *testing.T, rctx request.CTX, require.NoError(t, ss.Status().SaveOrUpdate(&model.Status{UserId: u3.Id, Status: model.StatusOnline, Manual: false, LastActivityAt: u3.LastActivityAt, ActiveChannel: ""})) t.Run("get team 1, offset 0, limit 100", func(t *testing.T) { - users, err := ss.User().GetRecentlyActiveUsersForTeam(teamId, 0, 100, nil) + users, err := ss.User().GetRecentlyActiveUsersForTeam(teamID, 0, 100, nil) require.NoError(t, err) assert.Equal(t, []*model.User{ sanitized(u3), @@ -2623,7 +2623,7 @@ func testUserStoreGetRecentlyActiveUsersForTeam(t *testing.T, rctx request.CTX, }) t.Run("get team 1, offset 0, limit 1", func(t *testing.T) { - users, err := ss.User().GetRecentlyActiveUsersForTeam(teamId, 0, 1, nil) + users, err := ss.User().GetRecentlyActiveUsersForTeam(teamID, 0, 1, nil) require.NoError(t, err) assert.Equal(t, []*model.User{ sanitized(u3), @@ -2631,7 +2631,7 @@ func testUserStoreGetRecentlyActiveUsersForTeam(t *testing.T, rctx request.CTX, }) t.Run("get team 1, offset 2, limit 1", func(t *testing.T) { - users, err := ss.User().GetRecentlyActiveUsersForTeam(teamId, 2, 1, nil) + users, err := ss.User().GetRecentlyActiveUsersForTeam(teamID, 2, 1, nil) require.NoError(t, err) assert.Equal(t, []*model.User{ sanitized(u2), @@ -2640,8 +2640,8 @@ func testUserStoreGetRecentlyActiveUsersForTeam(t *testing.T, rctx request.CTX, } func testUserStoreGetNewUsersForTeam(t *testing.T, rctx request.CTX, ss store.Store) { - teamId := model.NewId() - teamId2 := model.NewId() + teamID := model.NewId() + teamID2 := model.NewId() u1, err := ss.User().Save(rctx, &model.User{ Email: MakeEmail(), @@ -2649,7 +2649,7 @@ func testUserStoreGetNewUsersForTeam(t *testing.T, rctx request.CTX, ss store.St }) require.NoError(t, err) defer func() { require.NoError(t, ss.User().PermanentDelete(rctx, u1.Id)) }() - _, nErr := ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamId, UserId: u1.Id}, -1) + _, nErr := ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamID, UserId: u1.Id}, -1) require.NoError(t, nErr) u2, err := ss.User().Save(rctx, &model.User{ @@ -2658,7 +2658,7 @@ func testUserStoreGetNewUsersForTeam(t *testing.T, rctx request.CTX, ss store.St }) require.NoError(t, err) defer func() { require.NoError(t, ss.User().PermanentDelete(rctx, u2.Id)) }() - _, nErr = ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamId, UserId: u2.Id}, -1) + _, nErr = ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamID, UserId: u2.Id}, -1) require.NoError(t, nErr) u3, err := ss.User().Save(rctx, &model.User{ @@ -2667,7 +2667,7 @@ func testUserStoreGetNewUsersForTeam(t *testing.T, rctx request.CTX, ss store.St }) require.NoError(t, err) defer func() { require.NoError(t, ss.User().PermanentDelete(rctx, u3.Id)) }() - _, nErr = ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamId, UserId: u3.Id}, -1) + _, nErr = ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamID, UserId: u3.Id}, -1) require.NoError(t, nErr) _, nErr = ss.Bot().Save(&model.Bot{ UserId: u3.Id, @@ -2684,11 +2684,11 @@ func testUserStoreGetNewUsersForTeam(t *testing.T, rctx request.CTX, ss store.St }) require.NoError(t, err) defer func() { require.NoError(t, ss.User().PermanentDelete(rctx, u4.Id)) }() - _, nErr = ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamId2, UserId: u4.Id}, -1) + _, nErr = ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamID2, UserId: u4.Id}, -1) require.NoError(t, nErr) t.Run("get team 1, offset 0, limit 100", func(t *testing.T) { - result, err := ss.User().GetNewUsersForTeam(teamId, 0, 100, nil) + result, err := ss.User().GetNewUsersForTeam(teamID, 0, 100, nil) require.NoError(t, err) assert.Equal(t, []*model.User{ sanitized(u3), @@ -2698,7 +2698,7 @@ func testUserStoreGetNewUsersForTeam(t *testing.T, rctx request.CTX, ss store.St }) t.Run("get team 1, offset 0, limit 1", func(t *testing.T) { - result, err := ss.User().GetNewUsersForTeam(teamId, 0, 1, nil) + result, err := ss.User().GetNewUsersForTeam(teamID, 0, 1, nil) require.NoError(t, err) assert.Equal(t, []*model.User{ sanitized(u3), @@ -2706,7 +2706,7 @@ func testUserStoreGetNewUsersForTeam(t *testing.T, rctx request.CTX, ss store.St }) t.Run("get team 1, offset 2, limit 1", func(t *testing.T) { - result, err := ss.User().GetNewUsersForTeam(teamId, 2, 1, nil) + result, err := ss.User().GetNewUsersForTeam(teamID, 2, 1, nil) require.NoError(t, err) assert.Equal(t, []*model.User{ sanitized(u1), @@ -2714,7 +2714,7 @@ func testUserStoreGetNewUsersForTeam(t *testing.T, rctx request.CTX, ss store.St }) t.Run("get team 2, offset 0, limit 100", func(t *testing.T) { - result, err := ss.User().GetNewUsersForTeam(teamId2, 0, 100, nil) + result, err := ss.User().GetNewUsersForTeam(teamID2, 0, 100, nil) require.NoError(t, err) assert.Equal(t, []*model.User{ sanitized(u4), @@ -2740,11 +2740,11 @@ func assertUsers(t *testing.T, expected, actual []*model.User) { func testUserStoreSearch(t *testing.T, rctx request.CTX, ss store.Store) { u1 := &model.User{ - Username: "jimbo1" + NewTestId(), + Username: "jimbo1" + NewTestID(), FirstName: "Tim", LastName: "Bill", Nickname: "Rob", - Email: "harold" + NewTestId() + "@simulator.amazonses.com", + Email: "harold" + NewTestID() + "@simulator.amazonses.com", Roles: "system_user system_admin", } _, err := ss.User().Save(rctx, u1) @@ -2752,7 +2752,7 @@ func testUserStoreSearch(t *testing.T, rctx request.CTX, ss store.Store) { defer func() { require.NoError(t, ss.User().PermanentDelete(rctx, u1.Id)) }() u2 := &model.User{ - Username: "jim2-bobby" + NewTestId(), + Username: "jim2-bobby" + NewTestID(), Email: MakeEmail(), Roles: "system_user system_user_manager", } @@ -2761,7 +2761,7 @@ func testUserStoreSearch(t *testing.T, rctx request.CTX, ss store.Store) { defer func() { require.NoError(t, ss.User().PermanentDelete(rctx, u2.Id)) }() u3 := &model.User{ - Username: "jimbo3" + NewTestId(), + Username: "jimbo3" + NewTestID(), Email: MakeEmail(), Roles: "system_guest", } @@ -2786,7 +2786,7 @@ func testUserStoreSearch(t *testing.T, rctx request.CTX, ss store.Store) { testCases := []struct { Description string - TeamId string + TeamID string Term string Options *model.UserSearchOptions Expected []*model.User @@ -2900,7 +2900,7 @@ func testUserStoreSearch(t *testing.T, rctx request.CTX, ss store.Store) { t.Run(testCase.Description, func(t *testing.T) { users, err := ss.User().Search( rctx, - testCase.TeamId, + testCase.TeamID, testCase.Term, testCase.Options, ) @@ -2912,18 +2912,18 @@ func testUserStoreSearch(t *testing.T, rctx request.CTX, ss store.Store) { func testUserStoreSearchNotInChannel(t *testing.T, rctx request.CTX, ss store.Store) { u1 := &model.User{ - Username: "jimbo1" + NewTestId(), + Username: "jimbo1" + NewTestID(), FirstName: "Tim", LastName: "Bill", Nickname: "Rob", - Email: "harold" + NewTestId() + "@simulator.amazonses.com", + Email: "harold" + NewTestID() + "@simulator.amazonses.com", } _, err := ss.User().Save(rctx, u1) require.NoError(t, err) defer func() { require.NoError(t, ss.User().PermanentDelete(rctx, u1.Id)) }() u2 := &model.User{ - Username: "jim2-bobby" + NewTestId(), + Username: "jim2-bobby" + NewTestID(), Email: MakeEmail(), } _, err = ss.User().Save(rctx, u2) @@ -2931,7 +2931,7 @@ func testUserStoreSearchNotInChannel(t *testing.T, rctx request.CTX, ss store.St defer func() { require.NoError(t, ss.User().PermanentDelete(rctx, u2.Id)) }() u3 := &model.User{ - Username: "jimbo3" + NewTestId(), + Username: "jimbo3" + NewTestID(), Email: MakeEmail(), DeleteAt: 1, } @@ -2966,7 +2966,7 @@ func testUserStoreSearchNotInChannel(t *testing.T, rctx request.CTX, ss store.St ch1 := model.Channel{ TeamId: tid, DisplayName: "NameName", - Name: NewTestId(), + Name: NewTestID(), Type: model.ChannelTypeOpen, } c1, nErr := ss.Channel().Save(rctx, &ch1, -1) @@ -2975,7 +2975,7 @@ func testUserStoreSearchNotInChannel(t *testing.T, rctx request.CTX, ss store.St ch2 := model.Channel{ TeamId: tid, DisplayName: "NameName", - Name: NewTestId(), + Name: NewTestID(), Type: model.ChannelTypeOpen, } c2, nErr := ss.Channel().Save(rctx, &ch2, -1) @@ -3002,8 +3002,8 @@ func testUserStoreSearchNotInChannel(t *testing.T, rctx request.CTX, ss store.St testCases := []struct { Description string - TeamId string - ChannelId string + TeamID string + ChannelID string Term string Options *model.UserSearchOptions Expected []*model.User @@ -3125,8 +3125,8 @@ func testUserStoreSearchNotInChannel(t *testing.T, rctx request.CTX, ss store.St for _, testCase := range testCases { t.Run(testCase.Description, func(t *testing.T) { users, err := ss.User().SearchNotInChannel( - testCase.TeamId, - testCase.ChannelId, + testCase.TeamID, + testCase.ChannelID, testCase.Term, testCase.Options, ) @@ -3138,11 +3138,11 @@ func testUserStoreSearchNotInChannel(t *testing.T, rctx request.CTX, ss store.St func testUserStoreSearchInChannel(t *testing.T, rctx request.CTX, ss store.Store) { u1 := &model.User{ - Username: "jimbo1" + NewTestId(), + Username: "jimbo1" + NewTestID(), FirstName: "Tim", LastName: "Bill", Nickname: "Rob", - Email: "harold" + NewTestId() + "@simulator.amazonses.com", + Email: "harold" + NewTestID() + "@simulator.amazonses.com", Roles: "system_user system_admin", } _, err := ss.User().Save(rctx, u1) @@ -3150,7 +3150,7 @@ func testUserStoreSearchInChannel(t *testing.T, rctx request.CTX, ss store.Store defer func() { require.NoError(t, ss.User().PermanentDelete(rctx, u1.Id)) }() u2 := &model.User{ - Username: "jim-bobby" + NewTestId(), + Username: "jim-bobby" + NewTestID(), Email: MakeEmail(), Roles: "system_user", } @@ -3159,7 +3159,7 @@ func testUserStoreSearchInChannel(t *testing.T, rctx request.CTX, ss store.Store defer func() { require.NoError(t, ss.User().PermanentDelete(rctx, u2.Id)) }() u3 := &model.User{ - Username: "jimbo3" + NewTestId(), + Username: "jimbo3" + NewTestID(), Email: MakeEmail(), DeleteAt: 1, Roles: "system_user", @@ -3195,7 +3195,7 @@ func testUserStoreSearchInChannel(t *testing.T, rctx request.CTX, ss store.Store ch1 := model.Channel{ TeamId: tid, DisplayName: "NameName", - Name: NewTestId(), + Name: NewTestID(), Type: model.ChannelTypeOpen, } c1, nErr := ss.Channel().Save(rctx, &ch1, -1) @@ -3204,7 +3204,7 @@ func testUserStoreSearchInChannel(t *testing.T, rctx request.CTX, ss store.Store ch2 := model.Channel{ TeamId: tid, DisplayName: "NameName", - Name: NewTestId(), + Name: NewTestID(), Type: model.ChannelTypeOpen, } c2, nErr := ss.Channel().Save(rctx, &ch2, -1) @@ -3237,7 +3237,7 @@ func testUserStoreSearchInChannel(t *testing.T, rctx request.CTX, ss store.Store testCases := []struct { Description string - ChannelId string + ChannelID string Term string Options *model.UserSearchOptions Expected []*model.User @@ -3360,7 +3360,7 @@ func testUserStoreSearchInChannel(t *testing.T, rctx request.CTX, ss store.Store for _, testCase := range testCases { t.Run(testCase.Description, func(t *testing.T) { users, err := ss.User().SearchInChannel( - testCase.ChannelId, + testCase.ChannelID, testCase.Term, testCase.Options, ) @@ -3372,18 +3372,18 @@ func testUserStoreSearchInChannel(t *testing.T, rctx request.CTX, ss store.Store func testUserStoreSearchNotInTeam(t *testing.T, rctx request.CTX, ss store.Store) { u1 := &model.User{ - Username: "jimbo1" + NewTestId(), + Username: "jimbo1" + NewTestID(), FirstName: "Tim", LastName: "Bill", Nickname: "Rob", - Email: "harold" + NewTestId() + "@simulator.amazonses.com", + Email: "harold" + NewTestID() + "@simulator.amazonses.com", } _, err := ss.User().Save(rctx, u1) require.NoError(t, err) defer func() { require.NoError(t, ss.User().PermanentDelete(rctx, u1.Id)) }() u2 := &model.User{ - Username: "jim-bobby" + NewTestId(), + Username: "jim-bobby" + NewTestID(), Email: MakeEmail(), } _, err = ss.User().Save(rctx, u2) @@ -3391,7 +3391,7 @@ func testUserStoreSearchNotInTeam(t *testing.T, rctx request.CTX, ss store.Store defer func() { require.NoError(t, ss.User().PermanentDelete(rctx, u2.Id)) }() u3 := &model.User{ - Username: "jimbo3" + NewTestId(), + Username: "jimbo3" + NewTestID(), Email: MakeEmail(), DeleteAt: 1, } @@ -3408,7 +3408,7 @@ func testUserStoreSearchNotInTeam(t *testing.T, rctx request.CTX, ss store.Store defer func() { require.NoError(t, ss.Bot().PermanentDelete(u3.Id)) }() u4 := &model.User{ - Username: "simon" + NewTestId(), + Username: "simon" + NewTestID(), Email: MakeEmail(), DeleteAt: 0, } @@ -3417,7 +3417,7 @@ func testUserStoreSearchNotInTeam(t *testing.T, rctx request.CTX, ss store.Store defer func() { require.NoError(t, ss.User().PermanentDelete(rctx, u4.Id)) }() u5 := &model.User{ - Username: "yu" + NewTestId(), + Username: "yu" + NewTestID(), FirstName: "En", LastName: "Yu", Nickname: "enyu", @@ -3428,7 +3428,7 @@ func testUserStoreSearchNotInTeam(t *testing.T, rctx request.CTX, ss store.Store defer func() { require.NoError(t, ss.User().PermanentDelete(rctx, u5.Id)) }() u6 := &model.User{ - Username: "underscore" + NewTestId(), + Username: "underscore" + NewTestID(), FirstName: "Du_", LastName: "_DE", Nickname: "lodash", @@ -3438,21 +3438,21 @@ func testUserStoreSearchNotInTeam(t *testing.T, rctx request.CTX, ss store.Store require.NoError(t, err) defer func() { require.NoError(t, ss.User().PermanentDelete(rctx, u6.Id)) }() - teamId1 := model.NewId() - _, nErr = ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamId1, UserId: u1.Id}, -1) + teamID1 := model.NewId() + _, nErr = ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamID1, UserId: u1.Id}, -1) require.NoError(t, nErr) - _, nErr = ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamId1, UserId: u2.Id}, -1) + _, nErr = ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamID1, UserId: u2.Id}, -1) require.NoError(t, nErr) - _, nErr = ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamId1, UserId: u3.Id}, -1) + _, nErr = ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamID1, UserId: u3.Id}, -1) require.NoError(t, nErr) // u4 is not in team 1 - _, nErr = ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamId1, UserId: u5.Id}, -1) + _, nErr = ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamID1, UserId: u5.Id}, -1) require.NoError(t, nErr) - _, nErr = ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamId1, UserId: u6.Id}, -1) + _, nErr = ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamID1, UserId: u6.Id}, -1) require.NoError(t, nErr) - teamId2 := model.NewId() - _, nErr = ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamId2, UserId: u4.Id}, -1) + teamID2 := model.NewId() + _, nErr = ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamID2, UserId: u4.Id}, -1) require.NoError(t, nErr) // The users returned from the database will have AuthData as an empty string. @@ -3468,14 +3468,14 @@ func testUserStoreSearchNotInTeam(t *testing.T, rctx request.CTX, ss store.Store testCases := []struct { Description string - TeamId string + TeamID string Term string Options *model.UserSearchOptions Expected []*model.User }{ { "search simo, team 1", - teamId1, + teamID1, "simo", &model.UserSearchOptions{ AllowFullNames: true, @@ -3486,7 +3486,7 @@ func testUserStoreSearchNotInTeam(t *testing.T, rctx request.CTX, ss store.Store { "search jimb, team 1", - teamId1, + teamID1, "jimb", &model.UserSearchOptions{ AllowFullNames: true, @@ -3496,7 +3496,7 @@ func testUserStoreSearchNotInTeam(t *testing.T, rctx request.CTX, ss store.Store }, { "search jimb, allow inactive, team 1", - teamId1, + teamID1, "jimb", &model.UserSearchOptions{ AllowFullNames: true, @@ -3507,7 +3507,7 @@ func testUserStoreSearchNotInTeam(t *testing.T, rctx request.CTX, ss store.Store }, { "search simo, team 2", - teamId2, + teamID2, "simo", &model.UserSearchOptions{ AllowFullNames: true, @@ -3517,7 +3517,7 @@ func testUserStoreSearchNotInTeam(t *testing.T, rctx request.CTX, ss store.Store }, { "search jimb, team2", - teamId2, + teamID2, "jimb", &model.UserSearchOptions{ AllowFullNames: true, @@ -3527,7 +3527,7 @@ func testUserStoreSearchNotInTeam(t *testing.T, rctx request.CTX, ss store.Store }, { "search jimb, allow inactive, team 2", - teamId2, + teamID2, "jimb", &model.UserSearchOptions{ AllowFullNames: true, @@ -3538,7 +3538,7 @@ func testUserStoreSearchNotInTeam(t *testing.T, rctx request.CTX, ss store.Store }, { "search jimb, allow inactive, team 2, limit 1", - teamId2, + teamID2, "jimb", &model.UserSearchOptions{ AllowFullNames: true, @@ -3552,7 +3552,7 @@ func testUserStoreSearchNotInTeam(t *testing.T, rctx request.CTX, ss store.Store for _, testCase := range testCases { t.Run(testCase.Description, func(t *testing.T) { users, err := ss.User().SearchNotInTeam( - testCase.TeamId, + testCase.TeamID, testCase.Term, testCase.Options, ) @@ -3564,18 +3564,18 @@ func testUserStoreSearchNotInTeam(t *testing.T, rctx request.CTX, ss store.Store func testUserStoreSearchWithoutTeam(t *testing.T, rctx request.CTX, ss store.Store) { u1 := &model.User{ - Username: "jimbo1" + NewTestId(), + Username: "jimbo1" + NewTestID(), FirstName: "Tim", LastName: "Bill", Nickname: "Rob", - Email: "harold" + NewTestId() + "@simulator.amazonses.com", + Email: "harold" + NewTestID() + "@simulator.amazonses.com", } _, err := ss.User().Save(rctx, u1) require.NoError(t, err) defer func() { require.NoError(t, ss.User().PermanentDelete(rctx, u1.Id)) }() u2 := &model.User{ - Username: "jim2-bobby" + NewTestId(), + Username: "jim2-bobby" + NewTestID(), Email: MakeEmail(), } _, err = ss.User().Save(rctx, u2) @@ -3583,7 +3583,7 @@ func testUserStoreSearchWithoutTeam(t *testing.T, rctx request.CTX, ss store.Sto defer func() { require.NoError(t, ss.User().PermanentDelete(rctx, u2.Id)) }() u3 := &model.User{ - Username: "jimbo3" + NewTestId(), + Username: "jimbo3" + NewTestID(), Email: MakeEmail(), DeleteAt: 1, } @@ -3669,18 +3669,18 @@ func testUserStoreSearchWithoutTeam(t *testing.T, rctx request.CTX, ss store.Sto func testUserStoreSearchInGroup(t *testing.T, rctx request.CTX, ss store.Store) { u1 := &model.User{ - Username: "jimbo1" + NewTestId(), + Username: "jimbo1" + NewTestID(), FirstName: "Tim", LastName: "Bill", Nickname: "Rob", - Email: "harold" + NewTestId() + "@simulator.amazonses.com", + Email: "harold" + NewTestID() + "@simulator.amazonses.com", } _, err := ss.User().Save(rctx, u1) require.NoError(t, err) defer func() { require.NoError(t, ss.User().PermanentDelete(rctx, u1.Id)) }() u2 := &model.User{ - Username: "jim-bobby" + NewTestId(), + Username: "jim-bobby" + NewTestID(), Email: MakeEmail(), } _, err = ss.User().Save(rctx, u2) @@ -3688,7 +3688,7 @@ func testUserStoreSearchInGroup(t *testing.T, rctx request.CTX, ss store.Store) defer func() { require.NoError(t, ss.User().PermanentDelete(rctx, u2.Id)) }() u3 := &model.User{ - Username: "jimbo3" + NewTestId(), + Username: "jimbo3" + NewTestID(), Email: MakeEmail(), } _, err = ss.User().Save(rctx, u3) @@ -3703,21 +3703,21 @@ func testUserStoreSearchInGroup(t *testing.T, rctx request.CTX, ss store.Store) u3.AuthData = nilAuthData g1 := &model.Group{ - Name: model.NewPointer(NewTestId()), - DisplayName: NewTestId(), - Description: NewTestId(), + Name: model.NewPointer(NewTestID()), + DisplayName: NewTestID(), + Description: NewTestID(), Source: model.GroupSourceLdap, - RemoteId: model.NewPointer(NewTestId()), + RemoteId: model.NewPointer(NewTestID()), } _, err = ss.Group().Create(g1) require.NoError(t, err) g2 := &model.Group{ - Name: model.NewPointer(NewTestId()), - DisplayName: NewTestId(), - Description: NewTestId(), + Name: model.NewPointer(NewTestID()), + DisplayName: NewTestID(), + Description: NewTestID(), Source: model.GroupSourceLdap, - RemoteId: model.NewPointer(NewTestId()), + RemoteId: model.NewPointer(NewTestID()), } _, err = ss.Group().Create(g2) require.NoError(t, err) @@ -3737,7 +3737,7 @@ func testUserStoreSearchInGroup(t *testing.T, rctx request.CTX, ss store.Store) testCases := []struct { Description string - GroupId string + GroupID string Term string Options *model.UserSearchOptions Expected []*model.User @@ -3800,7 +3800,7 @@ func testUserStoreSearchInGroup(t *testing.T, rctx request.CTX, ss store.Store) for _, testCase := range testCases { t.Run(testCase.Description, func(t *testing.T) { users, err := ss.User().SearchInGroup( - testCase.GroupId, + testCase.GroupID, testCase.Term, testCase.Options, ) @@ -3812,18 +3812,18 @@ func testUserStoreSearchInGroup(t *testing.T, rctx request.CTX, ss store.Store) func testUserStoreSearchNotInGroup(t *testing.T, rctx request.CTX, ss store.Store) { u1 := &model.User{ - Username: "jimbo1" + NewTestId(), + Username: "jimbo1" + NewTestID(), FirstName: "Tim", LastName: "Bill", Nickname: "Rob", - Email: "harold" + NewTestId() + "@simulator.amazonses.com", + Email: "harold" + NewTestID() + "@simulator.amazonses.com", } _, err := ss.User().Save(rctx, u1) require.NoError(t, err) defer func() { require.NoError(t, ss.User().PermanentDelete(rctx, u1.Id)) }() u2 := &model.User{ - Username: "jim-bobby" + NewTestId(), + Username: "jim-bobby" + NewTestID(), Email: MakeEmail(), } _, err = ss.User().Save(rctx, u2) @@ -3831,7 +3831,7 @@ func testUserStoreSearchNotInGroup(t *testing.T, rctx request.CTX, ss store.Stor defer func() { require.NoError(t, ss.User().PermanentDelete(rctx, u2.Id)) }() u3 := &model.User{ - Username: "jimbo3" + NewTestId(), + Username: "jimbo3" + NewTestID(), Email: MakeEmail(), } _, err = ss.User().Save(rctx, u3) @@ -3846,21 +3846,21 @@ func testUserStoreSearchNotInGroup(t *testing.T, rctx request.CTX, ss store.Stor u3.AuthData = nilAuthData g1 := &model.Group{ - Name: model.NewPointer(NewTestId()), - DisplayName: NewTestId(), - Description: NewTestId(), + Name: model.NewPointer(NewTestID()), + DisplayName: NewTestID(), + Description: NewTestID(), Source: model.GroupSourceCustom, - RemoteId: model.NewPointer(NewTestId()), + RemoteId: model.NewPointer(NewTestID()), } _, err = ss.Group().Create(g1) require.NoError(t, err) g2 := &model.Group{ - Name: model.NewPointer(NewTestId()), - DisplayName: NewTestId(), - Description: NewTestId(), + Name: model.NewPointer(NewTestID()), + DisplayName: NewTestID(), + Description: NewTestID(), Source: model.GroupSourceCustom, - RemoteId: model.NewPointer(NewTestId()), + RemoteId: model.NewPointer(NewTestID()), } _, err = ss.Group().Create(g2) require.NoError(t, err) @@ -3880,7 +3880,7 @@ func testUserStoreSearchNotInGroup(t *testing.T, rctx request.CTX, ss store.Stor testCases := []struct { Description string - GroupId string + GroupID string Term string Options *model.UserSearchOptions Expected []*model.User @@ -3932,7 +3932,7 @@ func testUserStoreSearchNotInGroup(t *testing.T, rctx request.CTX, ss store.Stor for _, testCase := range testCases { t.Run(testCase.Description, func(t *testing.T) { users, err := ss.User().SearchNotInGroup( - testCase.GroupId, + testCase.GroupID, testCase.Term, testCase.Options, ) @@ -3944,17 +3944,17 @@ func testUserStoreSearchNotInGroup(t *testing.T, rctx request.CTX, ss store.Stor func testCount(t *testing.T, rctx request.CTX, ss store.Store) { // Regular - teamId := model.NewId() - channelId := model.NewId() + teamID := model.NewId() + channelID := model.NewId() regularUser := &model.User{} regularUser.Email = MakeEmail() regularUser.Roles = model.SystemUserRoleId _, err := ss.User().Save(rctx, regularUser) require.NoError(t, err) defer func() { require.NoError(t, ss.User().PermanentDelete(rctx, regularUser.Id)) }() - _, nErr := ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamId, UserId: regularUser.Id, SchemeAdmin: false, SchemeUser: true}, -1) + _, nErr := ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamID, UserId: regularUser.Id, SchemeAdmin: false, SchemeUser: true}, -1) require.NoError(t, nErr) - _, nErr = ss.Channel().SaveMember(rctx, &model.ChannelMember{UserId: regularUser.Id, ChannelId: channelId, SchemeAdmin: false, SchemeUser: true, NotifyProps: model.GetDefaultChannelNotifyProps()}) + _, nErr = ss.Channel().SaveMember(rctx, &model.ChannelMember{UserId: regularUser.Id, ChannelId: channelID, SchemeAdmin: false, SchemeUser: true, NotifyProps: model.GetDefaultChannelNotifyProps()}) require.NoError(t, nErr) guestUser := &model.User{} @@ -3963,9 +3963,9 @@ func testCount(t *testing.T, rctx request.CTX, ss store.Store) { _, err = ss.User().Save(rctx, guestUser) require.NoError(t, err) defer func() { require.NoError(t, ss.User().PermanentDelete(rctx, guestUser.Id)) }() - _, nErr = ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamId, UserId: guestUser.Id, SchemeAdmin: false, SchemeUser: false, SchemeGuest: true}, -1) + _, nErr = ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamID, UserId: guestUser.Id, SchemeAdmin: false, SchemeUser: false, SchemeGuest: true}, -1) require.NoError(t, nErr) - _, nErr = ss.Channel().SaveMember(rctx, &model.ChannelMember{UserId: guestUser.Id, ChannelId: channelId, SchemeAdmin: false, SchemeUser: false, SchemeGuest: true, NotifyProps: model.GetDefaultChannelNotifyProps()}) + _, nErr = ss.Channel().SaveMember(rctx, &model.ChannelMember{UserId: guestUser.Id, ChannelId: channelID, SchemeAdmin: false, SchemeUser: false, SchemeGuest: true, NotifyProps: model.GetDefaultChannelNotifyProps()}) require.NoError(t, nErr) teamAdmin := &model.User{} @@ -3974,9 +3974,9 @@ func testCount(t *testing.T, rctx request.CTX, ss store.Store) { _, err = ss.User().Save(rctx, teamAdmin) require.NoError(t, err) defer func() { require.NoError(t, ss.User().PermanentDelete(rctx, teamAdmin.Id)) }() - _, nErr = ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamId, UserId: teamAdmin.Id, SchemeAdmin: true, SchemeUser: true}, -1) + _, nErr = ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamID, UserId: teamAdmin.Id, SchemeAdmin: true, SchemeUser: true}, -1) require.NoError(t, nErr) - _, nErr = ss.Channel().SaveMember(rctx, &model.ChannelMember{UserId: teamAdmin.Id, ChannelId: channelId, SchemeAdmin: true, SchemeUser: true, NotifyProps: model.GetDefaultChannelNotifyProps()}) + _, nErr = ss.Channel().SaveMember(rctx, &model.ChannelMember{UserId: teamAdmin.Id, ChannelId: channelID, SchemeAdmin: true, SchemeUser: true, NotifyProps: model.GetDefaultChannelNotifyProps()}) require.NoError(t, nErr) sysAdmin := &model.User{} @@ -3985,9 +3985,9 @@ func testCount(t *testing.T, rctx request.CTX, ss store.Store) { _, err = ss.User().Save(rctx, sysAdmin) require.NoError(t, err) defer func() { require.NoError(t, ss.User().PermanentDelete(rctx, sysAdmin.Id)) }() - _, nErr = ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamId, UserId: sysAdmin.Id, SchemeAdmin: false, SchemeUser: true}, -1) + _, nErr = ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamID, UserId: sysAdmin.Id, SchemeAdmin: false, SchemeUser: true}, -1) require.NoError(t, nErr) - _, nErr = ss.Channel().SaveMember(rctx, &model.ChannelMember{UserId: sysAdmin.Id, ChannelId: channelId, SchemeAdmin: true, SchemeUser: true, NotifyProps: model.GetDefaultChannelNotifyProps()}) + _, nErr = ss.Channel().SaveMember(rctx, &model.ChannelMember{UserId: sysAdmin.Id, ChannelId: channelID, SchemeAdmin: true, SchemeUser: true, NotifyProps: model.GetDefaultChannelNotifyProps()}) require.NoError(t, nErr) // Deleted @@ -3999,10 +3999,10 @@ func testCount(t *testing.T, rctx request.CTX, ss store.Store) { defer func() { require.NoError(t, ss.User().PermanentDelete(rctx, deletedUser.Id)) }() // Remote User - remoteId := "remote-id" + remoteID := "remote-id" remoteUser, err := ss.User().Save(rctx, &model.User{ Email: MakeEmail(), - RemoteId: &remoteId, + RemoteId: &remoteID, }) require.NoError(t, err) defer func() { require.NoError(t, ss.User().PermanentDelete(rctx, remoteUser.Id)) }() @@ -4078,7 +4078,7 @@ func testCount(t *testing.T, rctx request.CTX, ss store.Store) { model.UserCountOptions{ IncludeBotAccounts: true, IncludeDeleted: true, - TeamId: teamId, + TeamId: teamID, }, 4, }, @@ -4096,8 +4096,8 @@ func testCount(t *testing.T, rctx request.CTX, ss store.Store) { model.UserCountOptions{ IncludeBotAccounts: true, IncludeDeleted: true, - TeamId: teamId, - ViewRestrictions: &model.ViewUsersRestrictions{Teams: []string{teamId}}, + TeamId: teamID, + ViewRestrictions: &model.ViewUsersRestrictions{Teams: []string{teamID}}, }, 4, }, @@ -4106,7 +4106,7 @@ func testCount(t *testing.T, rctx request.CTX, ss store.Store) { model.UserCountOptions{ IncludeBotAccounts: true, IncludeDeleted: true, - TeamId: teamId, + TeamId: teamID, ViewRestrictions: &model.ViewUsersRestrictions{Teams: []string{model.NewId()}}, }, 0, @@ -4143,7 +4143,7 @@ func testCount(t *testing.T, rctx request.CTX, ss store.Store) { model.UserCountOptions{ IncludeRemoteUsers: true, IncludeDeleted: true, - TeamId: teamId, + TeamId: teamID, }, 4, }, @@ -4161,8 +4161,8 @@ func testCount(t *testing.T, rctx request.CTX, ss store.Store) { model.UserCountOptions{ IncludeRemoteUsers: true, IncludeDeleted: true, - TeamId: teamId, - ViewRestrictions: &model.ViewUsersRestrictions{Teams: []string{teamId}}, + TeamId: teamID, + ViewRestrictions: &model.ViewUsersRestrictions{Teams: []string{teamID}}, }, 4, }, @@ -4171,7 +4171,7 @@ func testCount(t *testing.T, rctx request.CTX, ss store.Store) { model.UserCountOptions{ IncludeRemoteUsers: true, IncludeDeleted: true, - TeamId: teamId, + TeamId: teamID, ViewRestrictions: &model.ViewUsersRestrictions{Teams: []string{model.NewId()}}, }, 0, @@ -4179,7 +4179,7 @@ func testCount(t *testing.T, rctx request.CTX, ss store.Store) { { "Filter by system admins only", model.UserCountOptions{ - TeamId: teamId, + TeamId: teamID, Roles: []string{model.SystemAdminRoleId}, }, 1, @@ -4187,7 +4187,7 @@ func testCount(t *testing.T, rctx request.CTX, ss store.Store) { { "Filter by system users only", model.UserCountOptions{ - TeamId: teamId, + TeamId: teamID, Roles: []string{model.SystemUserRoleId}, }, 2, @@ -4195,7 +4195,7 @@ func testCount(t *testing.T, rctx request.CTX, ss store.Store) { { "Filter by system guests only", model.UserCountOptions{ - TeamId: teamId, + TeamId: teamID, Roles: []string{model.SystemGuestRoleId}, }, 1, @@ -4203,7 +4203,7 @@ func testCount(t *testing.T, rctx request.CTX, ss store.Store) { { "Filter by system admins and system users", model.UserCountOptions{ - TeamId: teamId, + TeamId: teamID, Roles: []string{model.SystemAdminRoleId, model.SystemUserRoleId}, }, 3, @@ -4211,7 +4211,7 @@ func testCount(t *testing.T, rctx request.CTX, ss store.Store) { { "Filter by system admins, system user and system guests", model.UserCountOptions{ - TeamId: teamId, + TeamId: teamID, Roles: []string{model.SystemAdminRoleId, model.SystemUserRoleId, model.SystemGuestRoleId}, }, 4, @@ -4219,7 +4219,7 @@ func testCount(t *testing.T, rctx request.CTX, ss store.Store) { { "Filter by team admins", model.UserCountOptions{ - TeamId: teamId, + TeamId: teamID, TeamRoles: []string{model.TeamAdminRoleId}, }, 1, @@ -4227,7 +4227,7 @@ func testCount(t *testing.T, rctx request.CTX, ss store.Store) { { "Filter by team members", model.UserCountOptions{ - TeamId: teamId, + TeamId: teamID, TeamRoles: []string{model.TeamUserRoleId}, }, 1, @@ -4235,7 +4235,7 @@ func testCount(t *testing.T, rctx request.CTX, ss store.Store) { { "Filter by team guests", model.UserCountOptions{ - TeamId: teamId, + TeamId: teamID, TeamRoles: []string{model.TeamGuestRoleId}, }, 1, @@ -4243,7 +4243,7 @@ func testCount(t *testing.T, rctx request.CTX, ss store.Store) { { "Filter by team guests and any system role", model.UserCountOptions{ - TeamId: teamId, + TeamId: teamID, TeamRoles: []string{model.TeamGuestRoleId}, Roles: []string{model.SystemAdminRoleId}, }, @@ -4252,7 +4252,7 @@ func testCount(t *testing.T, rctx request.CTX, ss store.Store) { { "Filter by channel members", model.UserCountOptions{ - ChannelId: channelId, + ChannelId: channelID, ChannelRoles: []string{model.ChannelUserRoleId}, }, 1, @@ -4260,7 +4260,7 @@ func testCount(t *testing.T, rctx request.CTX, ss store.Store) { { "Filter by channel members and system admins", model.UserCountOptions{ - ChannelId: channelId, + ChannelId: channelID, Roles: []string{model.SystemAdminRoleId}, ChannelRoles: []string{model.ChannelUserRoleId}, }, @@ -4269,7 +4269,7 @@ func testCount(t *testing.T, rctx request.CTX, ss store.Store) { { "Filter by channel members and system admins and channel admins", model.UserCountOptions{ - ChannelId: channelId, + ChannelId: channelID, Roles: []string{model.SystemAdminRoleId}, ChannelRoles: []string{model.ChannelUserRoleId, model.ChannelAdminRoleId}, }, @@ -4278,7 +4278,7 @@ func testCount(t *testing.T, rctx request.CTX, ss store.Store) { { "Filter by channel guests", model.UserCountOptions{ - ChannelId: channelId, + ChannelId: channelID, ChannelRoles: []string{model.ChannelGuestRoleId}, }, 1, @@ -4286,7 +4286,7 @@ func testCount(t *testing.T, rctx request.CTX, ss store.Store) { { "Filter by channel guests and any system role", model.UserCountOptions{ - ChannelId: channelId, + ChannelId: channelID, ChannelRoles: []string{model.ChannelGuestRoleId}, Roles: []string{model.SystemAdminRoleId}, }, @@ -4628,13 +4628,13 @@ func testUserStoreAnalyticsGetExternalUsers(t *testing.T, rctx request.CTX, ss s func testUserStoreGetProfilesNotInTeam(t *testing.T, rctx request.CTX, ss store.Store) { team, err := ss.Team().Save(&model.Team{ DisplayName: "Team", - Name: NewTestId(), + Name: NewTestID(), Type: model.TeamOpen, }) require.NoError(t, err) - teamId := team.Id - teamId2 := model.NewId() + teamID := team.Id + teamID2 := model.NewId() u1, err := ss.User().Save(rctx, &model.User{ Email: MakeEmail(), @@ -4642,7 +4642,7 @@ func testUserStoreGetProfilesNotInTeam(t *testing.T, rctx request.CTX, ss store. }) require.NoError(t, err) defer func() { require.NoError(t, ss.User().PermanentDelete(rctx, u1.Id)) }() - _, nErr := ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamId, UserId: u1.Id}, -1) + _, nErr := ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamID, UserId: u1.Id}, -1) require.NoError(t, nErr) // Ensure update at timestamp changes @@ -4654,7 +4654,7 @@ func testUserStoreGetProfilesNotInTeam(t *testing.T, rctx request.CTX, ss store. }) require.NoError(t, err) defer func() { require.NoError(t, ss.User().PermanentDelete(rctx, u2.Id)) }() - _, nErr = ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamId2, UserId: u2.Id}, -1) + _, nErr = ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamID2, UserId: u2.Id}, -1) require.NoError(t, nErr) // Ensure update at timestamp changes @@ -4678,11 +4678,11 @@ func testUserStoreGetProfilesNotInTeam(t *testing.T, rctx request.CTX, ss store. var etag1, etag2, etag3 string t.Run("etag for profiles not in team 1", func(t *testing.T) { - etag1 = ss.User().GetEtagForProfilesNotInTeam(teamId) + etag1 = ss.User().GetEtagForProfilesNotInTeam(teamID) }) t.Run("get not in team 1, offset 0, limit 100000", func(t *testing.T) { - users, userErr := ss.User().GetProfilesNotInTeam(teamId, false, 0, 100000, nil) + users, userErr := ss.User().GetProfilesNotInTeam(teamID, false, 0, 100000, nil) require.NoError(t, userErr) assert.Equal(t, []*model.User{ sanitized(u2), @@ -4691,7 +4691,7 @@ func testUserStoreGetProfilesNotInTeam(t *testing.T, rctx request.CTX, ss store. }) t.Run("get not in team 1, offset 1, limit 1", func(t *testing.T) { - users, userErr := ss.User().GetProfilesNotInTeam(teamId, false, 1, 1, nil) + users, userErr := ss.User().GetProfilesNotInTeam(teamID, false, 1, 1, nil) require.NoError(t, userErr) assert.Equal(t, []*model.User{ sanitized(u3), @@ -4699,7 +4699,7 @@ func testUserStoreGetProfilesNotInTeam(t *testing.T, rctx request.CTX, ss store. }) t.Run("get not in team 2, offset 0, limit 100", func(t *testing.T) { - users, userErr := ss.User().GetProfilesNotInTeam(teamId2, false, 0, 100, nil) + users, userErr := ss.User().GetProfilesNotInTeam(teamID2, false, 0, 100, nil) require.NoError(t, userErr) assert.Equal(t, []*model.User{ sanitized(u1), @@ -4711,18 +4711,18 @@ func testUserStoreGetProfilesNotInTeam(t *testing.T, rctx request.CTX, ss store. time.Sleep(time.Millisecond) // Add u2 to team 1 - _, nErr = ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamId, UserId: u2.Id}, -1) + _, nErr = ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamID, UserId: u2.Id}, -1) require.NoError(t, nErr) u2.UpdateAt, err = ss.User().UpdateUpdateAt(u2.Id) require.NoError(t, err) t.Run("etag for profiles not in team 1 after update", func(t *testing.T) { - etag2 = ss.User().GetEtagForProfilesNotInTeam(teamId) + etag2 = ss.User().GetEtagForProfilesNotInTeam(teamID) require.NotEqual(t, etag2, etag1, "etag should have changed") }) t.Run("get not in team 1, offset 0, limit 100000 after update", func(t *testing.T) { - users, userErr := ss.User().GetProfilesNotInTeam(teamId, false, 0, 100000, nil) + users, userErr := ss.User().GetProfilesNotInTeam(teamID, false, 0, 100000, nil) require.NoError(t, userErr) assert.Equal(t, []*model.User{ sanitized(u3), @@ -4732,9 +4732,9 @@ func testUserStoreGetProfilesNotInTeam(t *testing.T, rctx request.CTX, ss store. // Ensure update at timestamp changes time.Sleep(time.Millisecond) - e := ss.Team().RemoveMember(rctx, teamId, u1.Id) + e := ss.Team().RemoveMember(rctx, teamID, u1.Id) require.NoError(t, e) - e = ss.Team().RemoveMember(rctx, teamId, u2.Id) + e = ss.Team().RemoveMember(rctx, teamID, u2.Id) require.NoError(t, e) u1.UpdateAt, err = ss.User().UpdateUpdateAt(u1.Id) @@ -4743,13 +4743,13 @@ func testUserStoreGetProfilesNotInTeam(t *testing.T, rctx request.CTX, ss store. require.NoError(t, err) t.Run("etag for profiles not in team 1 after second update", func(t *testing.T) { - etag3 = ss.User().GetEtagForProfilesNotInTeam(teamId) + etag3 = ss.User().GetEtagForProfilesNotInTeam(teamID) require.NotEqual(t, etag1, etag3, "etag should have changed") require.NotEqual(t, etag2, etag3, "etag should have changed") }) t.Run("get not in team 1, offset 0, limit 100000 after second update", func(t *testing.T) { - users, userErr := ss.User().GetProfilesNotInTeam(teamId, false, 0, 100000, nil) + users, userErr := ss.User().GetProfilesNotInTeam(teamID, false, 0, 100000, nil) require.NoError(t, userErr) assert.Equal(t, []*model.User{ sanitized(u1), @@ -4767,16 +4767,16 @@ func testUserStoreGetProfilesNotInTeam(t *testing.T, rctx request.CTX, ss store. }) require.NoError(t, err) defer func() { require.NoError(t, ss.User().PermanentDelete(rctx, u4.Id)) }() - _, nErr = ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamId, UserId: u4.Id}, -1) + _, nErr = ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamID, UserId: u4.Id}, -1) require.NoError(t, nErr) t.Run("etag for profiles not in team 1 after addition to team", func(t *testing.T) { - etag4 := ss.User().GetEtagForProfilesNotInTeam(teamId) + etag4 := ss.User().GetEtagForProfilesNotInTeam(teamID) require.Equal(t, etag3, etag4, "etag should not have changed") }) // Add u3 to team 2 - _, nErr = ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamId2, UserId: u3.Id}, -1) + _, nErr = ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamID2, UserId: u3.Id}, -1) require.NoError(t, nErr) u3.UpdateAt, err = ss.User().UpdateUpdateAt(u3.Id) require.NoError(t, err) @@ -4788,12 +4788,12 @@ func testUserStoreGetProfilesNotInTeam(t *testing.T, rctx request.CTX, ss store. // solution, which only uses UserIds, would solve this issue. t.Run("etag for profiles not in team 1 after u3 added to team 2", func(t *testing.T) { t.Skip() - etag4 := ss.User().GetEtagForProfilesNotInTeam(teamId) + etag4 := ss.User().GetEtagForProfilesNotInTeam(teamID) require.Equal(t, etag3, etag4, "etag should not have changed") }) t.Run("get not in team 1, offset 0, limit 100000 after second update, setting group constrained when it's not", func(t *testing.T) { - users, userErr := ss.User().GetProfilesNotInTeam(teamId, true, 0, 100000, nil) + users, userErr := ss.User().GetProfilesNotInTeam(teamID, true, 0, 100000, nil) require.NoError(t, userErr) assert.Empty(t, users) }) @@ -4816,13 +4816,13 @@ func testUserStoreGetProfilesNotInTeam(t *testing.T, rctx request.CTX, ss store. // associate the group with the team _, err = ss.Group().CreateGroupSyncable(&model.GroupSyncable{ GroupId: group.Id, - SyncableId: teamId, + SyncableId: teamID, Type: model.GroupSyncableTypeTeam, }) require.NoError(t, err) t.Run("get not in team 1, offset 0, limit 100000 after second update, setting group constrained", func(t *testing.T) { - users, userErr := ss.User().GetProfilesNotInTeam(teamId, true, 0, 100000, nil) + users, userErr := ss.User().GetProfilesNotInTeam(teamID, true, 0, 100000, nil) require.NoError(t, userErr) assert.Equal(t, []*model.User{ sanitized(u1), @@ -4940,7 +4940,7 @@ func testUserStoreGetUsersBatchForIndexing(t *testing.T, rctx request.CTX, ss st // Set up all the objects needed t1, err := ss.Team().Save(&model.Team{ DisplayName: "Team1", - Name: NewTestId(), + Name: NewTestID(), Type: model.TeamOpen, }) require.NoError(t, err) @@ -5334,12 +5334,12 @@ func testUserStorePromoteGuestToUser(t *testing.T, rctx request.CTX, ss store.St require.NoError(t, err) defer func() { require.NoError(t, ss.User().PermanentDelete(rctx, user.Id)) }() - teamId := model.NewId() - _, nErr := ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamId, UserId: user.Id, SchemeGuest: true, SchemeUser: false}, 999) + teamID := model.NewId() + _, nErr := ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamID, UserId: user.Id, SchemeGuest: true, SchemeUser: false}, 999) require.NoError(t, nErr) channel, nErr := ss.Channel().Save(rctx, &model.Channel{ - TeamId: teamId, + TeamId: teamID, DisplayName: "Channel name", Name: "channel-" + model.NewId(), Type: model.ChannelTypeOpen, @@ -5355,7 +5355,7 @@ func testUserStorePromoteGuestToUser(t *testing.T, rctx request.CTX, ss store.St require.Equal(t, "system_user", updatedUser.Roles) require.True(t, user.UpdateAt < updatedUser.UpdateAt) - updatedTeamMember, nErr := ss.Team().GetMember(rctx, teamId, user.Id) + updatedTeamMember, nErr := ss.Team().GetMember(rctx, teamID, user.Id) require.NoError(t, nErr) require.False(t, updatedTeamMember.SchemeGuest) require.True(t, updatedTeamMember.SchemeUser) @@ -5380,12 +5380,12 @@ func testUserStorePromoteGuestToUser(t *testing.T, rctx request.CTX, ss store.St require.NoError(t, err) defer func() { require.NoError(t, ss.User().PermanentDelete(rctx, user.Id)) }() - teamId := model.NewId() - _, nErr := ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamId, UserId: user.Id, SchemeGuest: true, SchemeUser: false}, 999) + teamID := model.NewId() + _, nErr := ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamID, UserId: user.Id, SchemeGuest: true, SchemeUser: false}, 999) require.NoError(t, nErr) channel, nErr := ss.Channel().Save(rctx, &model.Channel{ - TeamId: teamId, + TeamId: teamID, DisplayName: "Channel name", Name: "channel-" + model.NewId(), Type: model.ChannelTypeOpen, @@ -5400,7 +5400,7 @@ func testUserStorePromoteGuestToUser(t *testing.T, rctx request.CTX, ss store.St require.NoError(t, err) require.Equal(t, "system_user system_admin", updatedUser.Roles) - updatedTeamMember, nErr := ss.Team().GetMember(rctx, teamId, user.Id) + updatedTeamMember, nErr := ss.Team().GetMember(rctx, teamID, user.Id) require.NoError(t, nErr) require.False(t, updatedTeamMember.SchemeGuest) require.True(t, updatedTeamMember.SchemeUser) @@ -5446,8 +5446,8 @@ func testUserStorePromoteGuestToUser(t *testing.T, rctx request.CTX, ss store.St require.NoError(t, err) defer func() { require.NoError(t, ss.User().PermanentDelete(rctx, user.Id)) }() - teamId := model.NewId() - _, nErr := ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamId, UserId: user.Id, SchemeGuest: true, SchemeUser: false}, 999) + teamID := model.NewId() + _, nErr := ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamID, UserId: user.Id, SchemeGuest: true, SchemeUser: false}, 999) require.NoError(t, nErr) err = ss.User().PromoteGuestToUser(user.Id) @@ -5456,7 +5456,7 @@ func testUserStorePromoteGuestToUser(t *testing.T, rctx request.CTX, ss store.St require.NoError(t, err) require.Equal(t, "system_user", updatedUser.Roles) - updatedTeamMember, nErr := ss.Team().GetMember(rctx, teamId, user.Id) + updatedTeamMember, nErr := ss.Team().GetMember(rctx, teamID, user.Id) require.NoError(t, nErr) require.False(t, updatedTeamMember.SchemeGuest) require.True(t, updatedTeamMember.SchemeUser) @@ -5476,12 +5476,12 @@ func testUserStorePromoteGuestToUser(t *testing.T, rctx request.CTX, ss store.St require.NoError(t, err) defer func() { require.NoError(t, ss.User().PermanentDelete(rctx, user.Id)) }() - teamId := model.NewId() - _, nErr := ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamId, UserId: user.Id, SchemeGuest: true, SchemeUser: false}, 999) + teamID := model.NewId() + _, nErr := ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamID, UserId: user.Id, SchemeGuest: true, SchemeUser: false}, 999) require.NoError(t, nErr) channel, nErr := ss.Channel().Save(rctx, &model.Channel{ - TeamId: teamId, + TeamId: teamID, DisplayName: "Channel name", Name: "channel-" + model.NewId(), Type: model.ChannelTypeOpen, @@ -5496,7 +5496,7 @@ func testUserStorePromoteGuestToUser(t *testing.T, rctx request.CTX, ss store.St require.NoError(t, err) require.Equal(t, "system_user", updatedUser.Roles) - updatedTeamMember, nErr := ss.Team().GetMember(rctx, teamId, user.Id) + updatedTeamMember, nErr := ss.Team().GetMember(rctx, teamID, user.Id) require.NoError(t, nErr) require.False(t, updatedTeamMember.SchemeGuest) require.True(t, updatedTeamMember.SchemeUser) @@ -5521,12 +5521,12 @@ func testUserStorePromoteGuestToUser(t *testing.T, rctx request.CTX, ss store.St require.NoError(t, err) defer func() { require.NoError(t, ss.User().PermanentDelete(rctx, user.Id)) }() - teamId := model.NewId() - _, nErr := ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamId, UserId: user.Id, SchemeGuest: true, SchemeUser: false}, 999) + teamID := model.NewId() + _, nErr := ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamID, UserId: user.Id, SchemeGuest: true, SchemeUser: false}, 999) require.NoError(t, nErr) channel, nErr := ss.Channel().Save(rctx, &model.Channel{ - TeamId: teamId, + TeamId: teamID, DisplayName: "Channel name", Name: "channel-" + model.NewId(), Type: model.ChannelTypeOpen, @@ -5541,7 +5541,7 @@ func testUserStorePromoteGuestToUser(t *testing.T, rctx request.CTX, ss store.St require.NoError(t, err) require.Equal(t, "system_user custom_role", updatedUser.Roles) - updatedTeamMember, nErr := ss.Team().GetMember(rctx, teamId, user.Id) + updatedTeamMember, nErr := ss.Team().GetMember(rctx, teamID, user.Id) require.NoError(t, nErr) require.False(t, updatedTeamMember.SchemeGuest) require.True(t, updatedTeamMember.SchemeUser) @@ -5566,12 +5566,12 @@ func testUserStorePromoteGuestToUser(t *testing.T, rctx request.CTX, ss store.St require.NoError(t, err) defer func() { require.NoError(t, ss.User().PermanentDelete(rctx, user1.Id)) }() - teamId1 := model.NewId() - _, nErr := ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamId1, UserId: user1.Id, SchemeGuest: true, SchemeUser: false}, 999) + teamID1 := model.NewId() + _, nErr := ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamID1, UserId: user1.Id, SchemeGuest: true, SchemeUser: false}, 999) require.NoError(t, nErr) channel, nErr := ss.Channel().Save(rctx, &model.Channel{ - TeamId: teamId1, + TeamId: teamID1, DisplayName: "Channel name", Name: "channel-" + model.NewId(), Type: model.ChannelTypeOpen, @@ -5594,8 +5594,8 @@ func testUserStorePromoteGuestToUser(t *testing.T, rctx request.CTX, ss store.St require.NoError(t, err) defer func() { require.NoError(t, ss.User().PermanentDelete(rctx, user2.Id)) }() - teamId2 := model.NewId() - _, nErr = ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamId2, UserId: user2.Id, SchemeGuest: true, SchemeUser: false}, 999) + teamID2 := model.NewId() + _, nErr = ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamID2, UserId: user2.Id, SchemeGuest: true, SchemeUser: false}, 999) require.NoError(t, nErr) _, nErr = ss.Channel().SaveMember(rctx, &model.ChannelMember{ChannelId: channel.Id, UserId: user2.Id, SchemeGuest: true, SchemeUser: false, NotifyProps: model.GetDefaultChannelNotifyProps()}) @@ -5607,7 +5607,7 @@ func testUserStorePromoteGuestToUser(t *testing.T, rctx request.CTX, ss store.St require.NoError(t, err) require.Equal(t, "system_user", updatedUser.Roles) - updatedTeamMember, nErr := ss.Team().GetMember(rctx, teamId1, user1.Id) + updatedTeamMember, nErr := ss.Team().GetMember(rctx, teamID1, user1.Id) require.NoError(t, nErr) require.False(t, updatedTeamMember.SchemeGuest) require.True(t, updatedTeamMember.SchemeUser) @@ -5621,7 +5621,7 @@ func testUserStorePromoteGuestToUser(t *testing.T, rctx request.CTX, ss store.St require.NoError(t, err) require.Equal(t, "system_guest", notUpdatedUser.Roles) - notUpdatedTeamMember, nErr := ss.Team().GetMember(rctx, teamId2, user2.Id) + notUpdatedTeamMember, nErr := ss.Team().GetMember(rctx, teamID2, user2.Id) require.NoError(t, nErr) require.True(t, notUpdatedTeamMember.SchemeGuest) require.False(t, notUpdatedTeamMember.SchemeUser) @@ -5649,12 +5649,12 @@ func testUserStoreDemoteUserToGuest(t *testing.T, rctx request.CTX, ss store.Sto require.NoError(t, err) defer func() { require.NoError(t, ss.User().PermanentDelete(rctx, user.Id)) }() - teamId := model.NewId() - _, nErr := ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamId, UserId: user.Id, SchemeGuest: false, SchemeUser: true}, 999) + teamID := model.NewId() + _, nErr := ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamID, UserId: user.Id, SchemeGuest: false, SchemeUser: true}, 999) require.NoError(t, nErr) channel, nErr := ss.Channel().Save(rctx, &model.Channel{ - TeamId: teamId, + TeamId: teamID, DisplayName: "Channel name", Name: "channel-" + model.NewId(), Type: model.ChannelTypeOpen, @@ -5668,7 +5668,7 @@ func testUserStoreDemoteUserToGuest(t *testing.T, rctx request.CTX, ss store.Sto require.Equal(t, "system_guest", updatedUser.Roles) require.True(t, user.UpdateAt < updatedUser.UpdateAt) - updatedTeamMember, nErr := ss.Team().GetMember(rctx, teamId, updatedUser.Id) + updatedTeamMember, nErr := ss.Team().GetMember(rctx, teamID, updatedUser.Id) require.NoError(t, nErr) require.True(t, updatedTeamMember.SchemeGuest) require.False(t, updatedTeamMember.SchemeUser) @@ -5693,12 +5693,12 @@ func testUserStoreDemoteUserToGuest(t *testing.T, rctx request.CTX, ss store.Sto require.NoError(t, err) defer func() { require.NoError(t, ss.User().PermanentDelete(rctx, user.Id)) }() - teamId := model.NewId() - _, nErr := ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamId, UserId: user.Id, SchemeGuest: true, SchemeUser: false}, 999) + teamID := model.NewId() + _, nErr := ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamID, UserId: user.Id, SchemeGuest: true, SchemeUser: false}, 999) require.NoError(t, nErr) channel, nErr := ss.Channel().Save(rctx, &model.Channel{ - TeamId: teamId, + TeamId: teamID, DisplayName: "Channel name", Name: "channel-" + model.NewId(), Type: model.ChannelTypeOpen, @@ -5711,7 +5711,7 @@ func testUserStoreDemoteUserToGuest(t *testing.T, rctx request.CTX, ss store.Sto require.NoError(t, err) require.Equal(t, "system_guest", updatedUser.Roles) - updatedTeamMember, nErr := ss.Team().GetMember(rctx, teamId, user.Id) + updatedTeamMember, nErr := ss.Team().GetMember(rctx, teamID, user.Id) require.NoError(t, nErr) require.True(t, updatedTeamMember.SchemeGuest) require.False(t, updatedTeamMember.SchemeUser) @@ -5755,15 +5755,15 @@ func testUserStoreDemoteUserToGuest(t *testing.T, rctx request.CTX, ss store.Sto require.NoError(t, err) defer func() { require.NoError(t, ss.User().PermanentDelete(rctx, user.Id)) }() - teamId := model.NewId() - _, nErr := ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamId, UserId: user.Id, SchemeGuest: false, SchemeUser: true}, 999) + teamID := model.NewId() + _, nErr := ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamID, UserId: user.Id, SchemeGuest: false, SchemeUser: true}, 999) require.NoError(t, nErr) updatedUser, err := ss.User().DemoteUserToGuest(user.Id) require.NoError(t, err) require.Equal(t, "system_guest", updatedUser.Roles) - updatedTeamMember, nErr := ss.Team().GetMember(rctx, teamId, user.Id) + updatedTeamMember, nErr := ss.Team().GetMember(rctx, teamID, user.Id) require.NoError(t, nErr) require.True(t, updatedTeamMember.SchemeGuest) require.False(t, updatedTeamMember.SchemeUser) @@ -5783,12 +5783,12 @@ func testUserStoreDemoteUserToGuest(t *testing.T, rctx request.CTX, ss store.Sto require.NoError(t, err) defer func() { require.NoError(t, ss.User().PermanentDelete(rctx, user.Id)) }() - teamId := model.NewId() - _, nErr := ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamId, UserId: user.Id, SchemeGuest: false, SchemeUser: true}, 999) + teamID := model.NewId() + _, nErr := ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamID, UserId: user.Id, SchemeGuest: false, SchemeUser: true}, 999) require.NoError(t, nErr) channel, nErr := ss.Channel().Save(rctx, &model.Channel{ - TeamId: teamId, + TeamId: teamID, DisplayName: "Channel name", Name: "channel-" + model.NewId(), Type: model.ChannelTypeOpen, @@ -5801,7 +5801,7 @@ func testUserStoreDemoteUserToGuest(t *testing.T, rctx request.CTX, ss store.Sto require.NoError(t, err) require.Equal(t, "system_guest", updatedUser.Roles) - updatedTeamMember, nErr := ss.Team().GetMember(rctx, teamId, user.Id) + updatedTeamMember, nErr := ss.Team().GetMember(rctx, teamID, user.Id) require.NoError(t, nErr) require.True(t, updatedTeamMember.SchemeGuest) require.False(t, updatedTeamMember.SchemeUser) @@ -5826,12 +5826,12 @@ func testUserStoreDemoteUserToGuest(t *testing.T, rctx request.CTX, ss store.Sto require.NoError(t, err) defer func() { require.NoError(t, ss.User().PermanentDelete(rctx, user.Id)) }() - teamId := model.NewId() - _, nErr := ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamId, UserId: user.Id, SchemeGuest: false, SchemeUser: true}, 999) + teamID := model.NewId() + _, nErr := ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamID, UserId: user.Id, SchemeGuest: false, SchemeUser: true}, 999) require.NoError(t, nErr) channel, nErr := ss.Channel().Save(rctx, &model.Channel{ - TeamId: teamId, + TeamId: teamID, DisplayName: "Channel name", Name: "channel-" + model.NewId(), Type: model.ChannelTypeOpen, @@ -5844,7 +5844,7 @@ func testUserStoreDemoteUserToGuest(t *testing.T, rctx request.CTX, ss store.Sto require.NoError(t, err) require.Equal(t, "system_guest", updatedUser.Roles) - updatedTeamMember, nErr := ss.Team().GetMember(rctx, teamId, user.Id) + updatedTeamMember, nErr := ss.Team().GetMember(rctx, teamID, user.Id) require.NoError(t, nErr) require.True(t, updatedTeamMember.SchemeGuest) require.False(t, updatedTeamMember.SchemeUser) @@ -5869,12 +5869,12 @@ func testUserStoreDemoteUserToGuest(t *testing.T, rctx request.CTX, ss store.Sto require.NoError(t, err) defer func() { require.NoError(t, ss.User().PermanentDelete(rctx, user1.Id)) }() - teamId1 := model.NewId() - _, nErr := ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamId1, UserId: user1.Id, SchemeGuest: false, SchemeUser: true}, 999) + teamID1 := model.NewId() + _, nErr := ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamID1, UserId: user1.Id, SchemeGuest: false, SchemeUser: true}, 999) require.NoError(t, nErr) channel, nErr := ss.Channel().Save(rctx, &model.Channel{ - TeamId: teamId1, + TeamId: teamID1, DisplayName: "Channel name", Name: "channel-" + model.NewId(), Type: model.ChannelTypeOpen, @@ -5897,8 +5897,8 @@ func testUserStoreDemoteUserToGuest(t *testing.T, rctx request.CTX, ss store.Sto require.NoError(t, err) defer func() { require.NoError(t, ss.User().PermanentDelete(rctx, user2.Id)) }() - teamId2 := model.NewId() - _, nErr = ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamId2, UserId: user2.Id, SchemeGuest: false, SchemeUser: true}, 999) + teamID2 := model.NewId() + _, nErr = ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamID2, UserId: user2.Id, SchemeGuest: false, SchemeUser: true}, 999) require.NoError(t, nErr) _, nErr = ss.Channel().SaveMember(rctx, &model.ChannelMember{ChannelId: channel.Id, UserId: user2.Id, SchemeGuest: false, SchemeUser: true, NotifyProps: model.GetDefaultChannelNotifyProps()}) @@ -5908,7 +5908,7 @@ func testUserStoreDemoteUserToGuest(t *testing.T, rctx request.CTX, ss store.Sto require.NoError(t, err) require.Equal(t, "system_guest", updatedUser.Roles) - updatedTeamMember, nErr := ss.Team().GetMember(rctx, teamId1, user1.Id) + updatedTeamMember, nErr := ss.Team().GetMember(rctx, teamID1, user1.Id) require.NoError(t, nErr) require.True(t, updatedTeamMember.SchemeGuest) require.False(t, updatedTeamMember.SchemeUser) @@ -5922,7 +5922,7 @@ func testUserStoreDemoteUserToGuest(t *testing.T, rctx request.CTX, ss store.Sto require.NoError(t, err) require.Equal(t, "system_user", notUpdatedUser.Roles) - notUpdatedTeamMember, nErr := ss.Team().GetMember(rctx, teamId2, user2.Id) + notUpdatedTeamMember, nErr := ss.Team().GetMember(rctx, teamID2, user2.Id) require.NoError(t, nErr) require.False(t, notUpdatedTeamMember.SchemeGuest) require.True(t, notUpdatedTeamMember.SchemeUser) @@ -6046,7 +6046,7 @@ func testUserStoreResetLastPictureUpdate(t *testing.T, rctx request.CTX, ss stor } func testGetKnownUsers(t *testing.T, rctx request.CTX, ss store.Store) { - teamId := model.NewId() + teamID := model.NewId() u1, err := ss.User().Save(rctx, &model.User{ Email: MakeEmail(), @@ -6054,7 +6054,7 @@ func testGetKnownUsers(t *testing.T, rctx request.CTX, ss store.Store) { }) require.NoError(t, err) defer func() { require.NoError(t, ss.User().PermanentDelete(rctx, u1.Id)) }() - _, nErr := ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamId, UserId: u1.Id}, -1) + _, nErr := ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamID, UserId: u1.Id}, -1) require.NoError(t, nErr) u2, err := ss.User().Save(rctx, &model.User{ @@ -6063,7 +6063,7 @@ func testGetKnownUsers(t *testing.T, rctx request.CTX, ss store.Store) { }) require.NoError(t, err) defer func() { require.NoError(t, ss.User().PermanentDelete(rctx, u2.Id)) }() - _, nErr = ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamId, UserId: u2.Id}, -1) + _, nErr = ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamID, UserId: u2.Id}, -1) require.NoError(t, nErr) u3, err := ss.User().Save(rctx, &model.User{ @@ -6072,7 +6072,7 @@ func testGetKnownUsers(t *testing.T, rctx request.CTX, ss store.Store) { }) require.NoError(t, err) defer func() { require.NoError(t, ss.User().PermanentDelete(rctx, u3.Id)) }() - _, nErr = ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamId, UserId: u3.Id}, -1) + _, nErr = ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamID, UserId: u3.Id}, -1) require.NoError(t, nErr) _, nErr = ss.Bot().Save(&model.Bot{ UserId: u3.Id, @@ -6090,11 +6090,11 @@ func testGetKnownUsers(t *testing.T, rctx request.CTX, ss store.Store) { }) require.NoError(t, err) defer func() { require.NoError(t, ss.User().PermanentDelete(rctx, u4.Id)) }() - _, nErr = ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamId, UserId: u4.Id}, -1) + _, nErr = ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamID, UserId: u4.Id}, -1) require.NoError(t, nErr) ch1 := &model.Channel{ - TeamId: teamId, + TeamId: teamID, DisplayName: "Profiles in channel", Name: "profiles-" + model.NewId(), Type: model.ChannelTypeOpen, @@ -6103,7 +6103,7 @@ func testGetKnownUsers(t *testing.T, rctx request.CTX, ss store.Store) { require.NoError(t, nErr) ch2 := &model.Channel{ - TeamId: teamId, + TeamId: teamID, DisplayName: "Profiles in private", Name: "profiles-" + model.NewId(), Type: model.ChannelTypePrivate, @@ -6112,7 +6112,7 @@ func testGetKnownUsers(t *testing.T, rctx request.CTX, ss store.Store) { require.NoError(t, nErr) ch3 := &model.Channel{ - TeamId: teamId, + TeamId: teamID, DisplayName: "Profiles in private", Name: "profiles-" + model.NewId(), Type: model.ChannelTypePrivate, @@ -6296,7 +6296,7 @@ func testGetUserReport(t *testing.T, rctx request.CTX, ss store.Store, s SqlStor for _, user := range users { for i := 0; i < numPostsPerUser; i++ { - post := model.Post{UserId: user.Id, ChannelId: model.NewId(), Message: NewTestId(), CreateAt: now.AddDate(0, 0, -i).UnixMilli()} + post := model.Post{UserId: user.Id, ChannelId: model.NewId(), Message: NewTestID(), CreateAt: now.AddDate(0, 0, -i).UnixMilli()} _, err := ss.Post().Save(rctx, &post) require.NoError(t, err) } @@ -6304,7 +6304,7 @@ func testGetUserReport(t *testing.T, rctx request.CTX, ss store.Store, s SqlStor team, err := ss.Team().Save(&model.Team{ DisplayName: model.NewId(), - Name: NewTestId(), + Name: NewTestID(), Email: MakeEmail(), Type: model.TeamOpen, }) diff --git a/server/channels/store/storetest/utils.go b/server/channels/store/storetest/utils.go index eb8c7c17b21c2..5a9995aa3ce90 100644 --- a/server/channels/store/storetest/utils.go +++ b/server/channels/store/storetest/utils.go @@ -8,14 +8,14 @@ import ( ) // This function has a copy of it in app/helper_test -// NewTestId is used for testing as a replacement for model.NewId(). It is a [A-Z0-9] string 26 +// NewTestID is used for testing as a replacement for model.NewId(). It is a [A-Z0-9] string 26 // characters long. It replaces every odd character with a digit. -func NewTestId() string { - newId := []byte(model.NewId()) +func NewTestID() string { + newID := []byte(model.NewId()) - for i := 1; i < len(newId); i = i + 2 { - newId[i] = 48 + newId[i-1]%10 + for i := 1; i < len(newID); i = i + 2 { + newID[i] = 48 + newID[i-1]%10 } - return string(newId) + return string(newID) } diff --git a/server/channels/store/storetest/utils_test.go b/server/channels/store/storetest/utils_test.go index 85944f997b060..71d93286ecfb8 100644 --- a/server/channels/store/storetest/utils_test.go +++ b/server/channels/store/storetest/utils_test.go @@ -14,7 +14,7 @@ func TestNewTestId(t *testing.T) { rg := regexp.MustCompile(`(\S\d){13}`) for i := 0; i < 1000; i++ { - id := NewTestId() + id := NewTestID() require.LessOrEqual(t, len(id), 26, "test ids shouldn't be longer than 26 chars") require.Regexp(t, rg, id, "test ids should have pattern e.g a1b2c3...") } diff --git a/server/channels/store/timerlayer/timerlayer.go b/server/channels/store/timerlayer/timerlayer.go index 97a733f45dfd3..ebd94945ff6b9 100644 --- a/server/channels/store/timerlayer/timerlayer.go +++ b/server/channels/store/timerlayer/timerlayer.go @@ -471,10 +471,10 @@ type TimerLayerWebhookStore struct { Root *TimerLayer } -func (s *TimerLayerAuditStore) Get(user_id string, offset int, limit int) (model.Audits, error) { +func (s *TimerLayerAuditStore) Get(userID string, offset int, limit int) (model.Audits, error) { start := time.Now() - result, err := s.AuditStore.Get(user_id, offset, limit) + result, err := s.AuditStore.Get(userID, offset, limit) elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { @@ -1029,10 +1029,10 @@ func (s *TimerLayerChannelStore) GetAllDirectChannelsForExportAfter(limit int, a return result, err } -func (s *TimerLayerChannelStore) GetByName(team_id string, name string, allowFromCache bool) (*model.Channel, error) { +func (s *TimerLayerChannelStore) GetByName(teamID string, name string, allowFromCache bool) (*model.Channel, error) { start := time.Now() - result, err := s.ChannelStore.GetByName(team_id, name, allowFromCache) + result, err := s.ChannelStore.GetByName(teamID, name, allowFromCache) elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { @@ -1045,10 +1045,10 @@ func (s *TimerLayerChannelStore) GetByName(team_id string, name string, allowFro return result, err } -func (s *TimerLayerChannelStore) GetByNameIncludeDeleted(team_id string, name string, allowFromCache bool) (*model.Channel, error) { +func (s *TimerLayerChannelStore) GetByNameIncludeDeleted(teamID string, name string, allowFromCache bool) (*model.Channel, error) { start := time.Now() - result, err := s.ChannelStore.GetByNameIncludeDeleted(team_id, name, allowFromCache) + result, err := s.ChannelStore.GetByNameIncludeDeleted(teamID, name, allowFromCache) elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { @@ -1061,10 +1061,10 @@ func (s *TimerLayerChannelStore) GetByNameIncludeDeleted(team_id string, name st return result, err } -func (s *TimerLayerChannelStore) GetByNames(team_id string, names []string, allowFromCache bool) ([]*model.Channel, error) { +func (s *TimerLayerChannelStore) GetByNames(teamID string, names []string, allowFromCache bool) ([]*model.Channel, error) { start := time.Now() - result, err := s.ChannelStore.GetByNames(team_id, names, allowFromCache) + result, err := s.ChannelStore.GetByNames(teamID, names, allowFromCache) elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { @@ -1077,10 +1077,10 @@ func (s *TimerLayerChannelStore) GetByNames(team_id string, names []string, allo return result, err } -func (s *TimerLayerChannelStore) GetByNamesIncludeDeleted(team_id string, names []string, allowFromCache bool) ([]*model.Channel, error) { +func (s *TimerLayerChannelStore) GetByNamesIncludeDeleted(teamID string, names []string, allowFromCache bool) ([]*model.Channel, error) { start := time.Now() - result, err := s.ChannelStore.GetByNamesIncludeDeleted(team_id, names, allowFromCache) + result, err := s.ChannelStore.GetByNamesIncludeDeleted(teamID, names, allowFromCache) elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { @@ -1285,10 +1285,10 @@ func (s *TimerLayerChannelStore) GetChannelsWithUnreadsAndWithMentions(ctx conte return result, resultVar1, resultVar2, err } -func (s *TimerLayerChannelStore) GetDeleted(team_id string, offset int, limit int, userID string) (model.ChannelList, error) { +func (s *TimerLayerChannelStore) GetDeleted(teamID string, offset int, limit int, userID string) (model.ChannelList, error) { start := time.Now() - result, err := s.ChannelStore.GetDeleted(team_id, offset, limit, userID) + result, err := s.ChannelStore.GetDeleted(teamID, offset, limit, userID) elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { @@ -1301,10 +1301,10 @@ func (s *TimerLayerChannelStore) GetDeleted(team_id string, offset int, limit in return result, err } -func (s *TimerLayerChannelStore) GetDeletedByName(team_id string, name string) (*model.Channel, error) { +func (s *TimerLayerChannelStore) GetDeletedByName(teamID string, name string) (*model.Channel, error) { start := time.Now() - result, err := s.ChannelStore.GetDeletedByName(team_id, name) + result, err := s.ChannelStore.GetDeletedByName(teamID, name) elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { @@ -2302,10 +2302,10 @@ func (s *TimerLayerChannelStore) SetDeleteAt(channelID string, deleteAt int64, u return err } -func (s *TimerLayerChannelStore) SetShared(channelId string, shared bool) error { +func (s *TimerLayerChannelStore) SetShared(channelID string, shared bool) error { start := time.Now() - err := s.ChannelStore.SetShared(channelId, shared) + err := s.ChannelStore.SetShared(channelID, shared) elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { @@ -2510,10 +2510,10 @@ func (s *TimerLayerChannelStore) UserBelongsToChannels(userID string, channelIds return result, err } -func (s *TimerLayerChannelBookmarkStore) Delete(bookmarkId string, deleteFile bool) error { +func (s *TimerLayerChannelBookmarkStore) Delete(bookmarkID string, deleteFile bool) error { start := time.Now() - err := s.ChannelBookmarkStore.Delete(bookmarkId, deleteFile) + err := s.ChannelBookmarkStore.Delete(bookmarkID, deleteFile) elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { @@ -2526,10 +2526,10 @@ func (s *TimerLayerChannelBookmarkStore) Delete(bookmarkId string, deleteFile bo return err } -func (s *TimerLayerChannelBookmarkStore) ErrorIfBookmarkFileInfoAlreadyAttached(fileId string) error { +func (s *TimerLayerChannelBookmarkStore) ErrorIfBookmarkFileInfoAlreadyAttached(fileID string) error { start := time.Now() - err := s.ChannelBookmarkStore.ErrorIfBookmarkFileInfoAlreadyAttached(fileId) + err := s.ChannelBookmarkStore.ErrorIfBookmarkFileInfoAlreadyAttached(fileID) elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { @@ -2558,10 +2558,10 @@ func (s *TimerLayerChannelBookmarkStore) Get(Id string, includeDeleted bool) (*m return result, err } -func (s *TimerLayerChannelBookmarkStore) GetBookmarksForChannelSince(channelId string, since int64) ([]*model.ChannelBookmarkWithFileInfo, error) { +func (s *TimerLayerChannelBookmarkStore) GetBookmarksForChannelSince(channelID string, since int64) ([]*model.ChannelBookmarkWithFileInfo, error) { start := time.Now() - result, err := s.ChannelBookmarkStore.GetBookmarksForChannelSince(channelId, since) + result, err := s.ChannelBookmarkStore.GetBookmarksForChannelSince(channelID, since) elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { @@ -2606,10 +2606,10 @@ func (s *TimerLayerChannelBookmarkStore) Update(bookmark *model.ChannelBookmark) return err } -func (s *TimerLayerChannelBookmarkStore) UpdateSortOrder(bookmarkId string, channelId string, newIndex int64) ([]*model.ChannelBookmarkWithFileInfo, error) { +func (s *TimerLayerChannelBookmarkStore) UpdateSortOrder(bookmarkID string, channelID string, newIndex int64) ([]*model.ChannelBookmarkWithFileInfo, error) { start := time.Now() - result, err := s.ChannelBookmarkStore.UpdateSortOrder(bookmarkId, channelId, newIndex) + result, err := s.ChannelBookmarkStore.UpdateSortOrder(bookmarkID, channelID, newIndex) elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { @@ -3149,10 +3149,10 @@ func (s *TimerLayerDesktopTokensStore) Delete(token string) error { return err } -func (s *TimerLayerDesktopTokensStore) DeleteByUserId(userId string) error { +func (s *TimerLayerDesktopTokensStore) DeleteByUserId(userID string) error { start := time.Now() - err := s.DesktopTokensStore.DeleteByUserId(userId) + err := s.DesktopTokensStore.DeleteByUserId(userID) elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { @@ -3197,10 +3197,10 @@ func (s *TimerLayerDesktopTokensStore) GetUserId(token string, minCreatedAt int6 return result, err } -func (s *TimerLayerDesktopTokensStore) Insert(token string, createAt int64, userId string) error { +func (s *TimerLayerDesktopTokensStore) Insert(token string, createAt int64, userID string) error { start := time.Now() - err := s.DesktopTokensStore.Insert(token, createAt, userId) + err := s.DesktopTokensStore.Insert(token, createAt, userID) elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { @@ -3245,10 +3245,10 @@ func (s *TimerLayerDraftStore) DeleteDraftsAssociatedWithPost(channelID string, return err } -func (s *TimerLayerDraftStore) DeleteEmptyDraftsByCreateAtAndUserId(createAt int64, userId string) error { +func (s *TimerLayerDraftStore) DeleteEmptyDraftsByCreateAtAndUserId(createAt int64, userID string) error { start := time.Now() - err := s.DraftStore.DeleteEmptyDraftsByCreateAtAndUserId(createAt, userId) + err := s.DraftStore.DeleteEmptyDraftsByCreateAtAndUserId(createAt, userID) elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { @@ -3261,10 +3261,10 @@ func (s *TimerLayerDraftStore) DeleteEmptyDraftsByCreateAtAndUserId(createAt int return err } -func (s *TimerLayerDraftStore) DeleteOrphanDraftsByCreateAtAndUserId(createAt int64, userId string) error { +func (s *TimerLayerDraftStore) DeleteOrphanDraftsByCreateAtAndUserId(createAt int64, userID string) error { start := time.Now() - err := s.DraftStore.DeleteOrphanDraftsByCreateAtAndUserId(createAt, userId) + err := s.DraftStore.DeleteOrphanDraftsByCreateAtAndUserId(createAt, userID) elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { @@ -3309,10 +3309,10 @@ func (s *TimerLayerDraftStore) GetDraftsForUser(userID string, teamID string) ([ return result, err } -func (s *TimerLayerDraftStore) GetLastCreateAtAndUserIdValuesForEmptyDraftsMigration(createAt int64, userId string) (int64, string, error) { +func (s *TimerLayerDraftStore) GetLastCreateAtAndUserIdValuesForEmptyDraftsMigration(createAt int64, userID string) (int64, string, error) { start := time.Now() - result, resultVar1, err := s.DraftStore.GetLastCreateAtAndUserIdValuesForEmptyDraftsMigration(createAt, userId) + result, resultVar1, err := s.DraftStore.GetLastCreateAtAndUserIdValuesForEmptyDraftsMigration(createAt, userID) elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { @@ -5067,10 +5067,10 @@ func (s *TimerLayerNotifyAdminStore) Get(trial bool) ([]*model.NotifyAdminData, return result, err } -func (s *TimerLayerNotifyAdminStore) GetDataByUserIdAndFeature(userId string, feature model.MattermostFeature) ([]*model.NotifyAdminData, error) { +func (s *TimerLayerNotifyAdminStore) GetDataByUserIdAndFeature(userID string, feature model.MattermostFeature) ([]*model.NotifyAdminData, error) { start := time.Now() - result, err := s.NotifyAdminStore.GetDataByUserIdAndFeature(userId, feature) + result, err := s.NotifyAdminStore.GetDataByUserIdAndFeature(userID, feature) elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { @@ -5099,10 +5099,10 @@ func (s *TimerLayerNotifyAdminStore) Save(data *model.NotifyAdminData) (*model.N return result, err } -func (s *TimerLayerNotifyAdminStore) Update(userId string, requiredPlan string, requiredFeature model.MattermostFeature, now int64) error { +func (s *TimerLayerNotifyAdminStore) Update(userID string, requiredPlan string, requiredFeature model.MattermostFeature, now int64) error { start := time.Now() - err := s.NotifyAdminStore.Update(userId, requiredPlan, requiredFeature, now) + err := s.NotifyAdminStore.Update(userID, requiredPlan, requiredFeature, now) elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { @@ -5163,10 +5163,10 @@ func (s *TimerLayerOAuthStore) GetAccessDataByRefreshToken(token string) (*model return result, err } -func (s *TimerLayerOAuthStore) GetAccessDataByUserForApp(userID string, clientId string) ([]*model.AccessData, error) { +func (s *TimerLayerOAuthStore) GetAccessDataByUserForApp(userID string, clientID string) ([]*model.AccessData, error) { start := time.Now() - result, err := s.OAuthStore.GetAccessDataByUserForApp(userID, clientId) + result, err := s.OAuthStore.GetAccessDataByUserForApp(userID, clientID) elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { @@ -5259,10 +5259,10 @@ func (s *TimerLayerOAuthStore) GetAuthorizedApps(userID string, offset int, limi return result, err } -func (s *TimerLayerOAuthStore) GetPreviousAccessData(userID string, clientId string) (*model.AccessData, error) { +func (s *TimerLayerOAuthStore) GetPreviousAccessData(userID string, clientID string) (*model.AccessData, error) { start := time.Now() - result, err := s.OAuthStore.GetPreviousAccessData(userID, clientId) + result, err := s.OAuthStore.GetPreviousAccessData(userID, clientID) elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { @@ -5339,10 +5339,10 @@ func (s *TimerLayerOAuthStore) RemoveAuthData(code string) error { return err } -func (s *TimerLayerOAuthStore) RemoveAuthDataByClientId(clientId string, userId string) error { +func (s *TimerLayerOAuthStore) RemoveAuthDataByClientId(clientID string, userID string) error { start := time.Now() - err := s.OAuthStore.RemoveAuthDataByClientId(clientId, userId) + err := s.OAuthStore.RemoveAuthDataByClientId(clientID, userID) elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { @@ -5355,10 +5355,10 @@ func (s *TimerLayerOAuthStore) RemoveAuthDataByClientId(clientId string, userId return err } -func (s *TimerLayerOAuthStore) RemoveAuthDataByUserId(userId string) error { +func (s *TimerLayerOAuthStore) RemoveAuthDataByUserId(userID string) error { start := time.Now() - err := s.OAuthStore.RemoveAuthDataByUserId(userId) + err := s.OAuthStore.RemoveAuthDataByUserId(userID) elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { @@ -5786,10 +5786,10 @@ func (s *TimerLayerPostStore) GetDirectPostParentsForExportAfter(limit int, afte return result, err } -func (s *TimerLayerPostStore) GetEditHistoryForPost(postId string) ([]*model.Post, error) { +func (s *TimerLayerPostStore) GetEditHistoryForPost(postID string) ([]*model.Post, error) { start := time.Now() - result, err := s.PostStore.GetEditHistoryForPost(postId) + result, err := s.PostStore.GetEditHistoryForPost(postID) elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { @@ -6202,10 +6202,10 @@ func (s *TimerLayerPostStore) GetSingle(rctx request.CTX, id string, inclDeleted return result, err } -func (s *TimerLayerPostStore) HasAutoResponsePostByUserSince(options model.GetPostsSinceOptions, userId string) (bool, error) { +func (s *TimerLayerPostStore) HasAutoResponsePostByUserSince(options model.GetPostsSinceOptions, userID string) (bool, error) { start := time.Now() - result, err := s.PostStore.HasAutoResponsePostByUserSince(options, userId) + result, err := s.PostStore.HasAutoResponsePostByUserSince(options, userID) elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { @@ -6633,10 +6633,10 @@ func (s *TimerLayerPostPersistentNotificationStore) UpdateLastActivity(postIds [ return err } -func (s *TimerLayerPostPriorityStore) GetForPost(postId string) (*model.PostPriority, error) { +func (s *TimerLayerPostPriorityStore) GetForPost(postID string) (*model.PostPriority, error) { start := time.Now() - result, err := s.PostPriorityStore.GetForPost(postId) + result, err := s.PostPriorityStore.GetForPost(postID) elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { @@ -6985,10 +6985,10 @@ func (s *TimerLayerReactionStore) DeleteOrphanedRowsByIds(r *model.RetentionIdsF return result, err } -func (s *TimerLayerReactionStore) ExistsOnPost(postId string, emojiName string) (bool, error) { +func (s *TimerLayerReactionStore) ExistsOnPost(postID string, emojiName string) (bool, error) { start := time.Now() - result, err := s.ReactionStore.ExistsOnPost(postId, emojiName) + result, err := s.ReactionStore.ExistsOnPost(postID, emojiName) elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { @@ -7017,10 +7017,10 @@ func (s *TimerLayerReactionStore) GetForPost(postID string, allowFromCache bool) return result, err } -func (s *TimerLayerReactionStore) GetForPostSince(postId string, since int64, excludeRemoteId string, inclDeleted bool) ([]*model.Reaction, error) { +func (s *TimerLayerReactionStore) GetForPostSince(postID string, since int64, excludeRemoteID string, inclDeleted bool) ([]*model.Reaction, error) { start := time.Now() - result, err := s.ReactionStore.GetForPostSince(postId, since, excludeRemoteId, inclDeleted) + result, err := s.ReactionStore.GetForPostSince(postID, since, excludeRemoteID, inclDeleted) elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { @@ -7049,10 +7049,10 @@ func (s *TimerLayerReactionStore) GetSingle(userID string, postID string, remote return result, err } -func (s *TimerLayerReactionStore) GetUniqueCountForPost(postId string) (int, error) { +func (s *TimerLayerReactionStore) GetUniqueCountForPost(postID string) (int, error) { start := time.Now() - result, err := s.ReactionStore.GetUniqueCountForPost(postId) + result, err := s.ReactionStore.GetUniqueCountForPost(postID) elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { @@ -7113,10 +7113,10 @@ func (s *TimerLayerReactionStore) Save(reaction *model.Reaction) (*model.Reactio return result, err } -func (s *TimerLayerRemoteClusterStore) Delete(remoteClusterId string) (bool, error) { +func (s *TimerLayerRemoteClusterStore) Delete(remoteClusterID string) (bool, error) { start := time.Now() - result, err := s.RemoteClusterStore.Delete(remoteClusterId) + result, err := s.RemoteClusterStore.Delete(remoteClusterID) elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { @@ -7129,10 +7129,10 @@ func (s *TimerLayerRemoteClusterStore) Delete(remoteClusterId string) (bool, err return result, err } -func (s *TimerLayerRemoteClusterStore) Get(remoteClusterId string, includeDeleted bool) (*model.RemoteCluster, error) { +func (s *TimerLayerRemoteClusterStore) Get(remoteClusterID string, includeDeleted bool) (*model.RemoteCluster, error) { start := time.Now() - result, err := s.RemoteClusterStore.Get(remoteClusterId, includeDeleted) + result, err := s.RemoteClusterStore.Get(remoteClusterID, includeDeleted) elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { @@ -7193,10 +7193,10 @@ func (s *TimerLayerRemoteClusterStore) Save(rc *model.RemoteCluster) (*model.Rem return result, err } -func (s *TimerLayerRemoteClusterStore) SetLastPingAt(remoteClusterId string) error { +func (s *TimerLayerRemoteClusterStore) SetLastPingAt(remoteClusterID string) error { start := time.Now() - err := s.RemoteClusterStore.SetLastPingAt(remoteClusterId) + err := s.RemoteClusterStore.SetLastPingAt(remoteClusterID) elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { @@ -7225,10 +7225,10 @@ func (s *TimerLayerRemoteClusterStore) Update(rc *model.RemoteCluster) (*model.R return result, err } -func (s *TimerLayerRemoteClusterStore) UpdateTopics(remoteClusterId string, topics string) (*model.RemoteCluster, error) { +func (s *TimerLayerRemoteClusterStore) UpdateTopics(remoteClusterID string, topics string) (*model.RemoteCluster, error) { start := time.Now() - result, err := s.RemoteClusterStore.UpdateTopics(remoteClusterId, topics) + result, err := s.RemoteClusterStore.UpdateTopics(remoteClusterID, topics) elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { @@ -7241,10 +7241,10 @@ func (s *TimerLayerRemoteClusterStore) UpdateTopics(remoteClusterId string, topi return result, err } -func (s *TimerLayerRetentionPolicyStore) AddChannels(policyId string, channelIds []string) error { +func (s *TimerLayerRetentionPolicyStore) AddChannels(policyID string, channelIds []string) error { start := time.Now() - err := s.RetentionPolicyStore.AddChannels(policyId, channelIds) + err := s.RetentionPolicyStore.AddChannels(policyID, channelIds) elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { @@ -7257,10 +7257,10 @@ func (s *TimerLayerRetentionPolicyStore) AddChannels(policyId string, channelIds return err } -func (s *TimerLayerRetentionPolicyStore) AddTeams(policyId string, teamIds []string) error { +func (s *TimerLayerRetentionPolicyStore) AddTeams(policyID string, teamIds []string) error { start := time.Now() - err := s.RetentionPolicyStore.AddTeams(policyId, teamIds) + err := s.RetentionPolicyStore.AddTeams(policyID, teamIds) elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { @@ -7369,10 +7369,10 @@ func (s *TimerLayerRetentionPolicyStore) GetChannelPoliciesForUser(userID string return result, err } -func (s *TimerLayerRetentionPolicyStore) GetChannels(policyId string, offset int, limit int) (model.ChannelListWithTeamData, error) { +func (s *TimerLayerRetentionPolicyStore) GetChannels(policyID string, offset int, limit int) (model.ChannelListWithTeamData, error) { start := time.Now() - result, err := s.RetentionPolicyStore.GetChannels(policyId, offset, limit) + result, err := s.RetentionPolicyStore.GetChannels(policyID, offset, limit) elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { @@ -7385,10 +7385,10 @@ func (s *TimerLayerRetentionPolicyStore) GetChannels(policyId string, offset int return result, err } -func (s *TimerLayerRetentionPolicyStore) GetChannelsCount(policyId string) (int64, error) { +func (s *TimerLayerRetentionPolicyStore) GetChannelsCount(policyID string) (int64, error) { start := time.Now() - result, err := s.RetentionPolicyStore.GetChannelsCount(policyId) + result, err := s.RetentionPolicyStore.GetChannelsCount(policyID) elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { @@ -7465,10 +7465,10 @@ func (s *TimerLayerRetentionPolicyStore) GetTeamPoliciesForUser(userID string, o return result, err } -func (s *TimerLayerRetentionPolicyStore) GetTeams(policyId string, offset int, limit int) ([]*model.Team, error) { +func (s *TimerLayerRetentionPolicyStore) GetTeams(policyID string, offset int, limit int) ([]*model.Team, error) { start := time.Now() - result, err := s.RetentionPolicyStore.GetTeams(policyId, offset, limit) + result, err := s.RetentionPolicyStore.GetTeams(policyID, offset, limit) elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { @@ -7481,10 +7481,10 @@ func (s *TimerLayerRetentionPolicyStore) GetTeams(policyId string, offset int, l return result, err } -func (s *TimerLayerRetentionPolicyStore) GetTeamsCount(policyId string) (int64, error) { +func (s *TimerLayerRetentionPolicyStore) GetTeamsCount(policyID string) (int64, error) { start := time.Now() - result, err := s.RetentionPolicyStore.GetTeamsCount(policyId) + result, err := s.RetentionPolicyStore.GetTeamsCount(policyID) elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { @@ -7513,10 +7513,10 @@ func (s *TimerLayerRetentionPolicyStore) Patch(patch *model.RetentionPolicyWithT return result, err } -func (s *TimerLayerRetentionPolicyStore) RemoveChannels(policyId string, channelIds []string) error { +func (s *TimerLayerRetentionPolicyStore) RemoveChannels(policyID string, channelIds []string) error { start := time.Now() - err := s.RetentionPolicyStore.RemoveChannels(policyId, channelIds) + err := s.RetentionPolicyStore.RemoveChannels(policyID, channelIds) elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { @@ -7529,10 +7529,10 @@ func (s *TimerLayerRetentionPolicyStore) RemoveChannels(policyId string, channel return err } -func (s *TimerLayerRetentionPolicyStore) RemoveTeams(policyId string, teamIds []string) error { +func (s *TimerLayerRetentionPolicyStore) RemoveTeams(policyID string, teamIds []string) error { start := time.Now() - err := s.RetentionPolicyStore.RemoveTeams(policyId, teamIds) + err := s.RetentionPolicyStore.RemoveTeams(policyID, teamIds) elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { @@ -8137,10 +8137,10 @@ func (s *TimerLayerSessionStore) UpdateRoles(userID string, roles string) (strin return result, err } -func (s *TimerLayerSharedChannelStore) Delete(channelId string) (bool, error) { +func (s *TimerLayerSharedChannelStore) Delete(channelID string) (bool, error) { start := time.Now() - result, err := s.SharedChannelStore.Delete(channelId) + result, err := s.SharedChannelStore.Delete(channelID) elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { @@ -8153,10 +8153,10 @@ func (s *TimerLayerSharedChannelStore) Delete(channelId string) (bool, error) { return result, err } -func (s *TimerLayerSharedChannelStore) DeleteRemote(remoteId string) (bool, error) { +func (s *TimerLayerSharedChannelStore) DeleteRemote(remoteID string) (bool, error) { start := time.Now() - result, err := s.SharedChannelStore.DeleteRemote(remoteId) + result, err := s.SharedChannelStore.DeleteRemote(remoteID) elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { @@ -8169,10 +8169,10 @@ func (s *TimerLayerSharedChannelStore) DeleteRemote(remoteId string) (bool, erro return result, err } -func (s *TimerLayerSharedChannelStore) Get(channelId string) (*model.SharedChannel, error) { +func (s *TimerLayerSharedChannelStore) Get(channelID string) (*model.SharedChannel, error) { start := time.Now() - result, err := s.SharedChannelStore.Get(channelId) + result, err := s.SharedChannelStore.Get(channelID) elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { @@ -8217,10 +8217,10 @@ func (s *TimerLayerSharedChannelStore) GetAllCount(opts model.SharedChannelFilte return result, err } -func (s *TimerLayerSharedChannelStore) GetAttachment(fileId string, remoteId string) (*model.SharedChannelAttachment, error) { +func (s *TimerLayerSharedChannelStore) GetAttachment(fileID string, remoteID string) (*model.SharedChannelAttachment, error) { start := time.Now() - result, err := s.SharedChannelStore.GetAttachment(fileId, remoteId) + result, err := s.SharedChannelStore.GetAttachment(fileID, remoteID) elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { @@ -8249,10 +8249,10 @@ func (s *TimerLayerSharedChannelStore) GetRemote(id string) (*model.SharedChanne return result, err } -func (s *TimerLayerSharedChannelStore) GetRemoteByIds(channelId string, remoteId string) (*model.SharedChannelRemote, error) { +func (s *TimerLayerSharedChannelStore) GetRemoteByIds(channelID string, remoteID string) (*model.SharedChannelRemote, error) { start := time.Now() - result, err := s.SharedChannelStore.GetRemoteByIds(channelId, remoteId) + result, err := s.SharedChannelStore.GetRemoteByIds(channelID, remoteID) elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { @@ -8265,10 +8265,10 @@ func (s *TimerLayerSharedChannelStore) GetRemoteByIds(channelId string, remoteId return result, err } -func (s *TimerLayerSharedChannelStore) GetRemoteForUser(remoteId string, userId string) (*model.RemoteCluster, error) { +func (s *TimerLayerSharedChannelStore) GetRemoteForUser(remoteID string, userID string) (*model.RemoteCluster, error) { start := time.Now() - result, err := s.SharedChannelStore.GetRemoteForUser(remoteId, userId) + result, err := s.SharedChannelStore.GetRemoteForUser(remoteID, userID) elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { @@ -8297,10 +8297,10 @@ func (s *TimerLayerSharedChannelStore) GetRemotes(offset int, limit int, opts mo return result, err } -func (s *TimerLayerSharedChannelStore) GetRemotesStatus(channelId string) ([]*model.SharedChannelRemoteStatus, error) { +func (s *TimerLayerSharedChannelStore) GetRemotesStatus(channelID string) ([]*model.SharedChannelRemoteStatus, error) { start := time.Now() - result, err := s.SharedChannelStore.GetRemotesStatus(channelId) + result, err := s.SharedChannelStore.GetRemotesStatus(channelID) elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { @@ -8377,10 +8377,10 @@ func (s *TimerLayerSharedChannelStore) HasChannel(channelID string) (bool, error return result, err } -func (s *TimerLayerSharedChannelStore) HasRemote(channelID string, remoteId string) (bool, error) { +func (s *TimerLayerSharedChannelStore) HasRemote(channelID string, remoteID string) (bool, error) { start := time.Now() - result, err := s.SharedChannelStore.HasRemote(channelID, remoteId) + result, err := s.SharedChannelStore.HasRemote(channelID, remoteID) elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { @@ -9655,10 +9655,10 @@ func (s *TimerLayerTermsOfServiceStore) Save(termsOfService *model.TermsOfServic return result, err } -func (s *TimerLayerThreadStore) DeleteMembershipForUser(userId string, postID string) error { +func (s *TimerLayerThreadStore) DeleteMembershipForUser(userID string, postID string) error { start := time.Now() - err := s.ThreadStore.DeleteMembershipForUser(userId, postID) + err := s.ThreadStore.DeleteMembershipForUser(userID, postID) elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { @@ -9719,10 +9719,10 @@ func (s *TimerLayerThreadStore) Get(id string) (*model.Thread, error) { return result, err } -func (s *TimerLayerThreadStore) GetMembershipForUser(userId string, postID string) (*model.ThreadMembership, error) { +func (s *TimerLayerThreadStore) GetMembershipForUser(userID string, postID string) (*model.ThreadMembership, error) { start := time.Now() - result, err := s.ThreadStore.GetMembershipForUser(userId, postID) + result, err := s.ThreadStore.GetMembershipForUser(userID, postID) elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { @@ -9735,10 +9735,10 @@ func (s *TimerLayerThreadStore) GetMembershipForUser(userId string, postID strin return result, err } -func (s *TimerLayerThreadStore) GetMembershipsForUser(userId string, teamID string) ([]*model.ThreadMembership, error) { +func (s *TimerLayerThreadStore) GetMembershipsForUser(userID string, teamID string) ([]*model.ThreadMembership, error) { start := time.Now() - result, err := s.ThreadStore.GetMembershipsForUser(userId, teamID) + result, err := s.ThreadStore.GetMembershipsForUser(userID, teamID) elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { @@ -9831,10 +9831,10 @@ func (s *TimerLayerThreadStore) GetThreadUnreadReplyCount(threadMembership *mode return result, err } -func (s *TimerLayerThreadStore) GetThreadsForUser(userId string, teamID string, opts model.GetUserThreadsOpts) ([]*model.ThreadResponse, error) { +func (s *TimerLayerThreadStore) GetThreadsForUser(userID string, teamID string, opts model.GetUserThreadsOpts) ([]*model.ThreadResponse, error) { start := time.Now() - result, err := s.ThreadStore.GetThreadsForUser(userId, teamID, opts) + result, err := s.ThreadStore.GetThreadsForUser(userID, teamID, opts) elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { @@ -9847,10 +9847,10 @@ func (s *TimerLayerThreadStore) GetThreadsForUser(userId string, teamID string, return result, err } -func (s *TimerLayerThreadStore) GetTotalThreads(userId string, teamID string, opts model.GetUserThreadsOpts) (int64, error) { +func (s *TimerLayerThreadStore) GetTotalThreads(userID string, teamID string, opts model.GetUserThreadsOpts) (int64, error) { start := time.Now() - result, err := s.ThreadStore.GetTotalThreads(userId, teamID, opts) + result, err := s.ThreadStore.GetTotalThreads(userID, teamID, opts) elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { @@ -9863,10 +9863,10 @@ func (s *TimerLayerThreadStore) GetTotalThreads(userId string, teamID string, op return result, err } -func (s *TimerLayerThreadStore) GetTotalUnreadMentions(userId string, teamID string, opts model.GetUserThreadsOpts) (int64, error) { +func (s *TimerLayerThreadStore) GetTotalUnreadMentions(userID string, teamID string, opts model.GetUserThreadsOpts) (int64, error) { start := time.Now() - result, err := s.ThreadStore.GetTotalUnreadMentions(userId, teamID, opts) + result, err := s.ThreadStore.GetTotalUnreadMentions(userID, teamID, opts) elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { @@ -9879,10 +9879,10 @@ func (s *TimerLayerThreadStore) GetTotalUnreadMentions(userId string, teamID str return result, err } -func (s *TimerLayerThreadStore) GetTotalUnreadThreads(userId string, teamID string, opts model.GetUserThreadsOpts) (int64, error) { +func (s *TimerLayerThreadStore) GetTotalUnreadThreads(userID string, teamID string, opts model.GetUserThreadsOpts) (int64, error) { start := time.Now() - result, err := s.ThreadStore.GetTotalUnreadThreads(userId, teamID, opts) + result, err := s.ThreadStore.GetTotalUnreadThreads(userID, teamID, opts) elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { @@ -9895,10 +9895,10 @@ func (s *TimerLayerThreadStore) GetTotalUnreadThreads(userId string, teamID stri return result, err } -func (s *TimerLayerThreadStore) GetTotalUnreadUrgentMentions(userId string, teamID string, opts model.GetUserThreadsOpts) (int64, error) { +func (s *TimerLayerThreadStore) GetTotalUnreadUrgentMentions(userID string, teamID string, opts model.GetUserThreadsOpts) (int64, error) { start := time.Now() - result, err := s.ThreadStore.GetTotalUnreadUrgentMentions(userId, teamID, opts) + result, err := s.ThreadStore.GetTotalUnreadUrgentMentions(userID, teamID, opts) elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { @@ -10517,10 +10517,10 @@ func (s *TimerLayerUserStore) GetAllProfiles(options *model.UserGetOptions) ([]* return result, err } -func (s *TimerLayerUserStore) GetAllProfilesInChannel(rctx context.Context, channelID string, allowFromCache bool) (map[string]*model.User, error) { +func (s *TimerLayerUserStore) GetAllProfilesInChannel(ctx context.Context, channelID string, allowFromCache bool) (map[string]*model.User, error) { start := time.Now() - result, err := s.UserStore.GetAllProfilesInChannel(rctx, channelID, allowFromCache) + result, err := s.UserStore.GetAllProfilesInChannel(ctx, channelID, allowFromCache) elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { @@ -10885,10 +10885,10 @@ func (s *TimerLayerUserStore) GetProfilesInChannelByStatus(options *model.UserGe return result, err } -func (s *TimerLayerUserStore) GetProfilesNotInChannel(teamID string, channelId string, groupConstrained bool, offset int, limit int, viewRestrictions *model.ViewUsersRestrictions) ([]*model.User, error) { +func (s *TimerLayerUserStore) GetProfilesNotInChannel(teamID string, channelID string, groupConstrained bool, offset int, limit int, viewRestrictions *model.ViewUsersRestrictions) ([]*model.User, error) { start := time.Now() - result, err := s.UserStore.GetProfilesNotInChannel(teamID, channelId, groupConstrained, offset, limit, viewRestrictions) + result, err := s.UserStore.GetProfilesNotInChannel(teamID, channelID, groupConstrained, offset, limit, viewRestrictions) elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { @@ -11730,10 +11730,10 @@ func (s *TimerLayerUserAccessTokenStore) UpdateTokenEnable(tokenID string) error return err } -func (s *TimerLayerUserTermsOfServiceStore) Delete(userID string, termsOfServiceId string) error { +func (s *TimerLayerUserTermsOfServiceStore) Delete(userID string, termsOfServiceID string) error { start := time.Now() - err := s.UserTermsOfServiceStore.Delete(userID, termsOfServiceId) + err := s.UserTermsOfServiceStore.Delete(userID, termsOfServiceID) elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil {