diff --git a/app/app_iface.go b/app/app_iface.go index 81e5e058d54..3a0be13fa1f 100644 --- a/app/app_iface.go +++ b/app/app_iface.go @@ -184,7 +184,7 @@ type AppIface interface { // GetSanitizedConfig gets the configuration for a system admin without any secrets. GetSanitizedConfig() *model.Config // GetSchemeRolesForChannel Checks if a channel or its team has an override scheme for channel roles and returns the scheme roles or default channel roles. - GetSchemeRolesForChannel(channelId string) (guestRoleName string, userRoleName string, adminRoleName string, err *model.AppError) + GetSchemeRolesForChannel(channelID string) (guestRoleName string, userRoleName string, adminRoleName string, err *model.AppError) // GetSessionLengthInMillis returns the session length, in milliseconds, // based on the type of session (Mobile, SSO, Web/LDAP). GetSessionLengthInMillis(session *model.Session) int64 @@ -334,17 +334,17 @@ type AppIface interface { // UpdateWebConnUserActivity sets the LastUserActivityAt of the hub for the given session. UpdateWebConnUserActivity(session model.Session, activityAt int64) // UploadFile uploads a single file in form of a completely constructed byte array for a channel. - UploadFile(data []byte, channelId string, filename string) (*model.FileInfo, *model.AppError) + UploadFile(data []byte, channelID string, filename string) (*model.FileInfo, *model.AppError) // UploadFileX uploads a single file as specified in t. It applies the upload // constraints, executes plugins and image processing logic as needed. It // returns a filled-out FileInfo and an optional error. A plugin may reject the // upload, returning a rejection error. In this case FileInfo would have // contained the last "good" FileInfo before the execution of that plugin. - UploadFileX(channelId, name string, input io.Reader, opts ...func(*UploadFileTask)) (*model.FileInfo, *model.AppError) + UploadFileX(channelID, name string, input io.Reader, opts ...func(*UploadFileTask)) (*model.FileInfo, *model.AppError) // Uploads some files to the given team and channel as the given user. files and filenames should have // the same length. clientIds should either not be provided or have the same length as files and filenames. // The provided files should be closed by the caller so that they are not leaked. - UploadFiles(teamID string, channelId string, userID string, files []io.ReadCloser, filenames []string, clientIds []string, now time.Time) (*model.FileUploadResponse, *model.AppError) + UploadFiles(teamID string, channelID string, userID string, files []io.ReadCloser, filenames []string, clientIds []string, now time.Time) (*model.FileUploadResponse, *model.AppError) // UserIsInAdminRoleGroup returns true at least one of the user's groups are configured to set the members as // admins in the given syncable. UserIsInAdminRoleGroup(userID, syncableID string, syncableType model.GroupSyncableType) (bool, *model.AppError) @@ -379,16 +379,16 @@ type AppIface interface { AllowOAuthAppAccessToUser(userID string, authRequest *model.AuthorizeRequest) (string, *model.AppError) AppendFile(fr io.Reader, path string) (int64, *model.AppError) AsymmetricSigningKey() *ecdsa.PrivateKey - AttachDeviceId(sessionId string, deviceId string, expiresAt int64) *model.AppError + AttachDeviceId(sessionID string, deviceID string, expiresAt int64) *model.AppError AttachSessionCookies(w http.ResponseWriter, r *http.Request) AuthenticateUserForLogin(id, loginId, password, mfaToken, cwsToken string, ldapOnly bool) (user *model.User, err *model.AppError) AuthorizeOAuthUser(w http.ResponseWriter, r *http.Request, service, code, state, redirectUri string) (io.ReadCloser, string, map[string]string, *model.User, *model.AppError) AutocompleteChannels(teamID string, term string) (*model.ChannelList, *model.AppError) AutocompleteChannelsForSearch(teamID string, userID string, term string) (*model.ChannelList, *model.AppError) - AutocompleteUsersInChannel(teamID string, channelId string, term string, options *model.UserSearchOptions) (*model.UserAutocompleteInChannel, *model.AppError) + AutocompleteUsersInChannel(teamID string, channelID string, term string, options *model.UserSearchOptions) (*model.UserAutocompleteInChannel, *model.AppError) AutocompleteUsersInTeam(teamID string, term string, options *model.UserSearchOptions) (*model.UserAutocompleteInTeam, *model.AppError) BroadcastStatus(status *model.Status) - BuildPostReactions(postId string) (*[]ReactionImportData, *model.AppError) + BuildPostReactions(postID string) (*[]ReactionImportData, *model.AppError) BuildPushNotificationMessage(contentsConfig string, post *model.Post, user *model.User, channel *model.Channel, channelName string, senderName string, explicitMention bool, channelWideMention bool, replyToThreadType string) (*model.PushNotification, *model.AppError) BuildSamlMetadataObject(idpMetadata []byte) (*model.SamlMetadataResponse, *model.AppError) BulkExport(writer io.Writer, outPath string, opts BulkExportOpts) *model.AppError @@ -417,14 +417,14 @@ type AppIface interface { ClientConfigHash() string Cloud() einterfaces.CloudInterface Cluster() einterfaces.ClusterInterface - CompareAndDeletePluginKey(pluginId string, key string, oldValue []byte) (bool, *model.AppError) - CompareAndSetPluginKey(pluginId string, key string, oldValue, newValue []byte) (bool, *model.AppError) + CompareAndDeletePluginKey(pluginID string, key string, oldValue []byte) (bool, *model.AppError) + CompareAndSetPluginKey(pluginID string, key string, oldValue, newValue []byte) (bool, *model.AppError) CompleteOAuth(service string, body io.ReadCloser, teamID string, props map[string]string, tokenUser *model.User) (*model.User, *model.AppError) CompleteSwitchWithOAuth(service string, userData io.Reader, email string, tokenUser *model.User) (*model.User, *model.AppError) Compliance() einterfaces.ComplianceInterface Config() *model.Config Context() context.Context - CopyFileInfos(userID string, fileIds []string) ([]string, *model.AppError) + CopyFileInfos(userID string, fileIDs []string) ([]string, *model.AppError) CreateChannel(channel *model.Channel, addMember bool) (*model.Channel, *model.AppError) CreateChannelWithUser(channel *model.Channel, userID string) (*model.Channel, *model.AppError) CreateCommand(cmd *model.Command) (*model.Command, *model.AppError) @@ -461,24 +461,24 @@ type AppIface interface { DataRetention() einterfaces.DataRetentionInterface DeactivateGuests() *model.AppError DeactivateMfa(userID string) *model.AppError - DeauthorizeOAuthAppForUser(userID, appId string) *model.AppError + DeauthorizeOAuthAppForUser(userID, appID string) *model.AppError DeleteAllExpiredPluginKeys() *model.AppError - DeleteAllKeysForPlugin(pluginId string) *model.AppError + DeleteAllKeysForPlugin(pluginID string) *model.AppError DeleteBrandImage() *model.AppError DeleteChannel(channel *model.Channel, userID string) *model.AppError DeleteCommand(commandID string) *model.AppError DeleteEmoji(emoji *model.Emoji) *model.AppError - DeleteEphemeralPost(userID, postId string) + DeleteEphemeralPost(userID, postID string) DeleteExport(name string) *model.AppError - DeleteFlaggedPosts(postId string) + DeleteFlaggedPosts(postID string) DeleteGroup(groupID string) (*model.Group, *model.AppError) DeleteGroupMember(groupID string, userID string) (*model.GroupMember, *model.AppError) DeleteGroupSyncable(groupID string, syncableID string, syncableType model.GroupSyncableType) (*model.GroupSyncable, *model.AppError) DeleteIncomingWebhook(hookID string) *model.AppError - DeleteOAuthApp(appId string) *model.AppError + DeleteOAuthApp(appID string) *model.AppError DeleteOutgoingWebhook(hookID string) *model.AppError - DeletePluginKey(pluginId string, key string) *model.AppError - DeletePost(postId, deleteByID string) (*model.Post, *model.AppError) + DeletePluginKey(pluginID string, key string) *model.AppError + DeletePost(postID, deleteByID string) (*model.Post, *model.AppError) DeletePostFiles(post *model.Post) DeletePreferences(userID string, preferences model.Preferences) *model.AppError DeleteReactionForPost(reaction *model.Reaction) *model.AppError @@ -492,9 +492,9 @@ type AppIface interface { DoEmojisPermissionsMigration() DoGuestRolesCreationMigration() DoLocalRequest(rawURL string, body []byte) (*http.Response, *model.AppError) - DoLogin(w http.ResponseWriter, r *http.Request, user *model.User, deviceId string, isMobile, isOAuthUser, isSaml bool) *model.AppError - DoPostAction(postId, actionId, userID, selectedOption string) (string, *model.AppError) - DoPostActionWithCookie(postId, actionId, userID, selectedOption string, cookie *model.PostActionCookie) (string, *model.AppError) + DoLogin(w http.ResponseWriter, r *http.Request, user *model.User, deviceID string, isMobile, isOAuthUser, isSaml bool) *model.AppError + DoPostAction(postID, actionId, userID, selectedOption string) (string, *model.AppError) + DoPostActionWithCookie(postID, actionId, userID, selectedOption string, cookie *model.PostActionCookie) (string, *model.AppError) DoSystemConsoleRolesCreationMigration() DoUploadFile(now time.Time, rawTeamId string, rawChannelId string, rawUserId string, rawFilename string, data []byte) (*model.FileInfo, *model.AppError) DoUploadFileExpectModification(now time.Time, rawTeamId string, rawChannelId string, rawUserId string, rawFilename string, data []byte) (*model.FileInfo, []byte, *model.AppError) @@ -534,21 +534,21 @@ type AppIface interface { GetAuthorizationCode(w http.ResponseWriter, r *http.Request, service string, props map[string]string, loginHint string) (string, *model.AppError) GetAuthorizedAppsForUser(userID string, page, perPage int) ([]*model.OAuthApp, *model.AppError) GetBrandImage() ([]byte, *model.AppError) - GetBulkReactionsForPosts(postIds []string) (map[string][]*model.Reaction, *model.AppError) - GetChannel(channelId string) (*model.Channel, *model.AppError) + GetBulkReactionsForPosts(postIDs []string) (map[string][]*model.Reaction, *model.AppError) + GetChannel(channelID string) (*model.Channel, *model.AppError) GetChannelByName(channelName, teamID string, includeDeleted bool) (*model.Channel, *model.AppError) GetChannelByNameForTeamName(channelName, teamName string, includeDeleted bool) (*model.Channel, *model.AppError) GetChannelCounts(teamID string, userID string) (*model.ChannelCounts, *model.AppError) - GetChannelGuestCount(channelId string) (int64, *model.AppError) - GetChannelMember(channelId string, userID string) (*model.ChannelMember, *model.AppError) - GetChannelMemberCount(channelId string) (int64, *model.AppError) - GetChannelMembersByIds(channelId string, userIDs []string) (*model.ChannelMembers, *model.AppError) + GetChannelGuestCount(channelID string) (int64, *model.AppError) + GetChannelMember(channelID string, userID string) (*model.ChannelMember, *model.AppError) + GetChannelMemberCount(channelID string) (int64, *model.AppError) + GetChannelMembersByIds(channelID string, userIDs []string) (*model.ChannelMembers, *model.AppError) GetChannelMembersForUser(teamID string, userID string) (*model.ChannelMembers, *model.AppError) GetChannelMembersForUserWithPagination(teamID, userID string, page, perPage int) ([]*model.ChannelMember, *model.AppError) - GetChannelMembersPage(channelId string, page, perPage int) (*model.ChannelMembers, *model.AppError) - GetChannelMembersTimezones(channelId string) ([]string, *model.AppError) - GetChannelPinnedPostCount(channelId string) (int64, *model.AppError) - GetChannelUnread(channelId, userID string) (*model.ChannelUnread, *model.AppError) + GetChannelMembersPage(channelID string, page, perPage int) (*model.ChannelMembers, *model.AppError) + GetChannelMembersTimezones(channelID string) ([]string, *model.AppError) + GetChannelPinnedPostCount(channelID string) (int64, *model.AppError) + GetChannelUnread(channelID, userID string) (*model.ChannelUnread, *model.AppError) GetChannelsByNames(channelNames []string, teamID string) ([]*model.Channel, *model.AppError) GetChannelsForScheme(scheme *model.Scheme, offset int, limit int) (model.ChannelList, *model.AppError) GetChannelsForSchemePage(scheme *model.Scheme, page int, perPage int) (model.ChannelList, *model.AppError) @@ -570,13 +570,13 @@ type AppIface interface { GetEmojiImage(emojiId string) ([]byte, string, *model.AppError) GetEmojiList(page, perPage int, sort string) ([]*model.Emoji, *model.AppError) GetErrorListForEmailsOverLimit(emailList []string, cloudUserLimit int64) ([]string, []*model.EmailInviteWithError, *model.AppError) - GetFile(fileId string) ([]byte, *model.AppError) - GetFileInfo(fileId string) (*model.FileInfo, *model.AppError) + GetFile(fileID string) ([]byte, *model.AppError) + GetFileInfo(fileID string) (*model.FileInfo, *model.AppError) GetFileInfos(page, perPage int, opt *model.GetFileInfosOptions) ([]*model.FileInfo, *model.AppError) - GetFileInfosForPost(postId string, fromMaster bool) ([]*model.FileInfo, *model.AppError) - GetFileInfosForPostWithMigration(postId string) ([]*model.FileInfo, *model.AppError) + GetFileInfosForPost(postID string, fromMaster bool) ([]*model.FileInfo, *model.AppError) + GetFileInfosForPostWithMigration(postID string) ([]*model.FileInfo, *model.AppError) GetFlaggedPosts(userID string, offset int, limit int) (*model.PostList, *model.AppError) - GetFlaggedPostsForChannel(userID, channelId string, offset int, limit int) (*model.PostList, *model.AppError) + GetFlaggedPostsForChannel(userID, channelID string, offset int, limit int) (*model.PostList, *model.AppError) GetFlaggedPostsForTeam(userID, teamID string, offset int, limit int) (*model.PostList, *model.AppError) GetGroup(id string) (*model.Group, *model.AppError) GetGroupByName(name string, opts model.GroupSearchOpts) (*model.Group, *model.AppError) @@ -589,7 +589,7 @@ type AppIface interface { GetGroupSyncables(groupID string, syncableType model.GroupSyncableType) ([]*model.GroupSyncable, *model.AppError) GetGroups(page, perPage int, opts model.GroupSearchOpts) ([]*model.Group, *model.AppError) GetGroupsAssociatedToChannelsByTeam(teamID string, opts model.GroupSearchOpts) (map[string][]*model.GroupWithSchemeAdmin, *model.AppError) - GetGroupsByChannel(channelId string, opts model.GroupSearchOpts) ([]*model.GroupWithSchemeAdmin, int, *model.AppError) + GetGroupsByChannel(channelID string, opts model.GroupSearchOpts) ([]*model.GroupWithSchemeAdmin, int, *model.AppError) GetGroupsByIDs(groupIDs []string) ([]*model.Group, *model.AppError) GetGroupsBySource(groupSource model.GroupSource) ([]*model.Group, *model.AppError) GetGroupsByUserId(userID string) ([]*model.Group, *model.AppError) @@ -616,7 +616,7 @@ type AppIface interface { GetNumberOfChannelsOnTeam(teamID string) (int, *model.AppError) GetOAuthAccessTokenForCodeFlow(clientId, grantType, redirectUri, code, secret, refreshToken string) (*model.AccessResponse, *model.AppError) GetOAuthAccessTokenForImplicitFlow(userID string, authRequest *model.AuthorizeRequest) (*model.Session, *model.AppError) - GetOAuthApp(appId string) (*model.OAuthApp, *model.AppError) + GetOAuthApp(appID string) (*model.OAuthApp, *model.AppError) GetOAuthApps(page, perPage int) ([]*model.OAuthApp, *model.AppError) GetOAuthAppsByCreator(userID string, page, perPage int) ([]*model.OAuthApp, *model.AppError) GetOAuthCodeRedirect(userID string, authRequest *model.AuthorizeRequest) (string, *model.AppError) @@ -627,26 +627,26 @@ type AppIface interface { GetOpenGraphMetadata(requestURL string) *opengraph.OpenGraph GetOrCreateDirectChannel(userID, otherUserID string) (*model.Channel, *model.AppError) GetOutgoingWebhook(hookID string) (*model.OutgoingWebhook, *model.AppError) - GetOutgoingWebhooksForChannelPageByUser(channelId string, userID string, page, perPage int) ([]*model.OutgoingWebhook, *model.AppError) + GetOutgoingWebhooksForChannelPageByUser(channelID string, userID string, page, perPage int) ([]*model.OutgoingWebhook, *model.AppError) GetOutgoingWebhooksForTeamPage(teamID string, page, perPage int) ([]*model.OutgoingWebhook, *model.AppError) GetOutgoingWebhooksForTeamPageByUser(teamID string, userID string, page, perPage int) ([]*model.OutgoingWebhook, *model.AppError) GetOutgoingWebhooksPage(page, perPage int) ([]*model.OutgoingWebhook, *model.AppError) GetOutgoingWebhooksPageByUser(userID string, page, perPage int) ([]*model.OutgoingWebhook, *model.AppError) GetPasswordRecoveryToken(token string) (*model.Token, *model.AppError) - GetPermalinkPost(postId string, userID string) (*model.PostList, *model.AppError) - GetPinnedPosts(channelId string) (*model.PostList, *model.AppError) - GetPluginKey(pluginId string, key string) ([]byte, *model.AppError) + GetPermalinkPost(postID string, userID string) (*model.PostList, *model.AppError) + GetPinnedPosts(channelID string) (*model.PostList, *model.AppError) + GetPluginKey(pluginID string, key string) ([]byte, *model.AppError) GetPlugins() (*model.PluginsResponse, *model.AppError) - GetPostAfterTime(channelId string, time int64) (*model.Post, *model.AppError) - GetPostIdAfterTime(channelId string, time int64) (string, *model.AppError) - GetPostIdBeforeTime(channelId string, time int64) (string, *model.AppError) - GetPostThread(postId string, skipFetchThreads, collapsedThreads, collapsedThreadsExtended bool) (*model.PostList, *model.AppError) - GetPosts(channelId string, offset int, limit int) (*model.PostList, *model.AppError) + GetPostAfterTime(channelID string, time int64) (*model.Post, *model.AppError) + GetPostIdAfterTime(channelID string, time int64) (string, *model.AppError) + GetPostIdBeforeTime(channelID string, time int64) (string, *model.AppError) + GetPostThread(postID string, skipFetchThreads, collapsedThreads, collapsedThreadsExtended bool) (*model.PostList, *model.AppError) + GetPosts(channelID string, offset int, limit int) (*model.PostList, *model.AppError) GetPostsAfterPost(options model.GetPostsOptions) (*model.PostList, *model.AppError) GetPostsAroundPost(before bool, options model.GetPostsOptions) (*model.PostList, *model.AppError) GetPostsBeforePost(options model.GetPostsOptions) (*model.PostList, *model.AppError) - GetPostsEtag(channelId string, collapsedThreads bool) string - GetPostsForChannelAroundLastUnread(channelId, userID string, limitBefore, limitAfter int, skipFetchThreads bool, collapsedThreads, collapsedThreadsExtended bool) (*model.PostList, *model.AppError) + GetPostsEtag(channelID string, collapsedThreads bool) string + GetPostsForChannelAroundLastUnread(channelID, userID string, limitBefore, limitAfter int, skipFetchThreads bool, collapsedThreads, collapsedThreadsExtended bool) (*model.PostList, *model.AppError) GetPostsPage(options model.GetPostsOptions) (*model.PostList, *model.AppError) GetPostsSince(options model.GetPostsSinceOptions) (*model.PostList, *model.AppError) GetPreferenceByCategoryAndNameForUser(userID string, category string, preferenceName string) (*model.Preference, *model.AppError) @@ -655,9 +655,9 @@ type AppIface interface { GetPrevPostIdFromPostList(postList *model.PostList) string GetPrivateChannelsForTeam(teamID string, offset int, limit int) (*model.ChannelList, *model.AppError) GetProfileImage(user *model.User) ([]byte, bool, *model.AppError) - GetPublicChannelsByIdsForTeam(teamID string, channelIds []string) (*model.ChannelList, *model.AppError) + GetPublicChannelsByIdsForTeam(teamID string, channelIDs []string) (*model.ChannelList, *model.AppError) GetPublicChannelsForTeam(teamID string, offset int, limit int) (*model.ChannelList, *model.AppError) - GetReactionsForPost(postId string) ([]*model.Reaction, *model.AppError) + GetReactionsForPost(postID string) ([]*model.Reaction, *model.AppError) GetRecentlyActiveUsersForTeam(teamID string) (map[string]*model.User, *model.AppError) GetRecentlyActiveUsersForTeamPage(teamID string, page, perPage int, asAdmin bool, viewRestrictions *model.ViewUsersRestrictions) ([]*model.User, *model.AppError) GetRole(id string) (*model.Role, *model.AppError) @@ -673,12 +673,12 @@ type AppIface interface { GetSchemes(scope string, offset int, limit int) ([]*model.Scheme, *model.AppError) GetSchemesPage(scope string, page int, perPage int) ([]*model.Scheme, *model.AppError) GetSession(token string) (*model.Session, *model.AppError) - GetSessionById(sessionId string) (*model.Session, *model.AppError) + GetSessionById(sessionID string) (*model.Session, *model.AppError) GetSessions(userID string) ([]*model.Session, *model.AppError) GetSidebarCategories(userID, teamID string) (*model.OrderedSidebarCategories, *model.AppError) GetSidebarCategory(categoryId string) (*model.SidebarCategoryWithChannels, *model.AppError) GetSidebarCategoryOrder(userID, teamID string) ([]string, *model.AppError) - GetSinglePost(postId string) (*model.Post, *model.AppError) + GetSinglePost(postID string) (*model.Post, *model.AppError) GetSiteURL() string GetStatus(userID string) (*model.Status, *model.AppError) GetStatusFromCache(userID string) *model.Status @@ -717,7 +717,7 @@ type AppIface interface { GetUserForLogin(id, loginId string) (*model.User, *model.AppError) GetUserTermsOfService(userID string) (*model.UserTermsOfService, *model.AppError) GetUsers(options *model.UserGetOptions) ([]*model.User, *model.AppError) - GetUsersByGroupChannelIds(channelIds []string, asAdmin bool) (map[string][]*model.User, *model.AppError) + GetUsersByGroupChannelIds(channelIDs []string, asAdmin bool) (map[string][]*model.User, *model.AppError) GetUsersByIds(userIDs []string, options *store.UserGetByIdsOpts) ([]*model.User, *model.AppError) GetUsersByUsernames(usernames []string, asAdmin bool, viewRestrictions *model.ViewUsersRestrictions) ([]*model.User, *model.AppError) GetUsersEtag(restrictionsHash string) string @@ -729,9 +729,9 @@ type AppIface interface { GetUsersInTeam(options *model.UserGetOptions) ([]*model.User, *model.AppError) GetUsersInTeamEtag(teamID string, restrictionsHash string) string GetUsersInTeamPage(options *model.UserGetOptions, asAdmin bool) ([]*model.User, *model.AppError) - GetUsersNotInChannel(teamID string, channelId string, groupConstrained bool, offset int, limit int, viewRestrictions *model.ViewUsersRestrictions) ([]*model.User, *model.AppError) - GetUsersNotInChannelMap(teamID string, channelId string, groupConstrained bool, offset int, limit int, asAdmin bool, viewRestrictions *model.ViewUsersRestrictions) (map[string]*model.User, *model.AppError) - GetUsersNotInChannelPage(teamID string, channelId string, groupConstrained bool, page int, perPage int, asAdmin bool, viewRestrictions *model.ViewUsersRestrictions) ([]*model.User, *model.AppError) + GetUsersNotInChannel(teamID string, channelID string, groupConstrained bool, offset int, limit int, viewRestrictions *model.ViewUsersRestrictions) ([]*model.User, *model.AppError) + GetUsersNotInChannelMap(teamID string, channelID string, groupConstrained bool, offset int, limit int, asAdmin bool, viewRestrictions *model.ViewUsersRestrictions) (map[string]*model.User, *model.AppError) + GetUsersNotInChannelPage(teamID string, channelID string, groupConstrained bool, page int, perPage int, asAdmin bool, viewRestrictions *model.ViewUsersRestrictions) ([]*model.User, *model.AppError) GetUsersNotInTeam(teamID string, groupConstrained bool, offset int, limit int, viewRestrictions *model.ViewUsersRestrictions) ([]*model.User, *model.AppError) GetUsersNotInTeamEtag(teamID string, restrictionsHash string) string GetUsersNotInTeamPage(teamID string, groupConstrained bool, page int, perPage int, asAdmin bool, viewRestrictions *model.ViewUsersRestrictions) ([]*model.User, *model.AppError) @@ -750,8 +750,8 @@ type AppIface interface { HandleIncomingWebhook(hookID string, req *model.IncomingWebhookRequest) *model.AppError HandleMessageExportConfig(cfg *model.Config, appCfg *model.Config) HasPermissionTo(askingUserId string, permission *model.Permission) bool - HasPermissionToChannel(askingUserId string, channelId string, permission *model.Permission) bool - HasPermissionToChannelByPost(askingUserId string, postId string, permission *model.Permission) bool + HasPermissionToChannel(askingUserId string, channelID string, permission *model.Permission) bool + HasPermissionToChannelByPost(askingUserId string, postID string, permission *model.Permission) bool HasPermissionToTeam(askingUserId string, teamID string, permission *model.Permission) bool HasPermissionToUser(askingUserId string, userID string) bool HubStop() @@ -781,19 +781,19 @@ type AppIface interface { JoinDefaultChannels(teamID string, user *model.User, shouldBeAdmin bool, userRequestorId string) *model.AppError JoinUserToTeam(team *model.Team, user *model.User, userRequestorId string) *model.AppError Ldap() einterfaces.LdapInterface - LeaveChannel(channelId string, userID string) *model.AppError + LeaveChannel(channelID string, userID string) *model.AppError LeaveTeam(team *model.Team, user *model.User, requestorId string) *model.AppError LimitedClientConfig() map[string]string ListAllCommands(teamID string, T goi18n.TranslateFunc) ([]*model.Command, *model.AppError) ListDirectory(path string) ([]string, *model.AppError) ListExports() ([]string, *model.AppError) ListImports() ([]string, *model.AppError) - ListPluginKeys(pluginId string, page, perPage int) ([]string, *model.AppError) + ListPluginKeys(pluginID string, page, perPage int) ([]string, *model.AppError) ListTeamCommands(teamID string) ([]*model.Command, *model.AppError) Log() *mlog.Logger LoginByOAuth(service string, userData io.Reader, teamID string, tokenUser *model.User) (*model.User, *model.AppError) MakePermissionError(permissions []*model.Permission) *model.AppError - MarkChannelsAsViewed(channelIds []string, userID string, currentSessionId string) (map[string]int64, *model.AppError) + MarkChannelsAsViewed(channelIDs []string, userID string, currentSessionId string) (map[string]int64, *model.AppError) MaxPostSize() int MessageExport() einterfaces.MessageExportInterface Metrics() einterfaces.MetricsInterface @@ -808,7 +808,7 @@ type AppIface interface { OpenInteractiveDialog(request model.OpenDialogRequest) *model.AppError OriginChecker() func(*http.Request) bool PatchChannel(channel *model.Channel, patch *model.ChannelPatch, userID string) (*model.Channel, *model.AppError) - PatchPost(postId string, patch *model.PostPatch) (*model.Post, *model.AppError) + PatchPost(postID string, patch *model.PostPatch) (*model.Post, *model.AppError) PatchRole(role *model.Role, patch *model.RolePatch) (*model.Role, *model.AppError) PatchScheme(scheme *model.Scheme, patch *model.SchemePatch) (*model.Scheme, *model.AppError) PatchTeam(teamID string, patch *model.TeamPatch) (*model.Team, *model.AppError) @@ -834,7 +834,7 @@ type AppIface interface { ProcessSlackText(text string) string Publish(message *model.WebSocketEvent) PublishSkipClusterSend(message *model.WebSocketEvent) - PublishUserTyping(userID, channelId, parentId string) *model.AppError + PublishUserTyping(userID, channelID, parentId string) *model.AppError PurgeBleveIndexes() *model.AppError PurgeElasticsearchIndexes() *model.AppError ReadFile(path string) ([]byte, *model.AppError) @@ -843,7 +843,7 @@ type AppIface interface { RegenOutgoingWebhookToken(hook *model.OutgoingWebhook) (*model.OutgoingWebhook, *model.AppError) RegenerateOAuthAppSecret(app *model.OAuthApp) (*model.OAuthApp, *model.AppError) RegenerateTeamInviteId(teamID string) (*model.Team, *model.AppError) - RegisterPluginCommand(pluginId string, command *model.Command) error + RegisterPluginCommand(pluginID string, command *model.Command) error ReloadConfig() error RemoveAllDeactivatedMembersFromChannel(channel *model.Channel) *model.AppError RemoveConfigListener(id string) @@ -874,8 +874,8 @@ type AppIface interface { RevokeAccessToken(token string) *model.AppError RevokeAllSessions(userID string) *model.AppError RevokeSession(session *model.Session) *model.AppError - RevokeSessionById(sessionId string) *model.AppError - RevokeSessionsForDeviceId(userID string, deviceId string, currentSessionId string) *model.AppError + RevokeSessionById(sessionID string) *model.AppError + RevokeSessionsForDeviceId(userID string, deviceID string, currentSessionId string) *model.AppError RevokeUserAccessToken(token *model.UserAccessToken) *model.AppError RolesGrantPermission(roleNames []string, permissionId string) bool Saml() einterfaces.SamlInterface @@ -901,10 +901,10 @@ type AppIface interface { SearchPublicTeams(term string) ([]*model.Team, *model.AppError) SearchUserAccessTokens(term string) ([]*model.UserAccessToken, *model.AppError) SearchUsers(props *model.UserSearch, options *model.UserSearchOptions) ([]*model.User, *model.AppError) - SearchUsersInChannel(channelId string, term string, options *model.UserSearchOptions) ([]*model.User, *model.AppError) + SearchUsersInChannel(channelID string, term string, options *model.UserSearchOptions) ([]*model.User, *model.AppError) SearchUsersInGroup(groupID string, term string, options *model.UserSearchOptions) ([]*model.User, *model.AppError) SearchUsersInTeam(teamID, term string, options *model.UserSearchOptions) ([]*model.User, *model.AppError) - SearchUsersNotInChannel(teamID string, channelId string, term string, options *model.UserSearchOptions) ([]*model.User, *model.AppError) + SearchUsersNotInChannel(teamID string, channelID string, term string, options *model.UserSearchOptions) ([]*model.User, *model.AppError) SearchUsersNotInTeam(notInTeamId string, term string, options *model.UserSearchOptions) ([]*model.User, *model.AppError) SearchUsersWithoutTeam(term string, options *model.UserSearchOptions) ([]*model.User, *model.AppError) SendAckToPushProxy(ack *model.PushNotificationAck) error @@ -922,13 +922,13 @@ type AppIface interface { SessionHasPermissionTo(session model.Session, permission *model.Permission) bool SessionHasPermissionToAny(session model.Session, permissions []*model.Permission) bool SessionHasPermissionToCategory(session model.Session, userID, teamID, categoryId string) bool - SessionHasPermissionToChannel(session model.Session, channelId string, permission *model.Permission) bool - SessionHasPermissionToChannelByPost(session model.Session, postId string, permission *model.Permission) bool + SessionHasPermissionToChannel(session model.Session, channelID string, permission *model.Permission) bool + SessionHasPermissionToChannelByPost(session model.Session, postID string, permission *model.Permission) bool SessionHasPermissionToTeam(session model.Session, teamID string, permission *model.Permission) bool SessionHasPermissionToUser(session model.Session, userID string) bool SessionHasPermissionToUserOrBot(session model.Session, userID string) bool SetAcceptLanguage(s string) - SetActiveChannel(userID string, channelId string) *model.AppError + SetActiveChannel(userID string, channelID string) *model.AppError SetAutoResponderStatus(user *model.User, oldNotifyProps model.StringMap) SetContext(c context.Context) SetCustomStatus(userID string, cs *model.CustomStatus) *model.AppError @@ -936,9 +936,9 @@ type AppIface interface { SetIpAddress(s string) SetPath(s string) SetPhase2PermissionsMigrationStatus(isComplete bool) error - SetPluginKey(pluginId string, key string, value []byte) *model.AppError - SetPluginKeyWithExpiry(pluginId string, key string, value []byte, expireInSeconds int64) *model.AppError - SetPluginKeyWithOptions(pluginId string, key string, value []byte, options model.PluginKVSetOptions) (bool, *model.AppError) + SetPluginKey(pluginID string, key string, value []byte) *model.AppError + SetPluginKeyWithExpiry(pluginID string, key string, value []byte, expireInSeconds int64) *model.AppError + SetPluginKeyWithOptions(pluginID string, key string, value []byte, options model.PluginKVSetOptions) (bool, *model.AppError) SetPluginsEnvironment(pluginsEnvironment *plugin.Environment) SetProfileImage(userID string, imageData *multipart.FileHeader) *model.AppError SetProfileImageFromFile(userID string, file io.Reader) *model.AppError @@ -979,16 +979,16 @@ type AppIface interface { TestLdap() *model.AppError TestSiteURL(siteURL string) *model.AppError Timezones() *timezones.Timezones - ToggleMuteChannel(channelId, userID string) (*model.ChannelMember, *model.AppError) + ToggleMuteChannel(channelID, userID string) (*model.ChannelMember, *model.AppError) TotalWebsocketConnections() int TriggerWebhook(payload *model.OutgoingWebhookPayload, hook *model.OutgoingWebhook, post *model.Post, channel *model.Channel) - UnregisterPluginCommand(pluginId, teamID, trigger string) - UnregisterPluginCommands(pluginId string) + UnregisterPluginCommand(pluginID, teamID, trigger string) + UnregisterPluginCommands(pluginID string) UpdateActive(user *model.User, active bool) (*model.User, *model.AppError) - UpdateChannelLastViewedAt(channelIds []string, userID string) *model.AppError - UpdateChannelMemberNotifyProps(data map[string]string, channelId string, userID string) (*model.ChannelMember, *model.AppError) - UpdateChannelMemberRoles(channelId string, userID string, newRoles string) (*model.ChannelMember, *model.AppError) - UpdateChannelMemberSchemeRoles(channelId string, userID string, isSchemeGuest bool, isSchemeUser bool, isSchemeAdmin bool) (*model.ChannelMember, *model.AppError) + UpdateChannelLastViewedAt(channelIDs []string, userID string) *model.AppError + UpdateChannelMemberNotifyProps(data map[string]string, channelID string, userID string) (*model.ChannelMember, *model.AppError) + UpdateChannelMemberRoles(channelID string, userID string, newRoles string) (*model.ChannelMember, *model.AppError) + UpdateChannelMemberSchemeRoles(channelID string, userID string, isSchemeGuest bool, isSchemeUser bool, isSchemeAdmin bool) (*model.ChannelMember, *model.AppError) UpdateChannelPrivacy(oldChannel *model.Channel, user *model.User) (*model.Channel, *model.AppError) UpdateCommand(oldCmd, updatedCmd *model.Command) (*model.Command, *model.AppError) UpdateConfig(f func(*model.Config)) @@ -1032,7 +1032,7 @@ type AppIface interface { UpdateUserRolesWithUser(user *model.User, newRoles string, sendWebSocketEvent bool) (*model.User, *model.AppError) UploadData(us *model.UploadSession, rd io.Reader) (*model.FileInfo, *model.AppError) UploadEmojiImage(id string, imageData *multipart.FileHeader) *model.AppError - UploadMultipartFiles(teamID string, channelId string, userID string, fileHeaders []*multipart.FileHeader, clientIds []string, now time.Time) (*model.FileUploadResponse, *model.AppError) + UploadMultipartFiles(teamID string, channelID string, userID string, fileHeaders []*multipart.FileHeader, clientIds []string, now time.Time) (*model.FileUploadResponse, *model.AppError) UpsertGroupMember(groupID string, userID string) (*model.GroupMember, *model.AppError) UpsertGroupSyncable(groupSyncable *model.GroupSyncable) (*model.GroupSyncable, *model.AppError) UserAgent() string @@ -1040,6 +1040,6 @@ type AppIface interface { VerifyEmailFromToken(userSuppliedTokenString string) *model.AppError VerifyUserEmail(userID, email string) *model.AppError ViewChannel(view *model.ChannelView, userID string, currentSessionId string) (map[string]int64, *model.AppError) - WaitForChannelMembership(channelId string, userID string) + WaitForChannelMembership(channelID string, userID string) WriteFile(fr io.Reader, path string) (int64, *model.AppError) } diff --git a/app/authorization.go b/app/authorization.go index efba02cc165..162dab29665 100644 --- a/app/authorization.go +++ b/app/authorization.go @@ -54,8 +54,8 @@ func (a *App) SessionHasPermissionToTeam(session model.Session, teamID string, p return a.RolesGrantPermission(session.GetUserRoles(), permission.Id) } -func (a *App) SessionHasPermissionToChannel(session model.Session, channelId string, permission *model.Permission) bool { - if channelId == "" { +func (a *App) SessionHasPermissionToChannel(session model.Session, channelID string, permission *model.Permission) bool { + if channelID == "" { return false } @@ -63,7 +63,7 @@ func (a *App) SessionHasPermissionToChannel(session model.Session, channelId str var channelRoles []string if err == nil { - if roles, ok := ids[channelId]; ok { + if roles, ok := ids[channelID]; ok { channelRoles = strings.Fields(roles) if a.RolesGrantPermission(channelRoles, permission.Id) { return true @@ -71,7 +71,7 @@ func (a *App) SessionHasPermissionToChannel(session model.Session, channelId str } } - channel, appErr := a.GetChannel(channelId) + channel, appErr := a.GetChannel(channelID) if appErr != nil && appErr.StatusCode == http.StatusNotFound { return false } @@ -87,15 +87,15 @@ func (a *App) SessionHasPermissionToChannel(session model.Session, channelId str return a.SessionHasPermissionTo(session, permission) } -func (a *App) SessionHasPermissionToChannelByPost(session model.Session, postId string, permission *model.Permission) bool { - if channelMember, err := a.Srv().Store.Channel().GetMemberForPost(postId, session.UserId); err == nil { +func (a *App) SessionHasPermissionToChannelByPost(session model.Session, postID string, permission *model.Permission) bool { + if channelMember, err := a.Srv().Store.Channel().GetMemberForPost(postID, session.UserId); err == nil { if a.RolesGrantPermission(channelMember.GetRoles(), permission.Id) { return true } } - if channel, err := a.Srv().Store.Channel().GetForPost(postId); err == nil { + if channel, err := a.Srv().Store.Channel().GetForPost(postID); err == nil { if channel.TeamId != "" { return a.SessionHasPermissionToTeam(session, channel.TeamId, permission) } @@ -170,12 +170,12 @@ func (a *App) HasPermissionToTeam(askingUserId string, teamID string, permission return a.HasPermissionTo(askingUserId, permission) } -func (a *App) HasPermissionToChannel(askingUserId string, channelId string, permission *model.Permission) bool { - if channelId == "" || askingUserId == "" { +func (a *App) HasPermissionToChannel(askingUserId string, channelID string, permission *model.Permission) bool { + if channelID == "" || askingUserId == "" { return false } - channelMember, err := a.GetChannelMember(channelId, askingUserId) + channelMember, err := a.GetChannelMember(channelID, askingUserId) if err == nil { roles := channelMember.GetRoles() if a.RolesGrantPermission(roles, permission.Id) { @@ -184,7 +184,7 @@ func (a *App) HasPermissionToChannel(askingUserId string, channelId string, perm } var channel *model.Channel - channel, err = a.GetChannel(channelId) + channel, err = a.GetChannel(channelID) if err == nil { return a.HasPermissionToTeam(askingUserId, channel.TeamId, permission) } @@ -192,14 +192,14 @@ func (a *App) HasPermissionToChannel(askingUserId string, channelId string, perm return a.HasPermissionTo(askingUserId, permission) } -func (a *App) HasPermissionToChannelByPost(askingUserId string, postId string, permission *model.Permission) bool { - if channelMember, err := a.Srv().Store.Channel().GetMemberForPost(postId, askingUserId); err == nil { +func (a *App) HasPermissionToChannelByPost(askingUserId string, postID string, permission *model.Permission) bool { + if channelMember, err := a.Srv().Store.Channel().GetMemberForPost(postID, askingUserId); err == nil { if a.RolesGrantPermission(channelMember.GetRoles(), permission.Id) { return true } } - if channel, err := a.Srv().Store.Channel().GetForPost(postId); err == nil { + if channel, err := a.Srv().Store.Channel().GetForPost(postID); err == nil { return a.HasPermissionToTeam(askingUserId, channel.TeamId, permission) } diff --git a/app/channel.go b/app/channel.go index 2c82ee02b7f..8c3c91be631 100644 --- a/app/channel.go +++ b/app/channel.go @@ -464,7 +464,7 @@ func (a *App) createDirectChannelWithUser(user, otherUser *model.User) (*model.C return channel, nil } -func (a *App) WaitForChannelMembership(channelId string, userID string) { +func (a *App) WaitForChannelMembership(channelID string, userID string) { if len(a.Config().SqlSettings.DataSourceReplicas) == 0 { return } @@ -475,7 +475,7 @@ func (a *App) WaitForChannelMembership(channelId string, userID string) { time.Sleep(100 * time.Millisecond) - _, err := a.Srv().Store.Channel().GetMember(channelId, userID) + _, err := a.Srv().Store.Channel().GetMember(channelID, userID) // If the membership was found then return if err == nil { @@ -489,7 +489,7 @@ func (a *App) WaitForChannelMembership(channelId string, userID string) { } } - mlog.Error("WaitForChannelMembership giving up", mlog.String("channel_id", channelId), mlog.String("user_id", userID)) + mlog.Error("WaitForChannelMembership giving up", mlog.String("channel_id", channelID), mlog.String("user_id", userID)) } func (a *App) CreateGroupChannel(userIDs []string, creatorId string) (*model.Channel, *model.AppError) { @@ -811,8 +811,8 @@ func (a *App) PatchChannel(channel *model.Channel, patch *model.ChannelPatch, us } // GetSchemeRolesForChannel Checks if a channel or its team has an override scheme for channel roles and returns the scheme roles or default channel roles. -func (a *App) GetSchemeRolesForChannel(channelId string) (guestRoleName, userRoleName, adminRoleName string, err *model.AppError) { - channel, err := a.GetChannel(channelId) +func (a *App) GetSchemeRolesForChannel(channelID string) (guestRoleName, userRoleName, adminRoleName string, err *model.AppError) { + channel, err := a.GetChannel(channelID) if err != nil { return } @@ -1074,14 +1074,14 @@ func buildChannelModerations(channelType string, memberRole *model.Role, guestRo return channelModerations } -func (a *App) UpdateChannelMemberRoles(channelId string, userID string, newRoles string) (*model.ChannelMember, *model.AppError) { +func (a *App) UpdateChannelMemberRoles(channelID string, userID string, newRoles string) (*model.ChannelMember, *model.AppError) { var member *model.ChannelMember var err *model.AppError - if member, err = a.GetChannelMember(channelId, userID); err != nil { + if member, err = a.GetChannelMember(channelID, userID); err != nil { return nil, err } - schemeGuestRole, schemeUserRole, schemeAdminRole, err := a.GetSchemeRolesForChannel(channelId) + schemeGuestRole, schemeUserRole, schemeAdminRole, err := a.GetSchemeRolesForChannel(channelID) if err != nil { return nil, err } @@ -1133,8 +1133,8 @@ func (a *App) UpdateChannelMemberRoles(channelId string, userID string, newRoles return a.updateChannelMember(member) } -func (a *App) UpdateChannelMemberSchemeRoles(channelId string, userID string, isSchemeGuest bool, isSchemeUser bool, isSchemeAdmin bool) (*model.ChannelMember, *model.AppError) { - member, err := a.GetChannelMember(channelId, userID) +func (a *App) UpdateChannelMemberSchemeRoles(channelID string, userID string, isSchemeGuest bool, isSchemeUser bool, isSchemeAdmin bool) (*model.ChannelMember, *model.AppError) { + member, err := a.GetChannelMember(channelID, userID) if err != nil { return nil, err } @@ -1155,10 +1155,10 @@ func (a *App) UpdateChannelMemberSchemeRoles(channelId string, userID string, is return a.updateChannelMember(member) } -func (a *App) UpdateChannelMemberNotifyProps(data map[string]string, channelId string, userID string) (*model.ChannelMember, *model.AppError) { +func (a *App) UpdateChannelMemberNotifyProps(data map[string]string, channelID string, userID string) (*model.ChannelMember, *model.AppError) { var member *model.ChannelMember var err *model.AppError - if member, err = a.GetChannelMember(channelId, userID); err != nil { + if member, err = a.GetChannelMember(channelID, userID); err != nil { return nil, err } @@ -1586,8 +1586,8 @@ func (a *App) PostUpdateChannelDisplayNameMessage(userID string, channel *model. return nil } -func (a *App) GetChannel(channelId string) (*model.Channel, *model.AppError) { - channel, err := a.Srv().Store.Channel().Get(channelId, true) +func (a *App) GetChannel(channelID string) (*model.Channel, *model.AppError) { + channel, err := a.Srv().Store.Channel().Get(channelID, true) if err != nil { var nfErr *store.ErrNotFound switch { @@ -1739,8 +1739,8 @@ func (a *App) GetChannelsUserNotIn(teamID string, userID string, offset int, lim return channels, nil } -func (a *App) GetPublicChannelsByIdsForTeam(teamID string, channelIds []string) (*model.ChannelList, *model.AppError) { - list, err := a.Srv().Store.Channel().GetPublicChannelsByIdsForTeam(teamID, channelIds) +func (a *App) GetPublicChannelsByIdsForTeam(teamID string, channelIDs []string) (*model.ChannelList, *model.AppError) { + list, err := a.Srv().Store.Channel().GetPublicChannelsByIdsForTeam(teamID, channelIDs) if err != nil { var nfErr *store.ErrNotFound switch { @@ -1772,8 +1772,8 @@ func (a *App) GetPrivateChannelsForTeam(teamID string, offset int, limit int) (* return list, nil } -func (a *App) GetChannelMember(channelId string, userID string) (*model.ChannelMember, *model.AppError) { - channelMember, err := a.Srv().Store.Channel().GetMember(channelId, userID) +func (a *App) GetChannelMember(channelID string, userID string) (*model.ChannelMember, *model.AppError) { + channelMember, err := a.Srv().Store.Channel().GetMember(channelID, userID) if err != nil { var nfErr *store.ErrNotFound switch { @@ -1787,8 +1787,8 @@ func (a *App) GetChannelMember(channelId string, userID string) (*model.ChannelM return channelMember, nil } -func (a *App) GetChannelMembersPage(channelId string, page, perPage int) (*model.ChannelMembers, *model.AppError) { - channelMembers, err := a.Srv().Store.Channel().GetMembers(channelId, page*perPage, perPage) +func (a *App) GetChannelMembersPage(channelID string, page, perPage int) (*model.ChannelMembers, *model.AppError) { + channelMembers, err := a.Srv().Store.Channel().GetMembers(channelID, page*perPage, perPage) if err != nil { return nil, model.NewAppError("GetChannelMembersPage", "app.channel.get_members.app_error", nil, err.Error(), http.StatusInternalServerError) } @@ -1796,8 +1796,8 @@ func (a *App) GetChannelMembersPage(channelId string, page, perPage int) (*model return channelMembers, nil } -func (a *App) GetChannelMembersTimezones(channelId string) ([]string, *model.AppError) { - membersTimezones, err := a.Srv().Store.Channel().GetChannelMembersTimezones(channelId) +func (a *App) GetChannelMembersTimezones(channelID string) ([]string, *model.AppError) { + membersTimezones, err := a.Srv().Store.Channel().GetChannelMembersTimezones(channelID) if err != nil { return nil, model.NewAppError("GetChannelMembersTimezones", "app.channel.get_members.app_error", nil, err.Error(), http.StatusInternalServerError) } @@ -1813,8 +1813,8 @@ func (a *App) GetChannelMembersTimezones(channelId string) ([]string, *model.App return model.RemoveDuplicateStrings(timezones), nil } -func (a *App) GetChannelMembersByIds(channelId string, userIDs []string) (*model.ChannelMembers, *model.AppError) { - members, err := a.Srv().Store.Channel().GetMembersByIds(channelId, userIDs) +func (a *App) GetChannelMembersByIds(channelID string, userIDs []string) (*model.ChannelMembers, *model.AppError) { + members, err := a.Srv().Store.Channel().GetMembersByIds(channelID, userIDs) if err != nil { return nil, model.NewAppError("GetChannelMembersByIds", "app.channel.get_members_by_ids.app_error", nil, err.Error(), http.StatusInternalServerError) } @@ -1847,8 +1847,8 @@ func (a *App) GetChannelMembersForUserWithPagination(teamID, userID string, page return members, nil } -func (a *App) GetChannelMemberCount(channelId string) (int64, *model.AppError) { - count, err := a.Srv().Store.Channel().GetMemberCount(channelId, true) +func (a *App) GetChannelMemberCount(channelID string) (int64, *model.AppError) { + count, err := a.Srv().Store.Channel().GetMemberCount(channelID, true) if err != nil { return 0, model.NewAppError("GetChannelMemberCount", "app.channel.get_member_count.app_error", nil, err.Error(), http.StatusInternalServerError) } @@ -1856,8 +1856,8 @@ func (a *App) GetChannelMemberCount(channelId string) (int64, *model.AppError) { return count, nil } -func (a *App) GetChannelGuestCount(channelId string) (int64, *model.AppError) { - count, err := a.Srv().Store.Channel().GetGuestCount(channelId, true) +func (a *App) GetChannelGuestCount(channelID string) (int64, *model.AppError) { + count, err := a.Srv().Store.Channel().GetGuestCount(channelID, true) if err != nil { return 0, model.NewAppError("SqlChannelStore.GetGuestCount", "app.channel.get_member_count.app_error", nil, err.Error(), http.StatusInternalServerError) } @@ -1865,8 +1865,8 @@ func (a *App) GetChannelGuestCount(channelId string) (int64, *model.AppError) { return count, nil } -func (a *App) GetChannelPinnedPostCount(channelId string) (int64, *model.AppError) { - count, err := a.Srv().Store.Channel().GetPinnedPostCount(channelId, true) +func (a *App) GetChannelPinnedPostCount(channelID string) (int64, *model.AppError) { + count, err := a.Srv().Store.Channel().GetPinnedPostCount(channelID, true) if err != nil { return 0, model.NewAppError("GetChannelPinnedPostCount", "app.channel.get_pinnedpost_count.app_error", nil, err.Error(), http.StatusInternalServerError) } @@ -1883,8 +1883,8 @@ func (a *App) GetChannelCounts(teamID string, userID string) (*model.ChannelCoun return counts, nil } -func (a *App) GetChannelUnread(channelId, userID string) (*model.ChannelUnread, *model.AppError) { - channelUnread, err := a.Srv().Store.Channel().GetChannelUnread(channelId, userID) +func (a *App) GetChannelUnread(channelID, userID string) (*model.ChannelUnread, *model.AppError) { + channelUnread, err := a.Srv().Store.Channel().GetChannelUnread(channelID, userID) if err != nil { var nfErr *store.ErrNotFound switch { @@ -2005,10 +2005,10 @@ func (a *App) postJoinTeamMessage(user *model.User, channel *model.Channel) *mod return nil } -func (a *App) LeaveChannel(channelId string, userID string) *model.AppError { +func (a *App) LeaveChannel(channelID string, userID string) *model.AppError { sc := make(chan store.StoreResult, 1) go func() { - channel, err := a.Srv().Store.Channel().Get(channelId, true) + channel, err := a.Srv().Store.Channel().Get(channelID, true) sc <- store.StoreResult{Data: channel, NErr: err} close(sc) }() @@ -2022,7 +2022,7 @@ func (a *App) LeaveChannel(channelId string, userID string) *model.AppError { mcc := make(chan store.StoreResult, 1) go func() { - count, err := a.Srv().Store.Channel().GetMemberCount(channelId, false) + count, err := a.Srv().Store.Channel().GetMemberCount(channelID, false) mcc <- store.StoreResult{Data: count, NErr: err} close(mcc) }() @@ -2306,17 +2306,17 @@ func (a *App) GetNumberOfChannelsOnTeam(teamID string) (int, *model.AppError) { return len(*list), nil } -func (a *App) SetActiveChannel(userID string, channelId string) *model.AppError { +func (a *App) SetActiveChannel(userID string, channelID string) *model.AppError { status, err := a.GetStatus(userID) oldStatus := model.STATUS_OFFLINE if err != nil { - status = &model.Status{UserId: userID, Status: model.STATUS_ONLINE, Manual: false, LastActivityAt: model.GetMillis(), ActiveChannel: channelId} + status = &model.Status{UserId: userID, Status: model.STATUS_ONLINE, Manual: false, LastActivityAt: model.GetMillis(), ActiveChannel: channelID} } else { oldStatus = status.Status - status.ActiveChannel = channelId - if !status.Manual && channelId != "" { + status.ActiveChannel = channelID + if !status.Manual && channelID != "" { status.Status = model.STATUS_ONLINE } status.LastActivityAt = model.GetMillis() @@ -2331,8 +2331,8 @@ func (a *App) SetActiveChannel(userID string, channelId string) *model.AppError return nil } -func (a *App) UpdateChannelLastViewedAt(channelIds []string, userID string) *model.AppError { - if _, err := a.Srv().Store.Channel().UpdateLastViewedAt(channelIds, userID, *a.Config().ServiceSettings.ThreadAutoFollow); err != nil { +func (a *App) UpdateChannelLastViewedAt(channelIDs []string, userID string) *model.AppError { + if _, err := a.Srv().Store.Channel().UpdateLastViewedAt(channelIDs, userID, *a.Config().ServiceSettings.ThreadAutoFollow); err != nil { var invErr *store.ErrInvalidInput switch { case errors.As(err, &invErr): @@ -2343,9 +2343,9 @@ func (a *App) UpdateChannelLastViewedAt(channelIds []string, userID string) *mod } if *a.Config().ServiceSettings.EnableChannelViewedMessages { - for _, channelId := range channelIds { + for _, channelID := range channelIDs { message := model.NewWebSocketEvent(model.WEBSOCKET_EVENT_CHANNEL_VIEWED, "", "", userID, nil) - message.Add("channel_id", channelId) + message.Add("channel_id", channelID) a.Publish(message) } } @@ -2518,18 +2518,18 @@ func (a *App) SearchChannelsUserNotIn(teamID string, userID string, term string) return channelList, nil } -func (a *App) MarkChannelsAsViewed(channelIds []string, userID string, currentSessionId string) (map[string]int64, *model.AppError) { +func (a *App) MarkChannelsAsViewed(channelIDs []string, userID string, currentSessionId string) (map[string]int64, *model.AppError) { // I start looking for channels with notifications before I mark it as read, to clear the push notifications if needed channelsToClearPushNotifications := []string{} if *a.Config().EmailSettings.SendPushNotifications { - for _, channelId := range channelIds { - channel, errCh := a.Srv().Store.Channel().Get(channelId, true) + for _, channelID := range channelIDs { + channel, errCh := a.Srv().Store.Channel().Get(channelID, true) if errCh != nil { mlog.Warn("Failed to get channel", mlog.Err(errCh)) continue } - member, err := a.Srv().Store.Channel().GetMember(channelId, userID) + member, err := a.Srv().Store.Channel().GetMember(channelID, userID) if err != nil { mlog.Warn("Failed to get membership", mlog.Err(err)) continue @@ -2545,21 +2545,21 @@ func (a *App) MarkChannelsAsViewed(channelIds []string, userID string, currentSe notify = user.NotifyProps[model.PUSH_NOTIFY_PROP] } if notify == model.USER_NOTIFY_ALL { - if count, err := a.Srv().Store.User().GetAnyUnreadPostCountForChannel(userID, channelId); err == nil { + if count, err := a.Srv().Store.User().GetAnyUnreadPostCountForChannel(userID, channelID); err == nil { if count > 0 { - channelsToClearPushNotifications = append(channelsToClearPushNotifications, channelId) + channelsToClearPushNotifications = append(channelsToClearPushNotifications, channelID) } } } else if notify == model.USER_NOTIFY_MENTION || channel.Type == model.CHANNEL_DIRECT { - if count, err := a.Srv().Store.User().GetUnreadCountForChannel(userID, channelId); err == nil { + if count, err := a.Srv().Store.User().GetUnreadCountForChannel(userID, channelID); err == nil { if count > 0 { - channelsToClearPushNotifications = append(channelsToClearPushNotifications, channelId) + channelsToClearPushNotifications = append(channelsToClearPushNotifications, channelID) } } } } } - times, err := a.Srv().Store.Channel().UpdateLastViewedAt(channelIds, userID, *a.Config().ServiceSettings.ThreadAutoFollow) + times, err := a.Srv().Store.Channel().UpdateLastViewedAt(channelIDs, userID, *a.Config().ServiceSettings.ThreadAutoFollow) if err != nil { var invErr *store.ErrInvalidInput switch { @@ -2571,14 +2571,14 @@ func (a *App) MarkChannelsAsViewed(channelIds []string, userID string, currentSe } if *a.Config().ServiceSettings.EnableChannelViewedMessages { - for _, channelId := range channelIds { + for _, channelID := range channelIDs { message := model.NewWebSocketEvent(model.WEBSOCKET_EVENT_CHANNEL_VIEWED, "", "", userID, nil) - message.Add("channel_id", channelId) + message.Add("channel_id", channelID) a.Publish(message) } } - for _, channelId := range channelsToClearPushNotifications { - a.clearPushNotification(currentSessionId, userID, channelId) + for _, channelID := range channelsToClearPushNotifications { + a.clearPushNotification(currentSessionId, userID, channelID) } return times, nil } @@ -2588,21 +2588,21 @@ func (a *App) ViewChannel(view *model.ChannelView, userID string, currentSession return nil, err } - channelIds := []string{} + channelIDs := []string{} if view.ChannelId != "" { - channelIds = append(channelIds, view.ChannelId) + channelIDs = append(channelIDs, view.ChannelId) } if view.PrevChannelId != "" { - channelIds = append(channelIds, view.PrevChannelId) + channelIDs = append(channelIDs, view.PrevChannelId) } - if len(channelIds) == 0 { + if len(channelIDs) == 0 { return map[string]int64{}, nil } - return a.MarkChannelsAsViewed(channelIds, userID, currentSessionId) + return a.MarkChannelsAsViewed(channelIDs, userID, currentSessionId) } func (a *App) PermanentDeleteChannel(channel *model.Channel) *model.AppError { @@ -2807,8 +2807,8 @@ func (a *App) RemoveUsersFromChannelNotMemberOfTeam(remover *model.User, channel return nil } -func (a *App) GetPinnedPosts(channelId string) (*model.PostList, *model.AppError) { - posts, err := a.Srv().Store.Channel().GetPinnedPosts(channelId) +func (a *App) GetPinnedPosts(channelID string) (*model.PostList, *model.AppError) { + posts, err := a.Srv().Store.Channel().GetPinnedPosts(channelID) if err != nil { return nil, model.NewAppError("GetPinnedPosts", "app.channel.pinned_posts.app_error", nil, err.Error(), http.StatusInternalServerError) } @@ -2816,8 +2816,8 @@ func (a *App) GetPinnedPosts(channelId string) (*model.PostList, *model.AppError return posts, nil } -func (a *App) ToggleMuteChannel(channelId, userID string) (*model.ChannelMember, *model.AppError) { - member, nErr := a.Srv().Store.Channel().GetMember(channelId, userID) +func (a *App) ToggleMuteChannel(channelID, userID string) (*model.ChannelMember, *model.AppError) { + member, nErr := a.Srv().Store.Channel().GetMember(channelID, userID) if nErr != nil { var appErr *model.AppError var nfErr *store.ErrNotFound @@ -2843,8 +2843,8 @@ func (a *App) ToggleMuteChannel(channelId, userID string) (*model.ChannelMember, return member, nil } -func (a *App) setChannelsMuted(channelIds []string, userID string, muted bool) ([]*model.ChannelMember, *model.AppError) { - members, nErr := a.Srv().Store.Channel().GetMembersByChannelIds(channelIds, userID) +func (a *App) setChannelsMuted(channelIDs []string, userID string, muted bool) ([]*model.ChannelMember, *model.AppError) { + members, nErr := a.Srv().Store.Channel().GetMembersByChannelIds(channelIDs, userID) if nErr != nil { var appErr *model.AppError switch { diff --git a/app/channel_category.go b/app/channel_category.go index f609e85c85c..888ea04d168 100644 --- a/app/channel_category.go +++ b/app/channel_category.go @@ -191,14 +191,14 @@ func (a *App) muteChannelsForUpdatedCategories(userID string, updatedCategories updatedCategoriesById := makeCategoryMap(updatedCategories) originalCategoriesById := makeCategoryMap(originalCategories) - for channelId, diff := range channelsDiff { + for channelID, diff := range channelsDiff { fromCategory := originalCategoriesById[diff.fromCategoryId] toCategory := updatedCategoriesById[diff.toCategoryId] if toCategory.Muted && !fromCategory.Muted { - channelsToMute = append(channelsToMute, channelId) + channelsToMute = append(channelsToMute, channelID) } else if !toCategory.Muted && fromCategory.Muted { - channelsToUnmute = append(channelsToUnmute, channelId) + channelsToUnmute = append(channelsToUnmute, channelID) } } } @@ -236,8 +236,8 @@ func diffChannelsBetweenCategories(updatedCategories []*model.SidebarCategoryWit mapChannelIdsToCategories := func(categories []*model.SidebarCategoryWithChannels) map[string]string { result := make(map[string]string) for _, category := range categories { - for _, channelId := range category.Channels { - result[channelId] = category.Id + for _, channelID := range category.Channels { + result[channelID] = category.Id } } @@ -250,11 +250,11 @@ func diffChannelsBetweenCategories(updatedCategories []*model.SidebarCategoryWit // Check for any channels that have changed categories. Note that we don't worry about any channels that have moved // outside of these categories since that heavily complicates things and doesn't currently happen in our apps. channelsDiff := make(map[string]*categoryChannelDiff) - for channelId, originalCategoryId := range originalChannelIdsMap { - updatedCategoryId := updatedChannelIdsMap[channelId] + for channelID, originalCategoryId := range originalChannelIdsMap { + updatedCategoryId := updatedChannelIdsMap[channelID] if originalCategoryId != updatedCategoryId && updatedCategoryId != "" { - channelsDiff[channelId] = &categoryChannelDiff{originalCategoryId, updatedCategoryId} + channelsDiff[channelID] = &categoryChannelDiff{originalCategoryId, updatedCategoryId} } } diff --git a/app/email.go b/app/email.go index a0dfd87909f..863fe001561 100644 --- a/app/email.go +++ b/app/email.go @@ -434,16 +434,16 @@ func (es *EmailService) sendGuestInviteEmails(team *model.Team, channels []*mode map[string]interface{}{"TeamDisplayName": team.DisplayName}) bodyPage.Props["TeamURL"] = siteURL + "/" + team.Name - channelIds := []string{} + channelIDs := []string{} for _, channel := range channels { - channelIds = append(channelIds, channel.Id) + channelIDs = append(channelIDs, channel.Id) } token := model.NewToken( TokenTypeGuestInvitation, model.MapToJson(map[string]string{ "teamId": team.Id, - "channels": strings.Join(channelIds, " "), + "channels": strings.Join(channelIDs, " "), "email": invite, "guest": "true", }), diff --git a/app/expirynotify_test.go b/app/expirynotify_test.go index d90d1c06948..81c5a5fa5be 100644 --- a/app/expirynotify_test.go +++ b/app/expirynotify_test.go @@ -44,20 +44,20 @@ func TestNotifySessionsExpired(t *testing.T) { }) data := []struct { - deviceId string + deviceID string expiresAt int64 notified bool }{ - {deviceId: "android:11111", expiresAt: model.GetMillis() + 100000, notified: false}, - {deviceId: "android:22222", expiresAt: model.GetMillis() - 1000, notified: false}, - {deviceId: "android:33333", expiresAt: model.GetMillis() - 2000, notified: false}, - {deviceId: "android:44444", expiresAt: model.GetMillis() - 3000, notified: true}, + {deviceID: "android:11111", expiresAt: model.GetMillis() + 100000, notified: false}, + {deviceID: "android:22222", expiresAt: model.GetMillis() - 1000, notified: false}, + {deviceID: "android:33333", expiresAt: model.GetMillis() - 2000, notified: false}, + {deviceID: "android:44444", expiresAt: model.GetMillis() - 3000, notified: true}, } for _, d := range data { _, err := th.App.CreateSession(&model.Session{ UserId: th.BasicUser.Id, - DeviceId: d.deviceId, + DeviceId: d.deviceID, ExpiresAt: d.expiresAt, ExpiredNotify: d.notified, }) diff --git a/app/export.go b/app/export.go index 62a64a6280e..0ef85df080c 100644 --- a/app/export.go +++ b/app/export.go @@ -440,11 +440,11 @@ func (a *App) exportAllPosts(writer io.Writer, withAttachments bool) ([]Attachme } } -func (a *App) buildPostReplies(postId string, withAttachments bool) ([]ReplyImportData, []AttachmentImportData, *model.AppError) { +func (a *App) buildPostReplies(postID string, withAttachments bool) ([]ReplyImportData, []AttachmentImportData, *model.AppError) { var replies []ReplyImportData var attachments []AttachmentImportData - replyPosts, nErr := a.Srv().Store.Post().GetRepliesForExport(postId) + replyPosts, nErr := a.Srv().Store.Post().GetRepliesForExport(postID) if nErr != nil { return nil, nil, model.NewAppError("buildPostReplies", "app.post.get_posts.app_error", nil, nErr.Error(), http.StatusInternalServerError) } @@ -475,10 +475,10 @@ func (a *App) buildPostReplies(postId string, withAttachments bool) ([]ReplyImpo return replies, attachments, nil } -func (a *App) BuildPostReactions(postId string) (*[]ReactionImportData, *model.AppError) { +func (a *App) BuildPostReactions(postID string) (*[]ReactionImportData, *model.AppError) { var reactionsOfPost []ReactionImportData - reactions, nErr := a.Srv().Store.Reaction().GetForPost(postId, true) + reactions, nErr := a.Srv().Store.Reaction().GetForPost(postID, true) if nErr != nil { return nil, model.NewAppError("BuildPostReactions", "app.reaction.get_for_post.app_error", nil, nErr.Error(), http.StatusInternalServerError) } @@ -500,8 +500,8 @@ func (a *App) BuildPostReactions(postId string) (*[]ReactionImportData, *model.A } -func (a *App) buildPostAttachments(postId string) ([]AttachmentImportData, *model.AppError) { - infos, nErr := a.Srv().Store.FileInfo().GetForPost(postId, false, false, false) +func (a *App) buildPostAttachments(postID string) ([]AttachmentImportData, *model.AppError) { + infos, nErr := a.Srv().Store.FileInfo().GetForPost(postID, false, false, false) if nErr != nil { return nil, model.NewAppError("buildPostAttachments", "app.file_info.get_for_post.app_error", nil, nErr.Error(), http.StatusInternalServerError) } diff --git a/app/file.go b/app/file.go index e2c3d8d8139..1ad3bae82a6 100644 --- a/app/file.go +++ b/app/file.go @@ -251,9 +251,9 @@ func (a *App) RemoveDirectory(path string) *model.AppError { return nil } -func (a *App) getInfoForFilename(post *model.Post, teamID, channelId, userID, oldId, filename string) *model.FileInfo { +func (a *App) getInfoForFilename(post *model.Post, teamID, channelID, userID, oldId, filename string) *model.FileInfo { name, _ := url.QueryUnescape(filename) - pathPrefix := fmt.Sprintf("teams/%s/channels/%s/users/%s/%s/", teamID, channelId, userID, oldId) + pathPrefix := fmt.Sprintf("teams/%s/channels/%s/users/%s/%s/", teamID, channelID, userID, oldId) path := pathPrefix + name // Open the file and populate the fields of the FileInfo @@ -325,8 +325,8 @@ func (a *App) findTeamIdForFilename(post *model.Post, id, filename string) strin var fileMigrationLock sync.Mutex var oldFilenameMatchExp *regexp.Regexp = regexp.MustCompile(`^\/([a-z\d]{26})\/([a-z\d]{26})\/([a-z\d]{26})\/([^\/]+)$`) -// Parse the path from the Filename of the form /{channelId}/{userID}/{uid}/{nameWithExtension} -func parseOldFilenames(filenames []string, channelId, userID string) [][]string { +// Parse the path from the Filename of the form /{channelID}/{userID}/{uid}/{nameWithExtension} +func parseOldFilenames(filenames []string, channelID, userID string) [][]string { parsed := [][]string{} for _, filename := range filenames { matches := oldFilenameMatchExp.FindStringSubmatch(filename) @@ -334,8 +334,8 @@ func parseOldFilenames(filenames []string, channelId, userID string) [][]string mlog.Error("Failed to parse old Filename", mlog.String("filename", filename)) continue } - if matches[1] != channelId { - mlog.Error("ChannelId in Filename does not match", mlog.String("channel_id", channelId), mlog.String("matched", matches[1])) + if matches[1] != channelID { + mlog.Error("ChannelId in Filename does not match", mlog.String("channel_id", channelID), mlog.String("matched", matches[1])) } else if matches[2] != userID { mlog.Error("UserId in Filename does not match", mlog.String("user_id", userID), mlog.String("matched", matches[2])) } else { @@ -427,7 +427,7 @@ func (a *App) MigrateFilenamesToFileInfos(post *model.Post) []*model.FileInfo { mlog.Debug("Migrating post to use FileInfos", mlog.String("post_id", post.Id)) savedInfos := make([]*model.FileInfo, 0, len(infos)) - fileIds := make([]string, 0, len(filenames)) + fileIDs := make([]string, 0, len(filenames)) for _, info := range infos { if _, nErr = a.Srv().Store.FileInfo().Save(info); nErr != nil { mlog.Error( @@ -441,14 +441,14 @@ func (a *App) MigrateFilenamesToFileInfos(post *model.Post) []*model.FileInfo { } savedInfos = append(savedInfos, info) - fileIds = append(fileIds, info.Id) + fileIDs = append(fileIDs, info.Id) } // Copy and save the updated post newPost := post.Clone() newPost.Filenames = []string{} - newPost.FileIds = fileIds + newPost.FileIds = fileIDs // Update Posts to clear Filenames and set FileIds if _, nErr = a.Srv().Store.Post().Update(newPost, post); nErr != nil { @@ -469,15 +469,15 @@ func (a *App) GeneratePublicLink(siteURL string, info *model.FileInfo) string { return fmt.Sprintf("%s/files/%v/public?h=%s", siteURL, info.Id, hash) } -func GeneratePublicLinkHash(fileId, salt string) string { +func GeneratePublicLinkHash(fileID, salt string) string { hash := sha256.New() hash.Write([]byte(salt)) - hash.Write([]byte(fileId)) + hash.Write([]byte(fileID)) return base64.RawURLEncoding.EncodeToString(hash.Sum(nil)) } -func (a *App) UploadMultipartFiles(teamID string, channelId string, userID string, fileHeaders []*multipart.FileHeader, clientIds []string, now time.Time) (*model.FileUploadResponse, *model.AppError) { +func (a *App) UploadMultipartFiles(teamID string, channelID string, userID string, fileHeaders []*multipart.FileHeader, clientIds []string, now time.Time) (*model.FileUploadResponse, *model.AppError) { files := make([]io.ReadCloser, len(fileHeaders)) filenames := make([]string, len(fileHeaders)) @@ -495,13 +495,13 @@ func (a *App) UploadMultipartFiles(teamID string, channelId string, userID strin filenames[i] = fileHeader.Filename } - return a.UploadFiles(teamID, channelId, userID, files, filenames, clientIds, now) + return a.UploadFiles(teamID, channelID, userID, files, filenames, clientIds, now) } // Uploads some files to the given team and channel as the given user. files and filenames should have // the same length. clientIds should either not be provided or have the same length as files and filenames. // The provided files should be closed by the caller so that they are not leaked. -func (a *App) UploadFiles(teamID string, channelId string, userID string, files []io.ReadCloser, filenames []string, clientIds []string, now time.Time) (*model.FileUploadResponse, *model.AppError) { +func (a *App) UploadFiles(teamID string, channelID string, userID string, files []io.ReadCloser, filenames []string, clientIds []string, now time.Time) (*model.FileUploadResponse, *model.AppError) { if *a.Config().FileSettings.DriverName == "" { return nil, model.NewAppError("UploadFiles", "api.file.upload_file.storage.app_error", nil, "", http.StatusNotImplemented) } @@ -524,7 +524,7 @@ func (a *App) UploadFiles(teamID string, channelId string, userID string, files io.Copy(buf, file) data := buf.Bytes() - info, data, err := a.DoUploadFileExpectModification(now, teamID, channelId, userID, filenames[i], data) + info, data, err := a.DoUploadFileExpectModification(now, teamID, channelID, userID, filenames[i], data) if err != nil { return nil, err } @@ -548,14 +548,14 @@ func (a *App) UploadFiles(teamID string, channelId string, userID string, files } // UploadFile uploads a single file in form of a completely constructed byte array for a channel. -func (a *App) UploadFile(data []byte, channelId string, filename string) (*model.FileInfo, *model.AppError) { - _, err := a.GetChannel(channelId) - if err != nil && channelId != "" { +func (a *App) UploadFile(data []byte, channelID string, filename string) (*model.FileInfo, *model.AppError) { + _, err := a.GetChannel(channelID) + if err != nil && channelID != "" { return nil, model.NewAppError("UploadFile", "api.file.upload_file.incorrect_channelId.app_error", - map[string]interface{}{"channelId": channelId}, "", http.StatusBadRequest) + map[string]interface{}{"channelId": channelID}, "", http.StatusBadRequest) } - info, _, appError := a.DoUploadFileExpectModification(time.Now(), "noteam", channelId, "nouser", filename, data) + info, _, appError := a.DoUploadFileExpectModification(time.Now(), "noteam", channelID, "nouser", filename, data) if appError != nil { return nil, appError } @@ -694,11 +694,11 @@ func (t *UploadFileTask) init(a *App) { // returns a filled-out FileInfo and an optional error. A plugin may reject the // upload, returning a rejection error. In this case FileInfo would have // contained the last "good" FileInfo before the execution of that plugin. -func (a *App) UploadFileX(channelId, name string, input io.Reader, +func (a *App) UploadFileX(channelID, name string, input io.Reader, opts ...func(*UploadFileTask)) (*model.FileInfo, *model.AppError) { t := &UploadFileTask{ - ChannelId: filepath.Base(channelId), + ChannelId: filepath.Base(channelID), Name: filepath.Base(name), Input: input, maxFileSize: *a.Config().FileSettings.MaxFileSize, @@ -942,7 +942,7 @@ func (t UploadFileTask) newAppError(id string, details interface{}, httpStatus i func (a *App) DoUploadFileExpectModification(now time.Time, rawTeamId string, rawChannelId string, rawUserId string, rawFilename string, data []byte) (*model.FileInfo, []byte, *model.AppError) { filename := filepath.Base(rawFilename) teamID := filepath.Base(rawTeamId) - channelId := filepath.Base(rawChannelId) + channelID := filepath.Base(rawChannelId) userID := filepath.Base(rawUserId) info, err := model.GetInfoForBytes(filename, bytes.NewReader(data), len(data)) @@ -963,7 +963,7 @@ func (a *App) DoUploadFileExpectModification(now time.Time, rawTeamId string, ra info.CreatorId = userID info.CreateAt = now.UnixNano() / int64(time.Millisecond) - pathPrefix := now.Format("20060102") + "/teams/" + teamID + "/channels/" + channelId + "/users/" + userID + "/" + info.Id + "/" + pathPrefix := now.Format("20060102") + "/teams/" + teamID + "/channels/" + channelID + "/users/" + userID + "/" + info.Id + "/" info.Path = pathPrefix + filename if info.IsImage() { @@ -1174,8 +1174,8 @@ func (a *App) generateMiniPreviewForInfos(fileInfos []*model.FileInfo) { wg.Wait() } -func (a *App) GetFileInfo(fileId string) (*model.FileInfo, *model.AppError) { - fileInfo, err := a.Srv().Store.FileInfo().Get(fileId) +func (a *App) GetFileInfo(fileID string) (*model.FileInfo, *model.AppError) { + fileInfo, err := a.Srv().Store.FileInfo().Get(fileID) if err != nil { var nfErr *store.ErrNotFound switch { @@ -1210,8 +1210,8 @@ func (a *App) GetFileInfos(page, perPage int, opt *model.GetFileInfosOptions) ([ return fileInfos, nil } -func (a *App) GetFile(fileId string) ([]byte, *model.AppError) { - info, err := a.GetFileInfo(fileId) +func (a *App) GetFile(fileID string) ([]byte, *model.AppError) { + info, err := a.GetFileInfo(fileID) if err != nil { return nil, err } @@ -1224,13 +1224,13 @@ func (a *App) GetFile(fileId string) ([]byte, *model.AppError) { return data, nil } -func (a *App) CopyFileInfos(userID string, fileIds []string) ([]string, *model.AppError) { +func (a *App) CopyFileInfos(userID string, fileIDs []string) ([]string, *model.AppError) { var newFileIds []string now := model.GetMillis() - for _, fileId := range fileIds { - fileInfo, err := a.Srv().Store.FileInfo().Get(fileId) + for _, fileID := range fileIDs { + fileInfo, err := a.Srv().Store.FileInfo().Get(fileID) if err != nil { var nfErr *store.ErrNotFound switch { diff --git a/app/file_bench_test.go b/app/file_bench_test.go index 8bf3d7a8dcc..aa4d392b9df 100644 --- a/app/file_bench_test.go +++ b/app/file_bench_test.go @@ -62,7 +62,7 @@ func BenchmarkUploadFile(b *testing.B) { // disable logging in the benchmark, as best we can th.App.Log().SetConsoleLevel(mlog.LevelError) teamID := model.NewId() - channelId := model.NewId() + channelID := model.NewId() userID := model.NewId() mb := func(i int) int { @@ -86,7 +86,7 @@ func BenchmarkUploadFile(b *testing.B) { { title: "raw-ish DoUploadFile", f: func(b *testing.B, n int, data []byte, ext string) { - info1, err := th.App.DoUploadFile(time.Now(), teamID, channelId, + info1, err := th.App.DoUploadFile(time.Now(), teamID, channelID, userID, fmt.Sprintf("BenchmarkDoUploadFile-%d%s", n, ext), data) if err != nil { b.Fatal(err) @@ -99,7 +99,7 @@ func BenchmarkUploadFile(b *testing.B) { { title: "raw UploadFileX Content-Length", f: func(b *testing.B, n int, data []byte, ext string) { - info, aerr := th.App.UploadFileX(channelId, + info, aerr := th.App.UploadFileX(channelID, fmt.Sprintf("BenchmarkUploadFileTask-%d%s", n, ext), bytes.NewReader(data), UploadFileSetTeamId(teamID), @@ -117,7 +117,7 @@ func BenchmarkUploadFile(b *testing.B) { { title: "raw UploadFileX chunked", f: func(b *testing.B, n int, data []byte, ext string) { - info, aerr := th.App.UploadFileX(channelId, + info, aerr := th.App.UploadFileX(channelID, fmt.Sprintf("BenchmarkUploadFileTask-%d%s", n, ext), bytes.NewReader(data), UploadFileSetTeamId(teamID), @@ -135,7 +135,7 @@ func BenchmarkUploadFile(b *testing.B) { { title: "image UploadFiles", f: func(b *testing.B, n int, data []byte, ext string) { - resp, err := th.App.UploadFiles(teamID, channelId, userID, + resp, err := th.App.UploadFiles(teamID, channelID, userID, []io.ReadCloser{ioutil.NopCloser(bytes.NewReader(data))}, []string{fmt.Sprintf("BenchmarkDoUploadFiles-%d%s", n, ext)}, []string{}, @@ -150,7 +150,7 @@ func BenchmarkUploadFile(b *testing.B) { { title: "image UploadFileX Content-Length", f: func(b *testing.B, n int, data []byte, ext string) { - info, aerr := th.App.UploadFileX(channelId, + info, aerr := th.App.UploadFileX(channelID, fmt.Sprintf("BenchmarkUploadFileTask-%d%s", n, ext), bytes.NewReader(data), UploadFileSetTeamId(teamID), @@ -167,7 +167,7 @@ func BenchmarkUploadFile(b *testing.B) { { title: "image UploadFileX chunked", f: func(b *testing.B, n int, data []byte, ext string) { - info, aerr := th.App.UploadFileX(channelId, + info, aerr := th.App.UploadFileX(channelID, fmt.Sprintf("BenchmarkUploadFileTask-%d%s", n, ext), bytes.NewReader(data), UploadFileSetTeamId(teamID), diff --git a/app/file_test.go b/app/file_test.go index 49ee9b36cb5..b7b132c0fe7 100644 --- a/app/file_test.go +++ b/app/file_test.go @@ -44,49 +44,49 @@ func TestDoUploadFile(t *testing.T) { defer th.TearDown() teamID := model.NewId() - channelId := model.NewId() + channelID := model.NewId() userID := model.NewId() filename := "test" data := []byte("abcd") - info1, err := th.App.DoUploadFile(time.Date(2007, 2, 4, 1, 2, 3, 4, time.Local), teamID, channelId, userID, filename, data) + info1, err := th.App.DoUploadFile(time.Date(2007, 2, 4, 1, 2, 3, 4, time.Local), teamID, channelID, userID, filename, data) require.Nil(t, err, "DoUploadFile should succeed with valid data") defer func() { th.App.Srv().Store.FileInfo().PermanentDelete(info1.Id) th.App.RemoveFile(info1.Path) }() - value := fmt.Sprintf("20070204/teams/%v/channels/%v/users/%v/%v/%v", teamID, channelId, userID, info1.Id, filename) + value := fmt.Sprintf("20070204/teams/%v/channels/%v/users/%v/%v/%v", teamID, channelID, userID, info1.Id, filename) assert.Equal(t, value, info1.Path, "stored file at incorrect path") - info2, err := th.App.DoUploadFile(time.Date(2007, 2, 4, 1, 2, 3, 4, time.Local), teamID, channelId, userID, filename, data) + info2, err := th.App.DoUploadFile(time.Date(2007, 2, 4, 1, 2, 3, 4, time.Local), teamID, channelID, userID, filename, data) require.Nil(t, err, "DoUploadFile should succeed with valid data") defer func() { th.App.Srv().Store.FileInfo().PermanentDelete(info2.Id) th.App.RemoveFile(info2.Path) }() - value = fmt.Sprintf("20070204/teams/%v/channels/%v/users/%v/%v/%v", teamID, channelId, userID, info2.Id, filename) + value = fmt.Sprintf("20070204/teams/%v/channels/%v/users/%v/%v/%v", teamID, channelID, userID, info2.Id, filename) assert.Equal(t, value, info2.Path, "stored file at incorrect path") - info3, err := th.App.DoUploadFile(time.Date(2008, 3, 5, 1, 2, 3, 4, time.Local), teamID, channelId, userID, filename, data) + info3, err := th.App.DoUploadFile(time.Date(2008, 3, 5, 1, 2, 3, 4, time.Local), teamID, channelID, userID, filename, data) require.Nil(t, err, "DoUploadFile should succeed with valid data") defer func() { th.App.Srv().Store.FileInfo().PermanentDelete(info3.Id) th.App.RemoveFile(info3.Path) }() - value = fmt.Sprintf("20080305/teams/%v/channels/%v/users/%v/%v/%v", teamID, channelId, userID, info3.Id, filename) + value = fmt.Sprintf("20080305/teams/%v/channels/%v/users/%v/%v/%v", teamID, channelID, userID, info3.Id, filename) assert.Equal(t, value, info3.Path, "stored file at incorrect path") - info4, err := th.App.DoUploadFile(time.Date(2009, 3, 5, 1, 2, 3, 4, time.Local), "../../"+teamID, "../../"+channelId, "../../"+userID, "../../"+filename, data) + info4, err := th.App.DoUploadFile(time.Date(2009, 3, 5, 1, 2, 3, 4, time.Local), "../../"+teamID, "../../"+channelID, "../../"+userID, "../../"+filename, data) require.Nil(t, err, "DoUploadFile should succeed with valid data") defer func() { th.App.Srv().Store.FileInfo().PermanentDelete(info4.Id) th.App.RemoveFile(info4.Path) }() - value = fmt.Sprintf("20090305/teams/%v/channels/%v/users/%v/%v/%v", teamID, channelId, userID, info4.Id, filename) + value = fmt.Sprintf("20090305/teams/%v/channels/%v/users/%v/%v/%v", teamID, channelID, userID, info4.Id, filename) assert.Equal(t, value, info4.Path, "stored file at incorrect path") } @@ -94,7 +94,7 @@ func TestUploadFile(t *testing.T) { th := Setup(t).InitBasic() defer th.TearDown() - channelId := th.BasicChannel.Id + channelID := th.BasicChannel.Id filename := "test" data := []byte("abcd") @@ -105,7 +105,7 @@ func TestUploadFile(t *testing.T) { info1, err = th.App.UploadFile(data, "", filename) require.Nil(t, err, "empty channel IDs should be valid") - info1, err = th.App.UploadFile(data, channelId, filename) + info1, err = th.App.UploadFile(data, channelID, filename) require.Nil(t, err, "UploadFile should succeed with valid data") defer func() { th.App.Srv().Store.FileInfo().PermanentDelete(info1.Id) @@ -113,7 +113,7 @@ func TestUploadFile(t *testing.T) { }() value := fmt.Sprintf("%v/teams/noteam/channels/%v/users/nouser/%v/%v", - time.Now().Format("20060102"), channelId, info1.Id, filename) + time.Now().Format("20060102"), channelID, info1.Id, filename) assert.Equal(t, value, info1.Path, "Stored file at incorrect path") } @@ -121,69 +121,69 @@ func TestParseOldFilenames(t *testing.T) { th := Setup(t).InitBasic() defer th.TearDown() - fileId := model.NewId() + fileID := model.NewId() tests := []struct { description string filenames []string - channelId string + channelID string userID string expected [][]string }{ { description: "Empty input should result in empty output", filenames: []string{}, - channelId: th.BasicChannel.Id, + channelID: th.BasicChannel.Id, userID: th.BasicUser.Id, expected: [][]string{}, }, { description: "Filename with invalid format should not parse", filenames: []string{"/path/to/some/file.png"}, - channelId: th.BasicChannel.Id, + channelID: th.BasicChannel.Id, userID: th.BasicUser.Id, expected: [][]string{}, }, { description: "ChannelId in Filename should not match", filenames: []string{ - fmt.Sprintf("/%v/%v/%v/file.png", model.NewId(), th.BasicUser.Id, fileId), + fmt.Sprintf("/%v/%v/%v/file.png", model.NewId(), th.BasicUser.Id, fileID), }, - channelId: th.BasicChannel.Id, + channelID: th.BasicChannel.Id, userID: th.BasicUser.Id, expected: [][]string{}, }, { description: "UserId in Filename should not match", filenames: []string{ - fmt.Sprintf("/%v/%v/%v/file.png", th.BasicChannel.Id, model.NewId(), fileId), + fmt.Sprintf("/%v/%v/%v/file.png", th.BasicChannel.Id, model.NewId(), fileID), }, - channelId: th.BasicChannel.Id, + channelID: th.BasicChannel.Id, userID: th.BasicUser.Id, expected: [][]string{}, }, { description: "../ in filename should not parse", filenames: []string{ - fmt.Sprintf("/%v/%v/%v/../../../file.png", th.BasicChannel.Id, th.BasicUser.Id, fileId), + fmt.Sprintf("/%v/%v/%v/../../../file.png", th.BasicChannel.Id, th.BasicUser.Id, fileID), }, - channelId: th.BasicChannel.Id, + channelID: th.BasicChannel.Id, userID: th.BasicUser.Id, expected: [][]string{}, }, { description: "Should only parse valid filenames", filenames: []string{ - fmt.Sprintf("/%v/%v/%v/../otherfile.png", th.BasicChannel.Id, th.BasicUser.Id, fileId), - fmt.Sprintf("/%v/%v/%v/file.png", th.BasicChannel.Id, th.BasicUser.Id, fileId), + fmt.Sprintf("/%v/%v/%v/../otherfile.png", th.BasicChannel.Id, th.BasicUser.Id, fileID), + fmt.Sprintf("/%v/%v/%v/file.png", th.BasicChannel.Id, th.BasicUser.Id, fileID), }, - channelId: th.BasicChannel.Id, + channelID: th.BasicChannel.Id, userID: th.BasicUser.Id, expected: [][]string{ { th.BasicChannel.Id, th.BasicUser.Id, - fileId, + fileID, "file.png", }, }, @@ -191,15 +191,15 @@ func TestParseOldFilenames(t *testing.T) { { description: "Valid Filename should parse", filenames: []string{ - fmt.Sprintf("/%v/%v/%v/file.png", th.BasicChannel.Id, th.BasicUser.Id, fileId), + fmt.Sprintf("/%v/%v/%v/file.png", th.BasicChannel.Id, th.BasicUser.Id, fileID), }, - channelId: th.BasicChannel.Id, + channelID: th.BasicChannel.Id, userID: th.BasicUser.Id, expected: [][]string{ { th.BasicChannel.Id, th.BasicUser.Id, - fileId, + fileID, "file.png", }, }, @@ -208,7 +208,7 @@ func TestParseOldFilenames(t *testing.T) { for _, test := range tests { t.Run(test.description, func(tt *testing.T) { - result := parseOldFilenames(test.filenames, test.channelId, test.userID) + result := parseOldFilenames(test.filenames, test.channelID, test.userID) require.Equal(tt, result, test.expected) }) } @@ -256,17 +256,17 @@ func TestMigrateFilenamesToFileInfos(t *testing.T) { require.NoError(t, fileErr) defer file.Close() - fileId := model.NewId() - fpath := fmt.Sprintf("/teams/%v/channels/%v/users/%v/%v/test.png", th.BasicTeam.Id, th.BasicChannel.Id, th.BasicUser.Id, fileId) + fileID := model.NewId() + fpath := fmt.Sprintf("/teams/%v/channels/%v/users/%v/%v/test.png", th.BasicTeam.Id, th.BasicChannel.Id, th.BasicUser.Id, fileID) _, err := th.App.WriteFile(file, fpath) require.Nil(t, err) - rpost, err := th.App.CreatePost(&model.Post{UserId: th.BasicUser.Id, ChannelId: th.BasicChannel.Id, Filenames: []string{fmt.Sprintf("/%v/%v/%v/test.png", th.BasicChannel.Id, th.BasicUser.Id, fileId)}}, th.BasicChannel, false, true) + rpost, err := th.App.CreatePost(&model.Post{UserId: th.BasicUser.Id, ChannelId: th.BasicChannel.Id, Filenames: []string{fmt.Sprintf("/%v/%v/%v/test.png", th.BasicChannel.Id, th.BasicUser.Id, fileID)}}, th.BasicChannel, false, true) require.Nil(t, err) infos = th.App.MigrateFilenamesToFileInfos(rpost) assert.Equal(t, 1, len(infos)) - rpost, err = th.App.CreatePost(&model.Post{UserId: th.BasicUser.Id, ChannelId: th.BasicChannel.Id, Filenames: []string{fmt.Sprintf("/%v/%v/%v/../../test.png", th.BasicChannel.Id, th.BasicUser.Id, fileId)}}, th.BasicChannel, false, true) + rpost, err = th.App.CreatePost(&model.Post{UserId: th.BasicUser.Id, ChannelId: th.BasicChannel.Id, Filenames: []string{fmt.Sprintf("/%v/%v/%v/../../test.png", th.BasicChannel.Id, th.BasicUser.Id, fileID)}}, th.BasicChannel, false, true) require.Nil(t, err) infos = th.App.MigrateFilenamesToFileInfos(rpost) @@ -296,12 +296,12 @@ func TestCopyFileInfos(t *testing.T) { defer th.TearDown() teamID := model.NewId() - channelId := model.NewId() + channelID := model.NewId() userID := model.NewId() filename := "test" data := []byte("abcd") - info1, err := th.App.DoUploadFile(time.Date(2007, 2, 4, 1, 2, 3, 4, time.Local), teamID, channelId, userID, filename, data) + info1, err := th.App.DoUploadFile(time.Date(2007, 2, 4, 1, 2, 3, 4, time.Local), teamID, channelID, userID, filename, data) require.Nil(t, err) defer func() { th.App.Srv().Store.FileInfo().PermanentDelete(info1.Id) diff --git a/app/group.go b/app/group.go index be9180238e9..14e46c4a7bd 100644 --- a/app/group.go +++ b/app/group.go @@ -435,13 +435,13 @@ func (a *App) ChannelMembersToRemove(teamID *string) ([]*model.ChannelMember, *m return channelMembers, nil } -func (a *App) GetGroupsByChannel(channelId string, opts model.GroupSearchOpts) ([]*model.GroupWithSchemeAdmin, int, *model.AppError) { - groups, err := a.Srv().Store.Group().GetGroupsByChannel(channelId, opts) +func (a *App) GetGroupsByChannel(channelID string, opts model.GroupSearchOpts) ([]*model.GroupWithSchemeAdmin, int, *model.AppError) { + groups, err := a.Srv().Store.Group().GetGroupsByChannel(channelID, opts) if err != nil { return nil, 0, model.NewAppError("GetGroupsByChannel", "app.select_error", nil, err.Error(), http.StatusInternalServerError) } - count, err := a.Srv().Store.Group().CountGroupsByChannel(channelId, opts) + count, err := a.Srv().Store.Group().CountGroupsByChannel(channelID, opts) if err != nil { return nil, 0, model.NewAppError("GetGroupsByChannel", "app.select_error", nil, err.Error(), http.StatusInternalServerError) } diff --git a/app/import_functions.go b/app/import_functions.go index 32433c21e45..cd9d60b68a8 100644 --- a/app/import_functions.go +++ b/app/import_functions.go @@ -1064,17 +1064,17 @@ func (a *App) importReplies(data []ReplyImportData, post *model.Post, teamID str reply.Message = *replyData.Message reply.CreateAt = *replyData.CreateAt - fileIds, err := a.uploadAttachments(replyData.Attachments, reply, teamID) + fileIDs, err := a.uploadAttachments(replyData.Attachments, reply, teamID) if err != nil { return err } for _, fileID := range reply.FileIds { - if _, ok := fileIds[fileID]; !ok { + if _, ok := fileIDs[fileID]; !ok { a.Srv().Store.FileInfo().PermanentDelete(fileID) } } reply.FileIds = make([]string, 0) - for fileID := range fileIds { + for fileID := range fileIDs { reply.FileIds = append(reply.FileIds, fileID) } @@ -1328,17 +1328,17 @@ func (a *App) importMultiplePostLines(lines []LineImportWorkerData, dryRun bool) post.Props = *line.Post.Props } - fileIds, appErr := a.uploadAttachments(line.Post.Attachments, post, team.Id) + fileIDs, appErr := a.uploadAttachments(line.Post.Attachments, post, team.Id) if appErr != nil { return line.LineNumber, appErr } for _, fileID := range post.FileIds { - if _, ok := fileIds[fileID]; !ok { + if _, ok := fileIDs[fileID]; !ok { a.Srv().Store.FileInfo().PermanentDelete(fileID) } } post.FileIds = make([]string, 0) - for fileID := range fileIds { + for fileID := range fileIDs { post.FileIds = append(post.FileIds, fileID) } @@ -1434,21 +1434,21 @@ func (a *App) uploadAttachments(attachments *[]AttachmentImportData, post *model if attachments == nil { return nil, nil } - fileIds := make(map[string]bool) + fileIDs := make(map[string]bool) for _, attachment := range *attachments { attachment := attachment fileInfo, err := a.importAttachment(&attachment, post, teamID) if err != nil { return nil, err } - fileIds[fileInfo.Id] = true + fileIDs[fileInfo.Id] = true } - return fileIds, nil + return fileIDs, nil } func (a *App) updateFileInfoWithPostId(post *model.Post) { - for _, fileId := range post.FileIds { - if err := a.Srv().Store.FileInfo().AttachToPost(fileId, post.Id, post.UserId); err != nil { + for _, fileID := range post.FileIds { + if err := a.Srv().Store.FileInfo().AttachToPost(fileID, post.Id, post.UserId); err != nil { mlog.Error("Error attaching files to post.", mlog.String("post_id", post.Id), mlog.Any("post_file_ids", post.FileIds), mlog.Err(err)) } } @@ -1624,17 +1624,17 @@ func (a *App) importMultipleDirectPostLines(lines []LineImportWorkerData, dryRun post.Props = *line.DirectPost.Props } - fileIds, err := a.uploadAttachments(line.DirectPost.Attachments, post, "noteam") + fileIDs, err := a.uploadAttachments(line.DirectPost.Attachments, post, "noteam") if err != nil { return line.LineNumber, err } for _, fileID := range post.FileIds { - if _, ok := fileIds[fileID]; !ok { + if _, ok := fileIDs[fileID]; !ok { a.Srv().Store.FileInfo().PermanentDelete(fileID) } } post.FileIds = make([]string, 0) - for fileID := range fileIds { + for fileID := range fileIDs { post.FileIds = append(post.FileIds, fileID) } diff --git a/app/import_test.go b/app/import_test.go index 144ca5e9879..26bc81cfc63 100644 --- a/app/import_test.go +++ b/app/import_test.go @@ -256,10 +256,10 @@ func GetAttachments(userID string, th *TestHelper, t *testing.T) []*model.FileIn } func AssertFileIdsInPost(files []*model.FileInfo, th *TestHelper, t *testing.T) { - postId := files[0].PostId - require.NotNil(t, postId) + postID := files[0].PostId + require.NotNil(t, postID) - posts, err := th.App.Srv().Store.Post().GetPostsByIds([]string{postId}) + posts, err := th.App.Srv().Store.Post().GetPostsByIds([]string{postID}) require.NoError(t, err) require.Len(t, posts, 1) diff --git a/app/integration_action.go b/app/integration_action.go index 27b38854c10..26c6a8d9d63 100644 --- a/app/integration_action.go +++ b/app/integration_action.go @@ -38,11 +38,11 @@ import ( "github.com/mattermost/mattermost-server/v5/utils" ) -func (a *App) DoPostAction(postId, actionId, userID, selectedOption string) (string, *model.AppError) { - return a.DoPostActionWithCookie(postId, actionId, userID, selectedOption, nil) +func (a *App) DoPostAction(postID, actionId, userID, selectedOption string) (string, *model.AppError) { + return a.DoPostActionWithCookie(postID, actionId, userID, selectedOption, nil) } -func (a *App) DoPostActionWithCookie(postId, actionId, userID, selectedOption string, cookie *model.PostActionCookie) (string, *model.AppError) { +func (a *App) DoPostActionWithCookie(postID, actionId, userID, selectedOption string, cookie *model.PostActionCookie) (string, *model.AppError) { // PostAction may result in the original post being updated. For the // updated post, we need to unconditionally preserve the original @@ -64,21 +64,21 @@ func (a *App) DoPostActionWithCookie(postId, actionId, userID, selectedOption st rootPostId := "" upstreamRequest := &model.PostActionIntegrationRequest{ UserId: userID, - PostId: postId, + PostId: postID, } // See if the post exists in the DB, if so ignore the cookie. // Start all queries here for parallel execution pchan := make(chan store.StoreResult, 1) go func() { - post, err := a.Srv().Store.Post().GetSingle(postId) + post, err := a.Srv().Store.Post().GetSingle(postID) pchan <- store.StoreResult{Data: post, NErr: err} close(pchan) }() cchan := make(chan store.StoreResult, 1) go func() { - channel, err := a.Srv().Store.Channel().GetForPost(postId) + channel, err := a.Srv().Store.Channel().GetForPost(postID) cchan <- store.StoreResult{Data: channel, NErr: err} close(cchan) }() @@ -105,7 +105,7 @@ func (a *App) DoPostActionWithCookie(postId, actionId, userID, selectedOption st return "", model.NewAppError("DoPostActionWithCookie", "api.post.do_action.action_integration.app_error", nil, "no Integration in action cookie", http.StatusBadRequest) } - if postId != cookie.PostId { + if postID != cookie.PostId { return "", model.NewAppError("DoPostActionWithCookie", "api.post.do_action.action_integration.app_error", nil, "postId doesn't match", http.StatusBadRequest) } @@ -252,7 +252,7 @@ func (a *App) DoPostActionWithCookie(postId, actionId, userID, selectedOption st } if response.Update != nil { - response.Update.Id = postId + response.Update.Id = postID // Restore the post attributes and Props that need to be preserved if response.Update.GetProps() == nil { @@ -374,9 +374,9 @@ func (a *App) doPluginRequest(method, rawURL string, values url.Values, body []b if result[0] != "plugins" { return nil, model.NewAppError("doPluginRequest", "api.post.do_action.action_integration.app_error", nil, "err=plugins not in path", http.StatusBadRequest) } - pluginId := result[1] + pluginID := result[1] - path := strings.TrimPrefix(inURL.Path, "plugins/"+pluginId) + path := strings.TrimPrefix(inURL.Path, "plugins/"+pluginID) base, err := url.Parse(path) if err != nil { @@ -407,7 +407,7 @@ func (a *App) doPluginRequest(method, rawURL string, values url.Values, body []b r.Header.Set("Mattermost-User-Id", a.Session().UserId) r.Header.Set(model.HEADER_AUTH, "Bearer "+a.Session().Token) params := make(map[string]string) - params["plugin_id"] = pluginId + params["plugin_id"] = pluginID r = mux.SetURLVars(r, params) a.ServePluginRequest(w, r) diff --git a/app/login.go b/app/login.go index 2832f94e063..5e823820da0 100644 --- a/app/login.go +++ b/app/login.go @@ -154,7 +154,7 @@ func (a *App) GetUserForLogin(id, loginId string) (*model.User, *model.AppError) return nil, model.NewAppError("GetUserForLogin", "store.sql_user.get_for_login.app_error", nil, "", http.StatusBadRequest) } -func (a *App) DoLogin(w http.ResponseWriter, r *http.Request, user *model.User, deviceId string, isMobile, isOAuthUser, isSaml bool) *model.AppError { +func (a *App) DoLogin(w http.ResponseWriter, r *http.Request, user *model.User, deviceID string, isMobile, isOAuthUser, isSaml bool) *model.AppError { if pluginsEnvironment := a.GetPluginsEnvironment(); pluginsEnvironment != nil { var rejectionReason string pluginContext := a.PluginContext() @@ -168,18 +168,18 @@ func (a *App) DoLogin(w http.ResponseWriter, r *http.Request, user *model.User, } } - session := &model.Session{UserId: user.Id, Roles: user.GetRawRoles(), DeviceId: deviceId, IsOAuth: false, Props: map[string]string{ + session := &model.Session{UserId: user.Id, Roles: user.GetRawRoles(), DeviceId: deviceID, IsOAuth: false, Props: map[string]string{ model.USER_AUTH_SERVICE_IS_MOBILE: strconv.FormatBool(isMobile), model.USER_AUTH_SERVICE_IS_SAML: strconv.FormatBool(isSaml), model.USER_AUTH_SERVICE_IS_OAUTH: strconv.FormatBool(isOAuthUser), }} session.GenerateCSRF() - if deviceId != "" { + if deviceID != "" { a.SetSessionExpireInDays(session, *a.Config().ServiceSettings.SessionLengthMobileInDays) // A special case where we logout of all other sessions with the same Id - if err := a.RevokeSessionsForDeviceId(user.Id, deviceId, ""); err != nil { + if err := a.RevokeSessionsForDeviceId(user.Id, deviceID, ""); err != nil { err.StatusCode = http.StatusInternalServerError return err } diff --git a/app/notification_push.go b/app/notification_push.go index d8352a70aa1..53eadda4053 100644 --- a/app/notification_push.go +++ b/app/notification_push.go @@ -42,7 +42,7 @@ type PushNotification struct { notificationType notificationType currentSessionId string userID string - channelId string + channelID string post *model.Post user *model.User channel *model.Channel @@ -201,11 +201,11 @@ func (a *App) getPushNotificationMessage(contentsConfig, postMessage string, exp return senderName + userLocale("api.post.send_notifications_and_forget.push_general_message") } -func (a *App) clearPushNotificationSync(currentSessionId, userID, channelId string) *model.AppError { +func (a *App) clearPushNotificationSync(currentSessionId, userID, channelID string) *model.AppError { msg := &model.PushNotification{ Type: model.PUSH_TYPE_CLEAR, Version: model.PUSH_MESSAGE_V2, - ChannelId: channelId, + ChannelId: channelID, ContentAvailable: 1, } @@ -219,13 +219,13 @@ func (a *App) clearPushNotificationSync(currentSessionId, userID, channelId stri return a.sendPushNotificationToAllSessions(msg, userID, currentSessionId) } -func (a *App) clearPushNotification(currentSessionId, userID, channelId string) { +func (a *App) clearPushNotification(currentSessionId, userID, channelID string) { select { case a.Srv().PushNotificationsHub.notificationsChan <- PushNotification{ notificationType: notificationTypeClear, currentSessionId: currentSessionId, userID: userID, - channelId: channelId, + channelID: channelID, }: case <-a.Srv().PushNotificationsHub.stopChan: return @@ -307,7 +307,7 @@ func (hub *PushNotificationsHub) start() { var err *model.AppError switch notification.notificationType { case notificationTypeClear: - err = hub.app.clearPushNotificationSync(notification.currentSessionId, notification.userID, notification.channelId) + err = hub.app.clearPushNotificationSync(notification.currentSessionId, notification.userID, notification.channelID) case notificationTypeMessage: err = hub.app.sendPushNotificationSync( notification.post, @@ -485,14 +485,14 @@ func DoesNotifyPropsAllowPushNotification(user *model.User, channelNotifyProps m return true } -func DoesStatusAllowPushNotification(userNotifyProps model.StringMap, status *model.Status, channelId string) bool { +func DoesStatusAllowPushNotification(userNotifyProps model.StringMap, status *model.Status, channelID string) bool { // If User status is DND or OOO return false right away if status.Status == model.STATUS_DND || status.Status == model.STATUS_OUT_OF_OFFICE { return false } pushStatus, ok := userNotifyProps[model.PUSH_STATUS_NOTIFY_PROP] - if (pushStatus == model.STATUS_ONLINE || !ok) && (status.ActiveChannel != channelId || model.GetMillis()-status.LastActivityAt > model.STATUS_CHANNEL_TIMEOUT) { + if (pushStatus == model.STATUS_ONLINE || !ok) && (status.ActiveChannel != channelID || model.GetMillis()-status.LastActivityAt > model.STATUS_CHANNEL_TIMEOUT) { return true } diff --git a/app/notification_push_test.go b/app/notification_push_test.go index 09c11d65e32..421e6f1f1ab 100644 --- a/app/notification_push_test.go +++ b/app/notification_push_test.go @@ -354,7 +354,7 @@ func TestDoesNotifyPropsAllowPushNotification(t *testing.T) { func TestDoesStatusAllowPushNotification(t *testing.T) { userID := model.NewId() - channelId := model.NewId() + channelID := model.NewId() offline := &model.Status{UserId: userID, Status: model.STATUS_OFFLINE, Manual: false, LastActivityAt: 0, ActiveChannel: ""} away := &model.Status{UserId: userID, Status: model.STATUS_AWAY, Manual: false, LastActivityAt: 0, ActiveChannel: ""} @@ -365,175 +365,175 @@ func TestDoesStatusAllowPushNotification(t *testing.T) { name string userNotifySetting string status *model.Status - channelId string + channelID string expected bool }{ { name: "WHEN props is ONLINE and user is offline with channel", userNotifySetting: model.STATUS_ONLINE, status: offline, - channelId: channelId, + channelID: channelID, expected: true, }, { name: "WHEN props is ONLINE and user is offline without channel", userNotifySetting: model.STATUS_ONLINE, status: offline, - channelId: "", + channelID: "", expected: true, }, { name: "WHEN props is ONLINE and user is away with channel", userNotifySetting: model.STATUS_ONLINE, status: away, - channelId: channelId, + channelID: channelID, expected: true, }, { name: "WHEN props is ONLINE and user is away without channel", userNotifySetting: model.STATUS_ONLINE, status: away, - channelId: "", + channelID: "", expected: true, }, { name: "WHEN props is ONLINE and user is online with channel", userNotifySetting: model.STATUS_ONLINE, status: online, - channelId: channelId, + channelID: channelID, expected: true, }, { name: "WHEN props is ONLINE and user is online without channel", userNotifySetting: model.STATUS_ONLINE, status: online, - channelId: "", + channelID: "", expected: false, }, { name: "WHEN props is ONLINE and user is dnd with channel", userNotifySetting: model.STATUS_ONLINE, status: dnd, - channelId: channelId, + channelID: channelID, expected: false, }, { name: "WHEN props is ONLINE and user is dnd without channel", userNotifySetting: model.STATUS_ONLINE, status: dnd, - channelId: "", + channelID: "", expected: false, }, { name: "WHEN props is AWAY and user is offline with channel", userNotifySetting: model.STATUS_AWAY, status: offline, - channelId: channelId, + channelID: channelID, expected: true, }, { name: "WHEN props is AWAY and user is offline without channel", userNotifySetting: model.STATUS_AWAY, status: offline, - channelId: "", + channelID: "", expected: true, }, { name: "WHEN props is AWAY and user is away with channel", userNotifySetting: model.STATUS_AWAY, status: away, - channelId: channelId, + channelID: channelID, expected: true, }, { name: "WHEN props is AWAY and user is away without channel", userNotifySetting: model.STATUS_AWAY, status: away, - channelId: "", + channelID: "", expected: true, }, { name: "WHEN props is AWAY and user is online with channel", userNotifySetting: model.STATUS_AWAY, status: online, - channelId: channelId, + channelID: channelID, expected: false, }, { name: "WHEN props is AWAY and user is online without channel", userNotifySetting: model.STATUS_AWAY, status: online, - channelId: "", + channelID: "", expected: false, }, { name: "WHEN props is AWAY and user is dnd with channel", userNotifySetting: model.STATUS_AWAY, status: dnd, - channelId: channelId, + channelID: channelID, expected: false, }, { name: "WHEN props is AWAY and user is dnd without channel", userNotifySetting: model.STATUS_AWAY, status: dnd, - channelId: "", + channelID: "", expected: false, }, { name: "WHEN props is OFFLINE and user is offline with channel", userNotifySetting: model.STATUS_OFFLINE, status: offline, - channelId: channelId, + channelID: channelID, expected: true, }, { name: "WHEN props is OFFLINE and user is offline without channel", userNotifySetting: model.STATUS_OFFLINE, status: offline, - channelId: "", + channelID: "", expected: true, }, { name: "WHEN props is OFFLINE and user is away with channel", userNotifySetting: model.STATUS_OFFLINE, status: away, - channelId: channelId, + channelID: channelID, expected: false, }, { name: "WHEN props is OFFLINE and user is away without channel", userNotifySetting: model.STATUS_OFFLINE, status: away, - channelId: "", + channelID: "", expected: false, }, { name: "WHEN props is OFFLINE and user is online with channel", userNotifySetting: model.STATUS_OFFLINE, status: online, - channelId: channelId, + channelID: channelID, expected: false, }, { name: "WHEN props is OFFLINE and user is online without channel", userNotifySetting: model.STATUS_OFFLINE, status: online, - channelId: "", + channelID: "", expected: false, }, { name: "WHEN props is OFFLINE and user is dnd with channel", userNotifySetting: model.STATUS_OFFLINE, status: dnd, - channelId: channelId, + channelID: channelID, expected: false, }, { name: "WHEN props is OFFLINE and user is dnd without channel", userNotifySetting: model.STATUS_OFFLINE, status: dnd, - channelId: "", + channelID: "", expected: false, }, } @@ -542,7 +542,7 @@ func TestDoesStatusAllowPushNotification(t *testing.T) { t.Run(tc.name, func(t *testing.T) { userNotifyProps := make(map[string]string) userNotifyProps["push_status"] = tc.userNotifySetting - assert.Equal(t, tc.expected, DoesStatusAllowPushNotification(userNotifyProps, tc.status, tc.channelId)) + assert.Equal(t, tc.expected, DoesStatusAllowPushNotification(userNotifyProps, tc.status, tc.channelID)) }) } } diff --git a/app/oauth.go b/app/oauth.go index d37d4909535..42a70ea7e71 100644 --- a/app/oauth.go +++ b/app/oauth.go @@ -54,12 +54,12 @@ func (a *App) CreateOAuthApp(app *model.OAuthApp) (*model.OAuthApp, *model.AppEr return oauthApp, nil } -func (a *App) GetOAuthApp(appId string) (*model.OAuthApp, *model.AppError) { +func (a *App) GetOAuthApp(appID string) (*model.OAuthApp, *model.AppError) { if !*a.Config().ServiceSettings.EnableOAuthServiceProvider { return nil, model.NewAppError("GetOAuthApp", "api.oauth.allow_oauth.turn_off.app_error", nil, "", http.StatusNotImplemented) } - oauthApp, err := a.Srv().Store.OAuth().GetApp(appId) + oauthApp, err := a.Srv().Store.OAuth().GetApp(appID) if err != nil { var nfErr *store.ErrNotFound switch { @@ -100,12 +100,12 @@ func (a *App) UpdateOauthApp(oldApp, updatedApp *model.OAuthApp) (*model.OAuthAp return oauthApp, nil } -func (a *App) DeleteOAuthApp(appId string) *model.AppError { +func (a *App) DeleteOAuthApp(appID string) *model.AppError { if !*a.Config().ServiceSettings.EnableOAuthServiceProvider { return model.NewAppError("DeleteOAuthApp", "api.oauth.allow_oauth.turn_off.app_error", nil, "", http.StatusNotImplemented) } - if err := a.Srv().Store.OAuth().DeleteApp(appId); err != nil { + if err := a.Srv().Store.OAuth().DeleteApp(appID); err != nil { return model.NewAppError("DeleteOAuthApp", "app.oauth.delete_app.app_error", nil, err.Error(), http.StatusInternalServerError) } @@ -464,13 +464,13 @@ func (a *App) GetAuthorizedAppsForUser(userID string, page, perPage int) ([]*mod return apps, nil } -func (a *App) DeauthorizeOAuthAppForUser(userID, appId string) *model.AppError { +func (a *App) DeauthorizeOAuthAppForUser(userID, appID string) *model.AppError { if !*a.Config().ServiceSettings.EnableOAuthServiceProvider { return model.NewAppError("DeauthorizeOAuthAppForUser", "api.oauth.allow_oauth.turn_off.app_error", nil, "", http.StatusNotImplemented) } // Revoke app sessions - accessData, err := a.Srv().Store.OAuth().GetAccessDataByUserForApp(userID, appId) + accessData, err := a.Srv().Store.OAuth().GetAccessDataByUserForApp(userID, appID) if err != nil { return model.NewAppError("DeauthorizeOAuthAppForUser", "app.oauth.get_access_data_by_user_for_app.app_error", nil, err.Error(), http.StatusInternalServerError) } @@ -486,7 +486,7 @@ func (a *App) DeauthorizeOAuthAppForUser(userID, appId string) *model.AppError { } // Deauthorize the app - if err := a.Srv().Store.Preference().Delete(userID, model.PREFERENCE_CATEGORY_AUTHORIZED_OAUTH_APP, appId); err != nil { + if err := a.Srv().Store.Preference().Delete(userID, model.PREFERENCE_CATEGORY_AUTHORIZED_OAUTH_APP, appID); err != nil { return model.NewAppError("DeauthorizeOAuthAppForUser", "app.preference.delete.app_error", nil, err.Error(), http.StatusInternalServerError) } diff --git a/app/opentracing/opentracing_layer.go b/app/opentracing/opentracing_layer.go index b6d67226c3f..8545f9c0209 100644 --- a/app/opentracing/opentracing_layer.go +++ b/app/opentracing/opentracing_layer.go @@ -628,7 +628,7 @@ func (a *OpenTracingAppLayer) AsymmetricSigningKey() *ecdsa.PrivateKey { return resultVar0 } -func (a *OpenTracingAppLayer) AttachDeviceId(sessionId string, deviceId string, expiresAt int64) *model.AppError { +func (a *OpenTracingAppLayer) AttachDeviceId(sessionID string, deviceID string, expiresAt int64) *model.AppError { origCtx := a.ctx span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.AttachDeviceId") @@ -640,7 +640,7 @@ func (a *OpenTracingAppLayer) AttachDeviceId(sessionId string, deviceId string, }() defer span.Finish() - resultVar0 := a.app.AttachDeviceId(sessionId, deviceId, expiresAt) + resultVar0 := a.app.AttachDeviceId(sessionID, deviceID, expiresAt) if resultVar0 != nil { span.LogFields(spanlog.Error(resultVar0)) @@ -753,7 +753,7 @@ func (a *OpenTracingAppLayer) AutocompleteChannelsForSearch(teamID string, userI return resultVar0, resultVar1 } -func (a *OpenTracingAppLayer) AutocompleteUsersInChannel(teamID string, channelId string, term string, options *model.UserSearchOptions) (*model.UserAutocompleteInChannel, *model.AppError) { +func (a *OpenTracingAppLayer) AutocompleteUsersInChannel(teamID string, channelID string, term string, options *model.UserSearchOptions) (*model.UserAutocompleteInChannel, *model.AppError) { origCtx := a.ctx span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.AutocompleteUsersInChannel") @@ -765,7 +765,7 @@ func (a *OpenTracingAppLayer) AutocompleteUsersInChannel(teamID string, channelI }() defer span.Finish() - resultVar0, resultVar1 := a.app.AutocompleteUsersInChannel(teamID, channelId, term, options) + resultVar0, resultVar1 := a.app.AutocompleteUsersInChannel(teamID, channelID, term, options) if resultVar1 != nil { span.LogFields(spanlog.Error(resultVar1)) @@ -812,7 +812,7 @@ func (a *OpenTracingAppLayer) BroadcastStatus(status *model.Status) { a.app.BroadcastStatus(status) } -func (a *OpenTracingAppLayer) BuildPostReactions(postId string) (*[]app.ReactionImportData, *model.AppError) { +func (a *OpenTracingAppLayer) BuildPostReactions(postID string) (*[]app.ReactionImportData, *model.AppError) { origCtx := a.ctx span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.BuildPostReactions") @@ -824,7 +824,7 @@ func (a *OpenTracingAppLayer) BuildPostReactions(postId string) (*[]app.Reaction }() defer span.Finish() - resultVar0, resultVar1 := a.app.BuildPostReactions(postId) + resultVar0, resultVar1 := a.app.BuildPostReactions(postID) if resultVar1 != nil { span.LogFields(spanlog.Error(resultVar1)) @@ -1405,7 +1405,7 @@ func (a *OpenTracingAppLayer) Cloud() einterfaces.CloudInterface { return resultVar0 } -func (a *OpenTracingAppLayer) CompareAndDeletePluginKey(pluginId string, key string, oldValue []byte) (bool, *model.AppError) { +func (a *OpenTracingAppLayer) CompareAndDeletePluginKey(pluginID string, key string, oldValue []byte) (bool, *model.AppError) { origCtx := a.ctx span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.CompareAndDeletePluginKey") @@ -1417,7 +1417,7 @@ func (a *OpenTracingAppLayer) CompareAndDeletePluginKey(pluginId string, key str }() defer span.Finish() - resultVar0, resultVar1 := a.app.CompareAndDeletePluginKey(pluginId, key, oldValue) + resultVar0, resultVar1 := a.app.CompareAndDeletePluginKey(pluginID, key, oldValue) if resultVar1 != nil { span.LogFields(spanlog.Error(resultVar1)) @@ -1427,7 +1427,7 @@ func (a *OpenTracingAppLayer) CompareAndDeletePluginKey(pluginId string, key str return resultVar0, resultVar1 } -func (a *OpenTracingAppLayer) CompareAndSetPluginKey(pluginId string, key string, oldValue []byte, newValue []byte) (bool, *model.AppError) { +func (a *OpenTracingAppLayer) CompareAndSetPluginKey(pluginID string, key string, oldValue []byte, newValue []byte) (bool, *model.AppError) { origCtx := a.ctx span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.CompareAndSetPluginKey") @@ -1439,7 +1439,7 @@ func (a *OpenTracingAppLayer) CompareAndSetPluginKey(pluginId string, key string }() defer span.Finish() - resultVar0, resultVar1 := a.app.CompareAndSetPluginKey(pluginId, key, oldValue, newValue) + resultVar0, resultVar1 := a.app.CompareAndSetPluginKey(pluginID, key, oldValue, newValue) if resultVar1 != nil { span.LogFields(spanlog.Error(resultVar1)) @@ -1554,7 +1554,7 @@ func (a *OpenTracingAppLayer) ConvertUserToBot(user *model.User) (*model.Bot, *m return resultVar0, resultVar1 } -func (a *OpenTracingAppLayer) CopyFileInfos(userID string, fileIds []string) ([]string, *model.AppError) { +func (a *OpenTracingAppLayer) CopyFileInfos(userID string, fileIDs []string) ([]string, *model.AppError) { origCtx := a.ctx span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.CopyFileInfos") @@ -1566,7 +1566,7 @@ func (a *OpenTracingAppLayer) CopyFileInfos(userID string, fileIds []string) ([] }() defer span.Finish() - resultVar0, resultVar1 := a.app.CopyFileInfos(userID, fileIds) + resultVar0, resultVar1 := a.app.CopyFileInfos(userID, fileIDs) if resultVar1 != nil { span.LogFields(spanlog.Error(resultVar1)) @@ -2526,7 +2526,7 @@ func (a *OpenTracingAppLayer) DeactivateMfa(userID string) *model.AppError { return resultVar0 } -func (a *OpenTracingAppLayer) DeauthorizeOAuthAppForUser(userID string, appId string) *model.AppError { +func (a *OpenTracingAppLayer) DeauthorizeOAuthAppForUser(userID string, appID string) *model.AppError { origCtx := a.ctx span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.DeauthorizeOAuthAppForUser") @@ -2538,7 +2538,7 @@ func (a *OpenTracingAppLayer) DeauthorizeOAuthAppForUser(userID string, appId st }() defer span.Finish() - resultVar0 := a.app.DeauthorizeOAuthAppForUser(userID, appId) + resultVar0 := a.app.DeauthorizeOAuthAppForUser(userID, appID) if resultVar0 != nil { span.LogFields(spanlog.Error(resultVar0)) @@ -2587,7 +2587,7 @@ func (a *OpenTracingAppLayer) DeleteAllExpiredPluginKeys() *model.AppError { return resultVar0 } -func (a *OpenTracingAppLayer) DeleteAllKeysForPlugin(pluginId string) *model.AppError { +func (a *OpenTracingAppLayer) DeleteAllKeysForPlugin(pluginID string) *model.AppError { origCtx := a.ctx span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.DeleteAllKeysForPlugin") @@ -2599,7 +2599,7 @@ func (a *OpenTracingAppLayer) DeleteAllKeysForPlugin(pluginId string) *model.App }() defer span.Finish() - resultVar0 := a.app.DeleteAllKeysForPlugin(pluginId) + resultVar0 := a.app.DeleteAllKeysForPlugin(pluginID) if resultVar0 != nil { span.LogFields(spanlog.Error(resultVar0)) @@ -2741,7 +2741,7 @@ func (a *OpenTracingAppLayer) DeleteEmoji(emoji *model.Emoji) *model.AppError { return resultVar0 } -func (a *OpenTracingAppLayer) DeleteEphemeralPost(userID string, postId string) { +func (a *OpenTracingAppLayer) DeleteEphemeralPost(userID string, postID string) { origCtx := a.ctx span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.DeleteEphemeralPost") @@ -2753,7 +2753,7 @@ func (a *OpenTracingAppLayer) DeleteEphemeralPost(userID string, postId string) }() defer span.Finish() - a.app.DeleteEphemeralPost(userID, postId) + a.app.DeleteEphemeralPost(userID, postID) } func (a *OpenTracingAppLayer) DeleteExport(name string) *model.AppError { @@ -2778,7 +2778,7 @@ func (a *OpenTracingAppLayer) DeleteExport(name string) *model.AppError { return resultVar0 } -func (a *OpenTracingAppLayer) DeleteFlaggedPosts(postId string) { +func (a *OpenTracingAppLayer) DeleteFlaggedPosts(postID string) { origCtx := a.ctx span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.DeleteFlaggedPosts") @@ -2790,7 +2790,7 @@ func (a *OpenTracingAppLayer) DeleteFlaggedPosts(postId string) { }() defer span.Finish() - a.app.DeleteFlaggedPosts(postId) + a.app.DeleteFlaggedPosts(postID) } func (a *OpenTracingAppLayer) DeleteGroup(groupID string) (*model.Group, *model.AppError) { @@ -2903,7 +2903,7 @@ func (a *OpenTracingAppLayer) DeleteIncomingWebhook(hookID string) *model.AppErr return resultVar0 } -func (a *OpenTracingAppLayer) DeleteOAuthApp(appId string) *model.AppError { +func (a *OpenTracingAppLayer) DeleteOAuthApp(appID string) *model.AppError { origCtx := a.ctx span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.DeleteOAuthApp") @@ -2915,7 +2915,7 @@ func (a *OpenTracingAppLayer) DeleteOAuthApp(appId string) *model.AppError { }() defer span.Finish() - resultVar0 := a.app.DeleteOAuthApp(appId) + resultVar0 := a.app.DeleteOAuthApp(appID) if resultVar0 != nil { span.LogFields(spanlog.Error(resultVar0)) @@ -2947,7 +2947,7 @@ func (a *OpenTracingAppLayer) DeleteOutgoingWebhook(hookID string) *model.AppErr return resultVar0 } -func (a *OpenTracingAppLayer) DeletePluginKey(pluginId string, key string) *model.AppError { +func (a *OpenTracingAppLayer) DeletePluginKey(pluginID string, key string) *model.AppError { origCtx := a.ctx span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.DeletePluginKey") @@ -2959,7 +2959,7 @@ func (a *OpenTracingAppLayer) DeletePluginKey(pluginId string, key string) *mode }() defer span.Finish() - resultVar0 := a.app.DeletePluginKey(pluginId, key) + resultVar0 := a.app.DeletePluginKey(pluginID, key) if resultVar0 != nil { span.LogFields(spanlog.Error(resultVar0)) @@ -2969,7 +2969,7 @@ func (a *OpenTracingAppLayer) DeletePluginKey(pluginId string, key string) *mode return resultVar0 } -func (a *OpenTracingAppLayer) DeletePost(postId string, deleteByID string) (*model.Post, *model.AppError) { +func (a *OpenTracingAppLayer) DeletePost(postID string, deleteByID string) (*model.Post, *model.AppError) { origCtx := a.ctx span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.DeletePost") @@ -2981,7 +2981,7 @@ func (a *OpenTracingAppLayer) DeletePost(postId string, deleteByID string) (*mod }() defer span.Finish() - resultVar0, resultVar1 := a.app.DeletePost(postId, deleteByID) + resultVar0, resultVar1 := a.app.DeletePost(postID, deleteByID) if resultVar1 != nil { span.LogFields(spanlog.Error(resultVar1)) @@ -3352,7 +3352,7 @@ func (a *OpenTracingAppLayer) DoLocalRequest(rawURL string, body []byte) (*http. return resultVar0, resultVar1 } -func (a *OpenTracingAppLayer) DoLogin(w http.ResponseWriter, r *http.Request, user *model.User, deviceId string, isMobile bool, isOAuthUser bool, isSaml bool) *model.AppError { +func (a *OpenTracingAppLayer) DoLogin(w http.ResponseWriter, r *http.Request, user *model.User, deviceID string, isMobile bool, isOAuthUser bool, isSaml bool) *model.AppError { origCtx := a.ctx span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.DoLogin") @@ -3364,7 +3364,7 @@ func (a *OpenTracingAppLayer) DoLogin(w http.ResponseWriter, r *http.Request, us }() defer span.Finish() - resultVar0 := a.app.DoLogin(w, r, user, deviceId, isMobile, isOAuthUser, isSaml) + resultVar0 := a.app.DoLogin(w, r, user, deviceID, isMobile, isOAuthUser, isSaml) if resultVar0 != nil { span.LogFields(spanlog.Error(resultVar0)) @@ -3396,7 +3396,7 @@ func (a *OpenTracingAppLayer) DoPermissionsMigrations() error { return resultVar0 } -func (a *OpenTracingAppLayer) DoPostAction(postId string, actionId string, userID string, selectedOption string) (string, *model.AppError) { +func (a *OpenTracingAppLayer) DoPostAction(postID string, actionId string, userID string, selectedOption string) (string, *model.AppError) { origCtx := a.ctx span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.DoPostAction") @@ -3408,7 +3408,7 @@ func (a *OpenTracingAppLayer) DoPostAction(postId string, actionId string, userI }() defer span.Finish() - resultVar0, resultVar1 := a.app.DoPostAction(postId, actionId, userID, selectedOption) + resultVar0, resultVar1 := a.app.DoPostAction(postID, actionId, userID, selectedOption) if resultVar1 != nil { span.LogFields(spanlog.Error(resultVar1)) @@ -3418,7 +3418,7 @@ func (a *OpenTracingAppLayer) DoPostAction(postId string, actionId string, userI return resultVar0, resultVar1 } -func (a *OpenTracingAppLayer) DoPostActionWithCookie(postId string, actionId string, userID string, selectedOption string, cookie *model.PostActionCookie) (string, *model.AppError) { +func (a *OpenTracingAppLayer) DoPostActionWithCookie(postID string, actionId string, userID string, selectedOption string, cookie *model.PostActionCookie) (string, *model.AppError) { origCtx := a.ctx span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.DoPostActionWithCookie") @@ -3430,7 +3430,7 @@ func (a *OpenTracingAppLayer) DoPostActionWithCookie(postId string, actionId str }() defer span.Finish() - resultVar0, resultVar1 := a.app.DoPostActionWithCookie(postId, actionId, userID, selectedOption, cookie) + resultVar0, resultVar1 := a.app.DoPostActionWithCookie(postID, actionId, userID, selectedOption, cookie) if resultVar1 != nil { span.LogFields(spanlog.Error(resultVar1)) @@ -4527,7 +4527,7 @@ func (a *OpenTracingAppLayer) GetBrandImage() ([]byte, *model.AppError) { return resultVar0, resultVar1 } -func (a *OpenTracingAppLayer) GetBulkReactionsForPosts(postIds []string) (map[string][]*model.Reaction, *model.AppError) { +func (a *OpenTracingAppLayer) GetBulkReactionsForPosts(postIDs []string) (map[string][]*model.Reaction, *model.AppError) { origCtx := a.ctx span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.GetBulkReactionsForPosts") @@ -4539,7 +4539,7 @@ func (a *OpenTracingAppLayer) GetBulkReactionsForPosts(postIds []string) (map[st }() defer span.Finish() - resultVar0, resultVar1 := a.app.GetBulkReactionsForPosts(postIds) + resultVar0, resultVar1 := a.app.GetBulkReactionsForPosts(postIDs) if resultVar1 != nil { span.LogFields(spanlog.Error(resultVar1)) @@ -4549,7 +4549,7 @@ func (a *OpenTracingAppLayer) GetBulkReactionsForPosts(postIds []string) (map[st return resultVar0, resultVar1 } -func (a *OpenTracingAppLayer) GetChannel(channelId string) (*model.Channel, *model.AppError) { +func (a *OpenTracingAppLayer) GetChannel(channelID string) (*model.Channel, *model.AppError) { origCtx := a.ctx span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.GetChannel") @@ -4561,7 +4561,7 @@ func (a *OpenTracingAppLayer) GetChannel(channelId string) (*model.Channel, *mod }() defer span.Finish() - resultVar0, resultVar1 := a.app.GetChannel(channelId) + resultVar0, resultVar1 := a.app.GetChannel(channelID) if resultVar1 != nil { span.LogFields(spanlog.Error(resultVar1)) @@ -4659,7 +4659,7 @@ func (a *OpenTracingAppLayer) GetChannelGroupUsers(channelID string) ([]*model.U return resultVar0, resultVar1 } -func (a *OpenTracingAppLayer) GetChannelGuestCount(channelId string) (int64, *model.AppError) { +func (a *OpenTracingAppLayer) GetChannelGuestCount(channelID string) (int64, *model.AppError) { origCtx := a.ctx span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.GetChannelGuestCount") @@ -4671,7 +4671,7 @@ func (a *OpenTracingAppLayer) GetChannelGuestCount(channelId string) (int64, *mo }() defer span.Finish() - resultVar0, resultVar1 := a.app.GetChannelGuestCount(channelId) + resultVar0, resultVar1 := a.app.GetChannelGuestCount(channelID) if resultVar1 != nil { span.LogFields(spanlog.Error(resultVar1)) @@ -4681,7 +4681,7 @@ func (a *OpenTracingAppLayer) GetChannelGuestCount(channelId string) (int64, *mo return resultVar0, resultVar1 } -func (a *OpenTracingAppLayer) GetChannelMember(channelId string, userID string) (*model.ChannelMember, *model.AppError) { +func (a *OpenTracingAppLayer) GetChannelMember(channelID string, userID string) (*model.ChannelMember, *model.AppError) { origCtx := a.ctx span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.GetChannelMember") @@ -4693,7 +4693,7 @@ func (a *OpenTracingAppLayer) GetChannelMember(channelId string, userID string) }() defer span.Finish() - resultVar0, resultVar1 := a.app.GetChannelMember(channelId, userID) + resultVar0, resultVar1 := a.app.GetChannelMember(channelID, userID) if resultVar1 != nil { span.LogFields(spanlog.Error(resultVar1)) @@ -4703,7 +4703,7 @@ func (a *OpenTracingAppLayer) GetChannelMember(channelId string, userID string) return resultVar0, resultVar1 } -func (a *OpenTracingAppLayer) GetChannelMemberCount(channelId string) (int64, *model.AppError) { +func (a *OpenTracingAppLayer) GetChannelMemberCount(channelID string) (int64, *model.AppError) { origCtx := a.ctx span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.GetChannelMemberCount") @@ -4715,7 +4715,7 @@ func (a *OpenTracingAppLayer) GetChannelMemberCount(channelId string) (int64, *m }() defer span.Finish() - resultVar0, resultVar1 := a.app.GetChannelMemberCount(channelId) + resultVar0, resultVar1 := a.app.GetChannelMemberCount(channelID) if resultVar1 != nil { span.LogFields(spanlog.Error(resultVar1)) @@ -4725,7 +4725,7 @@ func (a *OpenTracingAppLayer) GetChannelMemberCount(channelId string) (int64, *m return resultVar0, resultVar1 } -func (a *OpenTracingAppLayer) GetChannelMembersByIds(channelId string, userIDs []string) (*model.ChannelMembers, *model.AppError) { +func (a *OpenTracingAppLayer) GetChannelMembersByIds(channelID string, userIDs []string) (*model.ChannelMembers, *model.AppError) { origCtx := a.ctx span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.GetChannelMembersByIds") @@ -4737,7 +4737,7 @@ func (a *OpenTracingAppLayer) GetChannelMembersByIds(channelId string, userIDs [ }() defer span.Finish() - resultVar0, resultVar1 := a.app.GetChannelMembersByIds(channelId, userIDs) + resultVar0, resultVar1 := a.app.GetChannelMembersByIds(channelID, userIDs) if resultVar1 != nil { span.LogFields(spanlog.Error(resultVar1)) @@ -4791,7 +4791,7 @@ func (a *OpenTracingAppLayer) GetChannelMembersForUserWithPagination(teamID stri return resultVar0, resultVar1 } -func (a *OpenTracingAppLayer) GetChannelMembersPage(channelId string, page int, perPage int) (*model.ChannelMembers, *model.AppError) { +func (a *OpenTracingAppLayer) GetChannelMembersPage(channelID string, page int, perPage int) (*model.ChannelMembers, *model.AppError) { origCtx := a.ctx span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.GetChannelMembersPage") @@ -4803,7 +4803,7 @@ func (a *OpenTracingAppLayer) GetChannelMembersPage(channelId string, page int, }() defer span.Finish() - resultVar0, resultVar1 := a.app.GetChannelMembersPage(channelId, page, perPage) + resultVar0, resultVar1 := a.app.GetChannelMembersPage(channelID, page, perPage) if resultVar1 != nil { span.LogFields(spanlog.Error(resultVar1)) @@ -4813,7 +4813,7 @@ func (a *OpenTracingAppLayer) GetChannelMembersPage(channelId string, page int, return resultVar0, resultVar1 } -func (a *OpenTracingAppLayer) GetChannelMembersTimezones(channelId string) ([]string, *model.AppError) { +func (a *OpenTracingAppLayer) GetChannelMembersTimezones(channelID string) ([]string, *model.AppError) { origCtx := a.ctx span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.GetChannelMembersTimezones") @@ -4825,7 +4825,7 @@ func (a *OpenTracingAppLayer) GetChannelMembersTimezones(channelId string) ([]st }() defer span.Finish() - resultVar0, resultVar1 := a.app.GetChannelMembersTimezones(channelId) + resultVar0, resultVar1 := a.app.GetChannelMembersTimezones(channelID) if resultVar1 != nil { span.LogFields(spanlog.Error(resultVar1)) @@ -4857,7 +4857,7 @@ func (a *OpenTracingAppLayer) GetChannelModerationsForChannel(channel *model.Cha return resultVar0, resultVar1 } -func (a *OpenTracingAppLayer) GetChannelPinnedPostCount(channelId string) (int64, *model.AppError) { +func (a *OpenTracingAppLayer) GetChannelPinnedPostCount(channelID string) (int64, *model.AppError) { origCtx := a.ctx span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.GetChannelPinnedPostCount") @@ -4869,7 +4869,7 @@ func (a *OpenTracingAppLayer) GetChannelPinnedPostCount(channelId string) (int64 }() defer span.Finish() - resultVar0, resultVar1 := a.app.GetChannelPinnedPostCount(channelId) + resultVar0, resultVar1 := a.app.GetChannelPinnedPostCount(channelID) if resultVar1 != nil { span.LogFields(spanlog.Error(resultVar1)) @@ -4879,7 +4879,7 @@ func (a *OpenTracingAppLayer) GetChannelPinnedPostCount(channelId string) (int64 return resultVar0, resultVar1 } -func (a *OpenTracingAppLayer) GetChannelUnread(channelId string, userID string) (*model.ChannelUnread, *model.AppError) { +func (a *OpenTracingAppLayer) GetChannelUnread(channelID string, userID string) (*model.ChannelUnread, *model.AppError) { origCtx := a.ctx span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.GetChannelUnread") @@ -4891,7 +4891,7 @@ func (a *OpenTracingAppLayer) GetChannelUnread(channelId string, userID string) }() defer span.Finish() - resultVar0, resultVar1 := a.app.GetChannelUnread(channelId, userID) + resultVar0, resultVar1 := a.app.GetChannelUnread(channelID, userID) if resultVar1 != nil { span.LogFields(spanlog.Error(resultVar1)) @@ -5431,7 +5431,7 @@ func (a *OpenTracingAppLayer) GetErrorListForEmailsOverLimit(emailList []string, return resultVar0, resultVar1, resultVar2 } -func (a *OpenTracingAppLayer) GetFile(fileId string) ([]byte, *model.AppError) { +func (a *OpenTracingAppLayer) GetFile(fileID string) ([]byte, *model.AppError) { origCtx := a.ctx span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.GetFile") @@ -5443,7 +5443,7 @@ func (a *OpenTracingAppLayer) GetFile(fileId string) ([]byte, *model.AppError) { }() defer span.Finish() - resultVar0, resultVar1 := a.app.GetFile(fileId) + resultVar0, resultVar1 := a.app.GetFile(fileID) if resultVar1 != nil { span.LogFields(spanlog.Error(resultVar1)) @@ -5453,7 +5453,7 @@ func (a *OpenTracingAppLayer) GetFile(fileId string) ([]byte, *model.AppError) { return resultVar0, resultVar1 } -func (a *OpenTracingAppLayer) GetFileInfo(fileId string) (*model.FileInfo, *model.AppError) { +func (a *OpenTracingAppLayer) GetFileInfo(fileID string) (*model.FileInfo, *model.AppError) { origCtx := a.ctx span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.GetFileInfo") @@ -5465,7 +5465,7 @@ func (a *OpenTracingAppLayer) GetFileInfo(fileId string) (*model.FileInfo, *mode }() defer span.Finish() - resultVar0, resultVar1 := a.app.GetFileInfo(fileId) + resultVar0, resultVar1 := a.app.GetFileInfo(fileID) if resultVar1 != nil { span.LogFields(spanlog.Error(resultVar1)) @@ -5497,7 +5497,7 @@ func (a *OpenTracingAppLayer) GetFileInfos(page int, perPage int, opt *model.Get return resultVar0, resultVar1 } -func (a *OpenTracingAppLayer) GetFileInfosForPost(postId string, fromMaster bool) ([]*model.FileInfo, *model.AppError) { +func (a *OpenTracingAppLayer) GetFileInfosForPost(postID string, fromMaster bool) ([]*model.FileInfo, *model.AppError) { origCtx := a.ctx span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.GetFileInfosForPost") @@ -5509,7 +5509,7 @@ func (a *OpenTracingAppLayer) GetFileInfosForPost(postId string, fromMaster bool }() defer span.Finish() - resultVar0, resultVar1 := a.app.GetFileInfosForPost(postId, fromMaster) + resultVar0, resultVar1 := a.app.GetFileInfosForPost(postID, fromMaster) if resultVar1 != nil { span.LogFields(spanlog.Error(resultVar1)) @@ -5519,7 +5519,7 @@ func (a *OpenTracingAppLayer) GetFileInfosForPost(postId string, fromMaster bool return resultVar0, resultVar1 } -func (a *OpenTracingAppLayer) GetFileInfosForPostWithMigration(postId string) ([]*model.FileInfo, *model.AppError) { +func (a *OpenTracingAppLayer) GetFileInfosForPostWithMigration(postID string) ([]*model.FileInfo, *model.AppError) { origCtx := a.ctx span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.GetFileInfosForPostWithMigration") @@ -5531,7 +5531,7 @@ func (a *OpenTracingAppLayer) GetFileInfosForPostWithMigration(postId string) ([ }() defer span.Finish() - resultVar0, resultVar1 := a.app.GetFileInfosForPostWithMigration(postId) + resultVar0, resultVar1 := a.app.GetFileInfosForPostWithMigration(postID) if resultVar1 != nil { span.LogFields(spanlog.Error(resultVar1)) @@ -5585,7 +5585,7 @@ func (a *OpenTracingAppLayer) GetFlaggedPosts(userID string, offset int, limit i return resultVar0, resultVar1 } -func (a *OpenTracingAppLayer) GetFlaggedPostsForChannel(userID string, channelId string, offset int, limit int) (*model.PostList, *model.AppError) { +func (a *OpenTracingAppLayer) GetFlaggedPostsForChannel(userID string, channelID string, offset int, limit int) (*model.PostList, *model.AppError) { origCtx := a.ctx span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.GetFlaggedPostsForChannel") @@ -5597,7 +5597,7 @@ func (a *OpenTracingAppLayer) GetFlaggedPostsForChannel(userID string, channelId }() defer span.Finish() - resultVar0, resultVar1 := a.app.GetFlaggedPostsForChannel(userID, channelId, offset, limit) + resultVar0, resultVar1 := a.app.GetFlaggedPostsForChannel(userID, channelID, offset, limit) if resultVar1 != nil { span.LogFields(spanlog.Error(resultVar1)) @@ -5871,7 +5871,7 @@ func (a *OpenTracingAppLayer) GetGroupsAssociatedToChannelsByTeam(teamID string, return resultVar0, resultVar1 } -func (a *OpenTracingAppLayer) GetGroupsByChannel(channelId string, opts model.GroupSearchOpts) ([]*model.GroupWithSchemeAdmin, int, *model.AppError) { +func (a *OpenTracingAppLayer) GetGroupsByChannel(channelID string, opts model.GroupSearchOpts) ([]*model.GroupWithSchemeAdmin, int, *model.AppError) { origCtx := a.ctx span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.GetGroupsByChannel") @@ -5883,7 +5883,7 @@ func (a *OpenTracingAppLayer) GetGroupsByChannel(channelId string, opts model.Gr }() defer span.Finish() - resultVar0, resultVar1, resultVar2 := a.app.GetGroupsByChannel(channelId, opts) + resultVar0, resultVar1, resultVar2 := a.app.GetGroupsByChannel(channelID, opts) if resultVar2 != nil { span.LogFields(spanlog.Error(resultVar2)) @@ -6533,7 +6533,7 @@ func (a *OpenTracingAppLayer) GetOAuthAccessTokenForImplicitFlow(userID string, return resultVar0, resultVar1 } -func (a *OpenTracingAppLayer) GetOAuthApp(appId string) (*model.OAuthApp, *model.AppError) { +func (a *OpenTracingAppLayer) GetOAuthApp(appID string) (*model.OAuthApp, *model.AppError) { origCtx := a.ctx span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.GetOAuthApp") @@ -6545,7 +6545,7 @@ func (a *OpenTracingAppLayer) GetOAuthApp(appId string) (*model.OAuthApp, *model }() defer span.Finish() - resultVar0, resultVar1 := a.app.GetOAuthApp(appId) + resultVar0, resultVar1 := a.app.GetOAuthApp(appID) if resultVar1 != nil { span.LogFields(spanlog.Error(resultVar1)) @@ -6770,7 +6770,7 @@ func (a *OpenTracingAppLayer) GetOutgoingWebhook(hookID string) (*model.Outgoing return resultVar0, resultVar1 } -func (a *OpenTracingAppLayer) GetOutgoingWebhooksForChannelPageByUser(channelId string, userID string, page int, perPage int) ([]*model.OutgoingWebhook, *model.AppError) { +func (a *OpenTracingAppLayer) GetOutgoingWebhooksForChannelPageByUser(channelID string, userID string, page int, perPage int) ([]*model.OutgoingWebhook, *model.AppError) { origCtx := a.ctx span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.GetOutgoingWebhooksForChannelPageByUser") @@ -6782,7 +6782,7 @@ func (a *OpenTracingAppLayer) GetOutgoingWebhooksForChannelPageByUser(channelId }() defer span.Finish() - resultVar0, resultVar1 := a.app.GetOutgoingWebhooksForChannelPageByUser(channelId, userID, page, perPage) + resultVar0, resultVar1 := a.app.GetOutgoingWebhooksForChannelPageByUser(channelID, userID, page, perPage) if resultVar1 != nil { span.LogFields(spanlog.Error(resultVar1)) @@ -6902,7 +6902,7 @@ func (a *OpenTracingAppLayer) GetPasswordRecoveryToken(token string) (*model.Tok return resultVar0, resultVar1 } -func (a *OpenTracingAppLayer) GetPermalinkPost(postId string, userID string) (*model.PostList, *model.AppError) { +func (a *OpenTracingAppLayer) GetPermalinkPost(postID string, userID string) (*model.PostList, *model.AppError) { origCtx := a.ctx span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.GetPermalinkPost") @@ -6914,7 +6914,7 @@ func (a *OpenTracingAppLayer) GetPermalinkPost(postId string, userID string) (*m }() defer span.Finish() - resultVar0, resultVar1 := a.app.GetPermalinkPost(postId, userID) + resultVar0, resultVar1 := a.app.GetPermalinkPost(postID, userID) if resultVar1 != nil { span.LogFields(spanlog.Error(resultVar1)) @@ -6924,7 +6924,7 @@ func (a *OpenTracingAppLayer) GetPermalinkPost(postId string, userID string) (*m return resultVar0, resultVar1 } -func (a *OpenTracingAppLayer) GetPinnedPosts(channelId string) (*model.PostList, *model.AppError) { +func (a *OpenTracingAppLayer) GetPinnedPosts(channelID string) (*model.PostList, *model.AppError) { origCtx := a.ctx span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.GetPinnedPosts") @@ -6936,7 +6936,7 @@ func (a *OpenTracingAppLayer) GetPinnedPosts(channelId string) (*model.PostList, }() defer span.Finish() - resultVar0, resultVar1 := a.app.GetPinnedPosts(channelId) + resultVar0, resultVar1 := a.app.GetPinnedPosts(channelID) if resultVar1 != nil { span.LogFields(spanlog.Error(resultVar1)) @@ -6946,7 +6946,7 @@ func (a *OpenTracingAppLayer) GetPinnedPosts(channelId string) (*model.PostList, return resultVar0, resultVar1 } -func (a *OpenTracingAppLayer) GetPluginKey(pluginId string, key string) ([]byte, *model.AppError) { +func (a *OpenTracingAppLayer) GetPluginKey(pluginID string, key string) ([]byte, *model.AppError) { origCtx := a.ctx span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.GetPluginKey") @@ -6958,7 +6958,7 @@ func (a *OpenTracingAppLayer) GetPluginKey(pluginId string, key string) ([]byte, }() defer span.Finish() - resultVar0, resultVar1 := a.app.GetPluginKey(pluginId, key) + resultVar0, resultVar1 := a.app.GetPluginKey(pluginID, key) if resultVar1 != nil { span.LogFields(spanlog.Error(resultVar1)) @@ -7073,7 +7073,7 @@ func (a *OpenTracingAppLayer) GetPluginsEnvironment() *plugin.Environment { return resultVar0 } -func (a *OpenTracingAppLayer) GetPostAfterTime(channelId string, time int64) (*model.Post, *model.AppError) { +func (a *OpenTracingAppLayer) GetPostAfterTime(channelID string, time int64) (*model.Post, *model.AppError) { origCtx := a.ctx span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.GetPostAfterTime") @@ -7085,7 +7085,7 @@ func (a *OpenTracingAppLayer) GetPostAfterTime(channelId string, time int64) (*m }() defer span.Finish() - resultVar0, resultVar1 := a.app.GetPostAfterTime(channelId, time) + resultVar0, resultVar1 := a.app.GetPostAfterTime(channelID, time) if resultVar1 != nil { span.LogFields(spanlog.Error(resultVar1)) @@ -7095,7 +7095,7 @@ func (a *OpenTracingAppLayer) GetPostAfterTime(channelId string, time int64) (*m return resultVar0, resultVar1 } -func (a *OpenTracingAppLayer) GetPostIdAfterTime(channelId string, time int64) (string, *model.AppError) { +func (a *OpenTracingAppLayer) GetPostIdAfterTime(channelID string, time int64) (string, *model.AppError) { origCtx := a.ctx span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.GetPostIdAfterTime") @@ -7107,7 +7107,7 @@ func (a *OpenTracingAppLayer) GetPostIdAfterTime(channelId string, time int64) ( }() defer span.Finish() - resultVar0, resultVar1 := a.app.GetPostIdAfterTime(channelId, time) + resultVar0, resultVar1 := a.app.GetPostIdAfterTime(channelID, time) if resultVar1 != nil { span.LogFields(spanlog.Error(resultVar1)) @@ -7117,7 +7117,7 @@ func (a *OpenTracingAppLayer) GetPostIdAfterTime(channelId string, time int64) ( return resultVar0, resultVar1 } -func (a *OpenTracingAppLayer) GetPostIdBeforeTime(channelId string, time int64) (string, *model.AppError) { +func (a *OpenTracingAppLayer) GetPostIdBeforeTime(channelID string, time int64) (string, *model.AppError) { origCtx := a.ctx span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.GetPostIdBeforeTime") @@ -7129,7 +7129,7 @@ func (a *OpenTracingAppLayer) GetPostIdBeforeTime(channelId string, time int64) }() defer span.Finish() - resultVar0, resultVar1 := a.app.GetPostIdBeforeTime(channelId, time) + resultVar0, resultVar1 := a.app.GetPostIdBeforeTime(channelID, time) if resultVar1 != nil { span.LogFields(spanlog.Error(resultVar1)) @@ -7139,7 +7139,7 @@ func (a *OpenTracingAppLayer) GetPostIdBeforeTime(channelId string, time int64) return resultVar0, resultVar1 } -func (a *OpenTracingAppLayer) GetPostThread(postId string, skipFetchThreads bool, collapsedThreads bool, collapsedThreadsExtended bool) (*model.PostList, *model.AppError) { +func (a *OpenTracingAppLayer) GetPostThread(postID string, skipFetchThreads bool, collapsedThreads bool, collapsedThreadsExtended bool) (*model.PostList, *model.AppError) { origCtx := a.ctx span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.GetPostThread") @@ -7151,7 +7151,7 @@ func (a *OpenTracingAppLayer) GetPostThread(postId string, skipFetchThreads bool }() defer span.Finish() - resultVar0, resultVar1 := a.app.GetPostThread(postId, skipFetchThreads, collapsedThreads, collapsedThreadsExtended) + resultVar0, resultVar1 := a.app.GetPostThread(postID, skipFetchThreads, collapsedThreads, collapsedThreadsExtended) if resultVar1 != nil { span.LogFields(spanlog.Error(resultVar1)) @@ -7161,7 +7161,7 @@ func (a *OpenTracingAppLayer) GetPostThread(postId string, skipFetchThreads bool return resultVar0, resultVar1 } -func (a *OpenTracingAppLayer) GetPosts(channelId string, offset int, limit int) (*model.PostList, *model.AppError) { +func (a *OpenTracingAppLayer) GetPosts(channelID string, offset int, limit int) (*model.PostList, *model.AppError) { origCtx := a.ctx span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.GetPosts") @@ -7173,7 +7173,7 @@ func (a *OpenTracingAppLayer) GetPosts(channelId string, offset int, limit int) }() defer span.Finish() - resultVar0, resultVar1 := a.app.GetPosts(channelId, offset, limit) + resultVar0, resultVar1 := a.app.GetPosts(channelID, offset, limit) if resultVar1 != nil { span.LogFields(spanlog.Error(resultVar1)) @@ -7249,7 +7249,7 @@ func (a *OpenTracingAppLayer) GetPostsBeforePost(options model.GetPostsOptions) return resultVar0, resultVar1 } -func (a *OpenTracingAppLayer) GetPostsEtag(channelId string, collapsedThreads bool) string { +func (a *OpenTracingAppLayer) GetPostsEtag(channelID string, collapsedThreads bool) string { origCtx := a.ctx span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.GetPostsEtag") @@ -7261,12 +7261,12 @@ func (a *OpenTracingAppLayer) GetPostsEtag(channelId string, collapsedThreads bo }() defer span.Finish() - resultVar0 := a.app.GetPostsEtag(channelId, collapsedThreads) + resultVar0 := a.app.GetPostsEtag(channelID, collapsedThreads) return resultVar0 } -func (a *OpenTracingAppLayer) GetPostsForChannelAroundLastUnread(channelId string, userID string, limitBefore int, limitAfter int, skipFetchThreads bool, collapsedThreads bool, collapsedThreadsExtended bool) (*model.PostList, *model.AppError) { +func (a *OpenTracingAppLayer) GetPostsForChannelAroundLastUnread(channelID string, userID string, limitBefore int, limitAfter int, skipFetchThreads bool, collapsedThreads bool, collapsedThreadsExtended bool) (*model.PostList, *model.AppError) { origCtx := a.ctx span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.GetPostsForChannelAroundLastUnread") @@ -7278,7 +7278,7 @@ func (a *OpenTracingAppLayer) GetPostsForChannelAroundLastUnread(channelId strin }() defer span.Finish() - resultVar0, resultVar1 := a.app.GetPostsForChannelAroundLastUnread(channelId, userID, limitBefore, limitAfter, skipFetchThreads, collapsedThreads, collapsedThreadsExtended) + resultVar0, resultVar1 := a.app.GetPostsForChannelAroundLastUnread(channelID, userID, limitBefore, limitAfter, skipFetchThreads, collapsedThreads, collapsedThreadsExtended) if resultVar1 != nil { span.LogFields(spanlog.Error(resultVar1)) @@ -7481,7 +7481,7 @@ func (a *OpenTracingAppLayer) GetProfileImage(user *model.User) ([]byte, bool, * return resultVar0, resultVar1, resultVar2 } -func (a *OpenTracingAppLayer) GetPublicChannelsByIdsForTeam(teamID string, channelIds []string) (*model.ChannelList, *model.AppError) { +func (a *OpenTracingAppLayer) GetPublicChannelsByIdsForTeam(teamID string, channelIDs []string) (*model.ChannelList, *model.AppError) { origCtx := a.ctx span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.GetPublicChannelsByIdsForTeam") @@ -7493,7 +7493,7 @@ func (a *OpenTracingAppLayer) GetPublicChannelsByIdsForTeam(teamID string, chann }() defer span.Finish() - resultVar0, resultVar1 := a.app.GetPublicChannelsByIdsForTeam(teamID, channelIds) + resultVar0, resultVar1 := a.app.GetPublicChannelsByIdsForTeam(teamID, channelIDs) if resultVar1 != nil { span.LogFields(spanlog.Error(resultVar1)) @@ -7547,7 +7547,7 @@ func (a *OpenTracingAppLayer) GetPublicKey(name string) ([]byte, *model.AppError return resultVar0, resultVar1 } -func (a *OpenTracingAppLayer) GetReactionsForPost(postId string) ([]*model.Reaction, *model.AppError) { +func (a *OpenTracingAppLayer) GetReactionsForPost(postID string) ([]*model.Reaction, *model.AppError) { origCtx := a.ctx span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.GetReactionsForPost") @@ -7559,7 +7559,7 @@ func (a *OpenTracingAppLayer) GetReactionsForPost(postId string) ([]*model.React }() defer span.Finish() - resultVar0, resultVar1 := a.app.GetReactionsForPost(postId) + resultVar0, resultVar1 := a.app.GetReactionsForPost(postID) if resultVar1 != nil { span.LogFields(spanlog.Error(resultVar1)) @@ -7818,7 +7818,7 @@ func (a *OpenTracingAppLayer) GetSchemeByName(name string) (*model.Scheme, *mode return resultVar0, resultVar1 } -func (a *OpenTracingAppLayer) GetSchemeRolesForChannel(channelId string) (guestRoleName string, userRoleName string, adminRoleName string, err *model.AppError) { +func (a *OpenTracingAppLayer) GetSchemeRolesForChannel(channelID string) (guestRoleName string, userRoleName string, adminRoleName string, err *model.AppError) { origCtx := a.ctx span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.GetSchemeRolesForChannel") @@ -7830,7 +7830,7 @@ func (a *OpenTracingAppLayer) GetSchemeRolesForChannel(channelId string) (guestR }() defer span.Finish() - resultVar0, resultVar1, resultVar2, resultVar3 := a.app.GetSchemeRolesForChannel(channelId) + resultVar0, resultVar1, resultVar2, resultVar3 := a.app.GetSchemeRolesForChannel(channelID) if resultVar3 != nil { span.LogFields(spanlog.Error(resultVar3)) @@ -7928,7 +7928,7 @@ func (a *OpenTracingAppLayer) GetSession(token string) (*model.Session, *model.A return resultVar0, resultVar1 } -func (a *OpenTracingAppLayer) GetSessionById(sessionId string) (*model.Session, *model.AppError) { +func (a *OpenTracingAppLayer) GetSessionById(sessionID string) (*model.Session, *model.AppError) { origCtx := a.ctx span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.GetSessionById") @@ -7940,7 +7940,7 @@ func (a *OpenTracingAppLayer) GetSessionById(sessionId string) (*model.Session, }() defer span.Finish() - resultVar0, resultVar1 := a.app.GetSessionById(sessionId) + resultVar0, resultVar1 := a.app.GetSessionById(sessionID) if resultVar1 != nil { span.LogFields(spanlog.Error(resultVar1)) @@ -8055,7 +8055,7 @@ func (a *OpenTracingAppLayer) GetSidebarCategoryOrder(userID string, teamID stri return resultVar0, resultVar1 } -func (a *OpenTracingAppLayer) GetSinglePost(postId string) (*model.Post, *model.AppError) { +func (a *OpenTracingAppLayer) GetSinglePost(postID string) (*model.Post, *model.AppError) { origCtx := a.ctx span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.GetSinglePost") @@ -8067,7 +8067,7 @@ func (a *OpenTracingAppLayer) GetSinglePost(postId string) (*model.Post, *model. }() defer span.Finish() - resultVar0, resultVar1 := a.app.GetSinglePost(postId) + resultVar0, resultVar1 := a.app.GetSinglePost(postID) if resultVar1 != nil { span.LogFields(spanlog.Error(resultVar1)) @@ -8986,7 +8986,7 @@ func (a *OpenTracingAppLayer) GetUsers(options *model.UserGetOptions) ([]*model. return resultVar0, resultVar1 } -func (a *OpenTracingAppLayer) GetUsersByGroupChannelIds(channelIds []string, asAdmin bool) (map[string][]*model.User, *model.AppError) { +func (a *OpenTracingAppLayer) GetUsersByGroupChannelIds(channelIDs []string, asAdmin bool) (map[string][]*model.User, *model.AppError) { origCtx := a.ctx span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.GetUsersByGroupChannelIds") @@ -8998,7 +8998,7 @@ func (a *OpenTracingAppLayer) GetUsersByGroupChannelIds(channelIds []string, asA }() defer span.Finish() - resultVar0, resultVar1 := a.app.GetUsersByGroupChannelIds(channelIds, asAdmin) + resultVar0, resultVar1 := a.app.GetUsersByGroupChannelIds(channelIDs, asAdmin) if resultVar1 != nil { span.LogFields(spanlog.Error(resultVar1)) @@ -9240,7 +9240,7 @@ func (a *OpenTracingAppLayer) GetUsersInTeamPage(options *model.UserGetOptions, return resultVar0, resultVar1 } -func (a *OpenTracingAppLayer) GetUsersNotInChannel(teamID string, channelId string, groupConstrained bool, offset int, limit int, viewRestrictions *model.ViewUsersRestrictions) ([]*model.User, *model.AppError) { +func (a *OpenTracingAppLayer) GetUsersNotInChannel(teamID string, channelID string, groupConstrained bool, offset int, limit int, viewRestrictions *model.ViewUsersRestrictions) ([]*model.User, *model.AppError) { origCtx := a.ctx span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.GetUsersNotInChannel") @@ -9252,7 +9252,7 @@ func (a *OpenTracingAppLayer) GetUsersNotInChannel(teamID string, channelId stri }() defer span.Finish() - resultVar0, resultVar1 := a.app.GetUsersNotInChannel(teamID, channelId, groupConstrained, offset, limit, viewRestrictions) + resultVar0, resultVar1 := a.app.GetUsersNotInChannel(teamID, channelID, groupConstrained, offset, limit, viewRestrictions) if resultVar1 != nil { span.LogFields(spanlog.Error(resultVar1)) @@ -9262,7 +9262,7 @@ func (a *OpenTracingAppLayer) GetUsersNotInChannel(teamID string, channelId stri return resultVar0, resultVar1 } -func (a *OpenTracingAppLayer) GetUsersNotInChannelMap(teamID string, channelId string, groupConstrained bool, offset int, limit int, asAdmin bool, viewRestrictions *model.ViewUsersRestrictions) (map[string]*model.User, *model.AppError) { +func (a *OpenTracingAppLayer) GetUsersNotInChannelMap(teamID string, channelID string, groupConstrained bool, offset int, limit int, asAdmin bool, viewRestrictions *model.ViewUsersRestrictions) (map[string]*model.User, *model.AppError) { origCtx := a.ctx span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.GetUsersNotInChannelMap") @@ -9274,7 +9274,7 @@ func (a *OpenTracingAppLayer) GetUsersNotInChannelMap(teamID string, channelId s }() defer span.Finish() - resultVar0, resultVar1 := a.app.GetUsersNotInChannelMap(teamID, channelId, groupConstrained, offset, limit, asAdmin, viewRestrictions) + resultVar0, resultVar1 := a.app.GetUsersNotInChannelMap(teamID, channelID, groupConstrained, offset, limit, asAdmin, viewRestrictions) if resultVar1 != nil { span.LogFields(spanlog.Error(resultVar1)) @@ -9284,7 +9284,7 @@ func (a *OpenTracingAppLayer) GetUsersNotInChannelMap(teamID string, channelId s return resultVar0, resultVar1 } -func (a *OpenTracingAppLayer) GetUsersNotInChannelPage(teamID string, channelId string, groupConstrained bool, page int, perPage int, asAdmin bool, viewRestrictions *model.ViewUsersRestrictions) ([]*model.User, *model.AppError) { +func (a *OpenTracingAppLayer) GetUsersNotInChannelPage(teamID string, channelID string, groupConstrained bool, page int, perPage int, asAdmin bool, viewRestrictions *model.ViewUsersRestrictions) ([]*model.User, *model.AppError) { origCtx := a.ctx span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.GetUsersNotInChannelPage") @@ -9296,7 +9296,7 @@ func (a *OpenTracingAppLayer) GetUsersNotInChannelPage(teamID string, channelId }() defer span.Finish() - resultVar0, resultVar1 := a.app.GetUsersNotInChannelPage(teamID, channelId, groupConstrained, page, perPage, asAdmin, viewRestrictions) + resultVar0, resultVar1 := a.app.GetUsersNotInChannelPage(teamID, channelID, groupConstrained, page, perPage, asAdmin, viewRestrictions) if resultVar1 != nil { span.LogFields(spanlog.Error(resultVar1)) @@ -9649,7 +9649,7 @@ func (a *OpenTracingAppLayer) HasPermissionTo(askingUserId string, permission *m return resultVar0 } -func (a *OpenTracingAppLayer) HasPermissionToChannel(askingUserId string, channelId string, permission *model.Permission) bool { +func (a *OpenTracingAppLayer) HasPermissionToChannel(askingUserId string, channelID string, permission *model.Permission) bool { origCtx := a.ctx span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.HasPermissionToChannel") @@ -9661,12 +9661,12 @@ func (a *OpenTracingAppLayer) HasPermissionToChannel(askingUserId string, channe }() defer span.Finish() - resultVar0 := a.app.HasPermissionToChannel(askingUserId, channelId, permission) + resultVar0 := a.app.HasPermissionToChannel(askingUserId, channelID, permission) return resultVar0 } -func (a *OpenTracingAppLayer) HasPermissionToChannelByPost(askingUserId string, postId string, permission *model.Permission) bool { +func (a *OpenTracingAppLayer) HasPermissionToChannelByPost(askingUserId string, postID string, permission *model.Permission) bool { origCtx := a.ctx span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.HasPermissionToChannelByPost") @@ -9678,7 +9678,7 @@ func (a *OpenTracingAppLayer) HasPermissionToChannelByPost(askingUserId string, }() defer span.Finish() - resultVar0 := a.app.HasPermissionToChannelByPost(askingUserId, postId, permission) + resultVar0 := a.app.HasPermissionToChannelByPost(askingUserId, postID, permission) return resultVar0 } @@ -10299,7 +10299,7 @@ func (a *OpenTracingAppLayer) JoinUserToTeam(team *model.Team, user *model.User, return resultVar0 } -func (a *OpenTracingAppLayer) LeaveChannel(channelId string, userID string) *model.AppError { +func (a *OpenTracingAppLayer) LeaveChannel(channelID string, userID string) *model.AppError { origCtx := a.ctx span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.LeaveChannel") @@ -10311,7 +10311,7 @@ func (a *OpenTracingAppLayer) LeaveChannel(channelId string, userID string) *mod }() defer span.Finish() - resultVar0 := a.app.LeaveChannel(channelId, userID) + resultVar0 := a.app.LeaveChannel(channelID, userID) if resultVar0 != nil { span.LogFields(spanlog.Error(resultVar0)) @@ -10489,7 +10489,7 @@ func (a *OpenTracingAppLayer) ListImports() ([]string, *model.AppError) { return resultVar0, resultVar1 } -func (a *OpenTracingAppLayer) ListPluginKeys(pluginId string, page int, perPage int) ([]string, *model.AppError) { +func (a *OpenTracingAppLayer) ListPluginKeys(pluginID string, page int, perPage int) ([]string, *model.AppError) { origCtx := a.ctx span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.ListPluginKeys") @@ -10501,7 +10501,7 @@ func (a *OpenTracingAppLayer) ListPluginKeys(pluginId string, page int, perPage }() defer span.Finish() - resultVar0, resultVar1 := a.app.ListPluginKeys(pluginId, page, perPage) + resultVar0, resultVar1 := a.app.ListPluginKeys(pluginID, page, perPage) if resultVar1 != nil { span.LogFields(spanlog.Error(resultVar1)) @@ -10646,7 +10646,7 @@ func (a *OpenTracingAppLayer) MarkChannelAsUnreadFromPost(postID string, userID return resultVar0, resultVar1 } -func (a *OpenTracingAppLayer) MarkChannelsAsViewed(channelIds []string, userID string, currentSessionId string) (map[string]int64, *model.AppError) { +func (a *OpenTracingAppLayer) MarkChannelsAsViewed(channelIDs []string, userID string, currentSessionId string) (map[string]int64, *model.AppError) { origCtx := a.ctx span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.MarkChannelsAsViewed") @@ -10658,7 +10658,7 @@ func (a *OpenTracingAppLayer) MarkChannelsAsViewed(channelIds []string, userID s }() defer span.Finish() - resultVar0, resultVar1 := a.app.MarkChannelsAsViewed(channelIds, userID, currentSessionId) + resultVar0, resultVar1 := a.app.MarkChannelsAsViewed(channelIDs, userID, currentSessionId) if resultVar1 != nil { span.LogFields(spanlog.Error(resultVar1)) @@ -11056,7 +11056,7 @@ func (a *OpenTracingAppLayer) PatchChannelModerationsForChannel(channel *model.C return resultVar0, resultVar1 } -func (a *OpenTracingAppLayer) PatchPost(postId string, patch *model.PostPatch) (*model.Post, *model.AppError) { +func (a *OpenTracingAppLayer) PatchPost(postID string, patch *model.PostPatch) (*model.Post, *model.AppError) { origCtx := a.ctx span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.PatchPost") @@ -11068,7 +11068,7 @@ func (a *OpenTracingAppLayer) PatchPost(postId string, patch *model.PostPatch) ( }() defer span.Finish() - resultVar0, resultVar1 := a.app.PatchPost(postId, patch) + resultVar0, resultVar1 := a.app.PatchPost(postID, patch) if resultVar1 != nil { span.LogFields(spanlog.Error(resultVar1)) @@ -11608,7 +11608,7 @@ func (a *OpenTracingAppLayer) PublishSkipClusterSend(message *model.WebSocketEve a.app.PublishSkipClusterSend(message) } -func (a *OpenTracingAppLayer) PublishUserTyping(userID string, channelId string, parentId string) *model.AppError { +func (a *OpenTracingAppLayer) PublishUserTyping(userID string, channelID string, parentId string) *model.AppError { origCtx := a.ctx span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.PublishUserTyping") @@ -11620,7 +11620,7 @@ func (a *OpenTracingAppLayer) PublishUserTyping(userID string, channelId string, }() defer span.Finish() - resultVar0 := a.app.PublishUserTyping(userID, channelId, parentId) + resultVar0 := a.app.PublishUserTyping(userID, channelID, parentId) if resultVar0 != nil { span.LogFields(spanlog.Error(resultVar0)) @@ -11799,7 +11799,7 @@ func (a *OpenTracingAppLayer) RegenerateTeamInviteId(teamID string) (*model.Team return resultVar0, resultVar1 } -func (a *OpenTracingAppLayer) RegisterPluginCommand(pluginId string, command *model.Command) error { +func (a *OpenTracingAppLayer) RegisterPluginCommand(pluginID string, command *model.Command) error { origCtx := a.ctx span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.RegisterPluginCommand") @@ -11811,7 +11811,7 @@ func (a *OpenTracingAppLayer) RegisterPluginCommand(pluginId string, command *mo }() defer span.Finish() - resultVar0 := a.app.RegisterPluginCommand(pluginId, command) + resultVar0 := a.app.RegisterPluginCommand(pluginID, command) if resultVar0 != nil { span.LogFields(spanlog.Error(resultVar0)) @@ -12489,7 +12489,7 @@ func (a *OpenTracingAppLayer) RevokeSession(session *model.Session) *model.AppEr return resultVar0 } -func (a *OpenTracingAppLayer) RevokeSessionById(sessionId string) *model.AppError { +func (a *OpenTracingAppLayer) RevokeSessionById(sessionID string) *model.AppError { origCtx := a.ctx span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.RevokeSessionById") @@ -12501,7 +12501,7 @@ func (a *OpenTracingAppLayer) RevokeSessionById(sessionId string) *model.AppErro }() defer span.Finish() - resultVar0 := a.app.RevokeSessionById(sessionId) + resultVar0 := a.app.RevokeSessionById(sessionID) if resultVar0 != nil { span.LogFields(spanlog.Error(resultVar0)) @@ -12511,7 +12511,7 @@ func (a *OpenTracingAppLayer) RevokeSessionById(sessionId string) *model.AppErro return resultVar0 } -func (a *OpenTracingAppLayer) RevokeSessionsForDeviceId(userID string, deviceId string, currentSessionId string) *model.AppError { +func (a *OpenTracingAppLayer) RevokeSessionsForDeviceId(userID string, deviceID string, currentSessionId string) *model.AppError { origCtx := a.ctx span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.RevokeSessionsForDeviceId") @@ -12523,7 +12523,7 @@ func (a *OpenTracingAppLayer) RevokeSessionsForDeviceId(userID string, deviceId }() defer span.Finish() - resultVar0 := a.app.RevokeSessionsForDeviceId(userID, deviceId, currentSessionId) + resultVar0 := a.app.RevokeSessionsForDeviceId(userID, deviceID, currentSessionId) if resultVar0 != nil { span.LogFields(spanlog.Error(resultVar0)) @@ -13110,7 +13110,7 @@ func (a *OpenTracingAppLayer) SearchUsers(props *model.UserSearch, options *mode return resultVar0, resultVar1 } -func (a *OpenTracingAppLayer) SearchUsersInChannel(channelId string, term string, options *model.UserSearchOptions) ([]*model.User, *model.AppError) { +func (a *OpenTracingAppLayer) SearchUsersInChannel(channelID string, term string, options *model.UserSearchOptions) ([]*model.User, *model.AppError) { origCtx := a.ctx span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.SearchUsersInChannel") @@ -13122,7 +13122,7 @@ func (a *OpenTracingAppLayer) SearchUsersInChannel(channelId string, term string }() defer span.Finish() - resultVar0, resultVar1 := a.app.SearchUsersInChannel(channelId, term, options) + resultVar0, resultVar1 := a.app.SearchUsersInChannel(channelID, term, options) if resultVar1 != nil { span.LogFields(spanlog.Error(resultVar1)) @@ -13176,7 +13176,7 @@ func (a *OpenTracingAppLayer) SearchUsersInTeam(teamID string, term string, opti return resultVar0, resultVar1 } -func (a *OpenTracingAppLayer) SearchUsersNotInChannel(teamID string, channelId string, term string, options *model.UserSearchOptions) ([]*model.User, *model.AppError) { +func (a *OpenTracingAppLayer) SearchUsersNotInChannel(teamID string, channelID string, term string, options *model.UserSearchOptions) ([]*model.User, *model.AppError) { origCtx := a.ctx span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.SearchUsersNotInChannel") @@ -13188,7 +13188,7 @@ func (a *OpenTracingAppLayer) SearchUsersNotInChannel(teamID string, channelId s }() defer span.Finish() - resultVar0, resultVar1 := a.app.SearchUsersNotInChannel(teamID, channelId, term, options) + resultVar0, resultVar1 := a.app.SearchUsersNotInChannel(teamID, channelID, term, options) if resultVar1 != nil { span.LogFields(spanlog.Error(resultVar1)) @@ -13585,7 +13585,7 @@ func (a *OpenTracingAppLayer) SessionHasPermissionToCategory(session model.Sessi return resultVar0 } -func (a *OpenTracingAppLayer) SessionHasPermissionToChannel(session model.Session, channelId string, permission *model.Permission) bool { +func (a *OpenTracingAppLayer) SessionHasPermissionToChannel(session model.Session, channelID string, permission *model.Permission) bool { origCtx := a.ctx span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.SessionHasPermissionToChannel") @@ -13597,12 +13597,12 @@ func (a *OpenTracingAppLayer) SessionHasPermissionToChannel(session model.Sessio }() defer span.Finish() - resultVar0 := a.app.SessionHasPermissionToChannel(session, channelId, permission) + resultVar0 := a.app.SessionHasPermissionToChannel(session, channelID, permission) return resultVar0 } -func (a *OpenTracingAppLayer) SessionHasPermissionToChannelByPost(session model.Session, postId string, permission *model.Permission) bool { +func (a *OpenTracingAppLayer) SessionHasPermissionToChannelByPost(session model.Session, postID string, permission *model.Permission) bool { origCtx := a.ctx span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.SessionHasPermissionToChannelByPost") @@ -13614,7 +13614,7 @@ func (a *OpenTracingAppLayer) SessionHasPermissionToChannelByPost(session model. }() defer span.Finish() - resultVar0 := a.app.SessionHasPermissionToChannelByPost(session, postId, permission) + resultVar0 := a.app.SessionHasPermissionToChannelByPost(session, postID, permission) return resultVar0 } @@ -13709,7 +13709,7 @@ func (a *OpenTracingAppLayer) SessionIsRegistered(session model.Session) bool { return resultVar0 } -func (a *OpenTracingAppLayer) SetActiveChannel(userID string, channelId string) *model.AppError { +func (a *OpenTracingAppLayer) SetActiveChannel(userID string, channelID string) *model.AppError { origCtx := a.ctx span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.SetActiveChannel") @@ -13721,7 +13721,7 @@ func (a *OpenTracingAppLayer) SetActiveChannel(userID string, channelId string) }() defer span.Finish() - resultVar0 := a.app.SetActiveChannel(userID, channelId) + resultVar0 := a.app.SetActiveChannel(userID, channelID) if resultVar0 != nil { span.LogFields(spanlog.Error(resultVar0)) @@ -13856,7 +13856,7 @@ func (a *OpenTracingAppLayer) SetPhase2PermissionsMigrationStatus(isComplete boo return resultVar0 } -func (a *OpenTracingAppLayer) SetPluginKey(pluginId string, key string, value []byte) *model.AppError { +func (a *OpenTracingAppLayer) SetPluginKey(pluginID string, key string, value []byte) *model.AppError { origCtx := a.ctx span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.SetPluginKey") @@ -13868,7 +13868,7 @@ func (a *OpenTracingAppLayer) SetPluginKey(pluginId string, key string, value [] }() defer span.Finish() - resultVar0 := a.app.SetPluginKey(pluginId, key, value) + resultVar0 := a.app.SetPluginKey(pluginID, key, value) if resultVar0 != nil { span.LogFields(spanlog.Error(resultVar0)) @@ -13878,7 +13878,7 @@ func (a *OpenTracingAppLayer) SetPluginKey(pluginId string, key string, value [] return resultVar0 } -func (a *OpenTracingAppLayer) SetPluginKeyWithExpiry(pluginId string, key string, value []byte, expireInSeconds int64) *model.AppError { +func (a *OpenTracingAppLayer) SetPluginKeyWithExpiry(pluginID string, key string, value []byte, expireInSeconds int64) *model.AppError { origCtx := a.ctx span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.SetPluginKeyWithExpiry") @@ -13890,7 +13890,7 @@ func (a *OpenTracingAppLayer) SetPluginKeyWithExpiry(pluginId string, key string }() defer span.Finish() - resultVar0 := a.app.SetPluginKeyWithExpiry(pluginId, key, value, expireInSeconds) + resultVar0 := a.app.SetPluginKeyWithExpiry(pluginID, key, value, expireInSeconds) if resultVar0 != nil { span.LogFields(spanlog.Error(resultVar0)) @@ -13900,7 +13900,7 @@ func (a *OpenTracingAppLayer) SetPluginKeyWithExpiry(pluginId string, key string return resultVar0 } -func (a *OpenTracingAppLayer) SetPluginKeyWithOptions(pluginId string, key string, value []byte, options model.PluginKVSetOptions) (bool, *model.AppError) { +func (a *OpenTracingAppLayer) SetPluginKeyWithOptions(pluginID string, key string, value []byte, options model.PluginKVSetOptions) (bool, *model.AppError) { origCtx := a.ctx span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.SetPluginKeyWithOptions") @@ -13912,7 +13912,7 @@ func (a *OpenTracingAppLayer) SetPluginKeyWithOptions(pluginId string, key strin }() defer span.Finish() - resultVar0, resultVar1 := a.app.SetPluginKeyWithOptions(pluginId, key, value, options) + resultVar0, resultVar1 := a.app.SetPluginKeyWithOptions(pluginID, key, value, options) if resultVar1 != nil { span.LogFields(spanlog.Error(resultVar1)) @@ -14669,7 +14669,7 @@ func (a *OpenTracingAppLayer) TestSiteURL(siteURL string) *model.AppError { return resultVar0 } -func (a *OpenTracingAppLayer) ToggleMuteChannel(channelId string, userID string) (*model.ChannelMember, *model.AppError) { +func (a *OpenTracingAppLayer) ToggleMuteChannel(channelID string, userID string) (*model.ChannelMember, *model.AppError) { origCtx := a.ctx span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.ToggleMuteChannel") @@ -14681,7 +14681,7 @@ func (a *OpenTracingAppLayer) ToggleMuteChannel(channelId string, userID string) }() defer span.Finish() - resultVar0, resultVar1 := a.app.ToggleMuteChannel(channelId, userID) + resultVar0, resultVar1 := a.app.ToggleMuteChannel(channelID, userID) if resultVar1 != nil { span.LogFields(spanlog.Error(resultVar1)) @@ -14723,7 +14723,7 @@ func (a *OpenTracingAppLayer) TriggerWebhook(payload *model.OutgoingWebhookPaylo a.app.TriggerWebhook(payload, hook, post, channel) } -func (a *OpenTracingAppLayer) UnregisterPluginCommand(pluginId string, teamID string, trigger string) { +func (a *OpenTracingAppLayer) UnregisterPluginCommand(pluginID string, teamID string, trigger string) { origCtx := a.ctx span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.UnregisterPluginCommand") @@ -14735,10 +14735,10 @@ func (a *OpenTracingAppLayer) UnregisterPluginCommand(pluginId string, teamID st }() defer span.Finish() - a.app.UnregisterPluginCommand(pluginId, teamID, trigger) + a.app.UnregisterPluginCommand(pluginID, teamID, trigger) } -func (a *OpenTracingAppLayer) UnregisterPluginCommands(pluginId string) { +func (a *OpenTracingAppLayer) UnregisterPluginCommands(pluginID string) { origCtx := a.ctx span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.UnregisterPluginCommands") @@ -14750,7 +14750,7 @@ func (a *OpenTracingAppLayer) UnregisterPluginCommands(pluginId string) { }() defer span.Finish() - a.app.UnregisterPluginCommands(pluginId) + a.app.UnregisterPluginCommands(pluginID) } func (a *OpenTracingAppLayer) UpdateActive(user *model.User, active bool) (*model.User, *model.AppError) { @@ -14841,7 +14841,7 @@ func (a *OpenTracingAppLayer) UpdateChannel(channel *model.Channel) (*model.Chan return resultVar0, resultVar1 } -func (a *OpenTracingAppLayer) UpdateChannelLastViewedAt(channelIds []string, userID string) *model.AppError { +func (a *OpenTracingAppLayer) UpdateChannelLastViewedAt(channelIDs []string, userID string) *model.AppError { origCtx := a.ctx span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.UpdateChannelLastViewedAt") @@ -14853,7 +14853,7 @@ func (a *OpenTracingAppLayer) UpdateChannelLastViewedAt(channelIds []string, use }() defer span.Finish() - resultVar0 := a.app.UpdateChannelLastViewedAt(channelIds, userID) + resultVar0 := a.app.UpdateChannelLastViewedAt(channelIDs, userID) if resultVar0 != nil { span.LogFields(spanlog.Error(resultVar0)) @@ -14863,7 +14863,7 @@ func (a *OpenTracingAppLayer) UpdateChannelLastViewedAt(channelIds []string, use return resultVar0 } -func (a *OpenTracingAppLayer) UpdateChannelMemberNotifyProps(data map[string]string, channelId string, userID string) (*model.ChannelMember, *model.AppError) { +func (a *OpenTracingAppLayer) UpdateChannelMemberNotifyProps(data map[string]string, channelID string, userID string) (*model.ChannelMember, *model.AppError) { origCtx := a.ctx span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.UpdateChannelMemberNotifyProps") @@ -14875,7 +14875,7 @@ func (a *OpenTracingAppLayer) UpdateChannelMemberNotifyProps(data map[string]str }() defer span.Finish() - resultVar0, resultVar1 := a.app.UpdateChannelMemberNotifyProps(data, channelId, userID) + resultVar0, resultVar1 := a.app.UpdateChannelMemberNotifyProps(data, channelID, userID) if resultVar1 != nil { span.LogFields(spanlog.Error(resultVar1)) @@ -14885,7 +14885,7 @@ func (a *OpenTracingAppLayer) UpdateChannelMemberNotifyProps(data map[string]str return resultVar0, resultVar1 } -func (a *OpenTracingAppLayer) UpdateChannelMemberRoles(channelId string, userID string, newRoles string) (*model.ChannelMember, *model.AppError) { +func (a *OpenTracingAppLayer) UpdateChannelMemberRoles(channelID string, userID string, newRoles string) (*model.ChannelMember, *model.AppError) { origCtx := a.ctx span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.UpdateChannelMemberRoles") @@ -14897,7 +14897,7 @@ func (a *OpenTracingAppLayer) UpdateChannelMemberRoles(channelId string, userID }() defer span.Finish() - resultVar0, resultVar1 := a.app.UpdateChannelMemberRoles(channelId, userID, newRoles) + resultVar0, resultVar1 := a.app.UpdateChannelMemberRoles(channelID, userID, newRoles) if resultVar1 != nil { span.LogFields(spanlog.Error(resultVar1)) @@ -14907,7 +14907,7 @@ func (a *OpenTracingAppLayer) UpdateChannelMemberRoles(channelId string, userID return resultVar0, resultVar1 } -func (a *OpenTracingAppLayer) UpdateChannelMemberSchemeRoles(channelId string, userID string, isSchemeGuest bool, isSchemeUser bool, isSchemeAdmin bool) (*model.ChannelMember, *model.AppError) { +func (a *OpenTracingAppLayer) UpdateChannelMemberSchemeRoles(channelID string, userID string, isSchemeGuest bool, isSchemeUser bool, isSchemeAdmin bool) (*model.ChannelMember, *model.AppError) { origCtx := a.ctx span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.UpdateChannelMemberSchemeRoles") @@ -14919,7 +14919,7 @@ func (a *OpenTracingAppLayer) UpdateChannelMemberSchemeRoles(channelId string, u }() defer span.Finish() - resultVar0, resultVar1 := a.app.UpdateChannelMemberSchemeRoles(channelId, userID, isSchemeGuest, isSchemeUser, isSchemeAdmin) + resultVar0, resultVar1 := a.app.UpdateChannelMemberSchemeRoles(channelID, userID, isSchemeGuest, isSchemeUser, isSchemeAdmin) if resultVar1 != nil { span.LogFields(spanlog.Error(resultVar1)) @@ -15938,7 +15938,7 @@ func (a *OpenTracingAppLayer) UploadEmojiImage(id string, imageData *multipart.F return resultVar0 } -func (a *OpenTracingAppLayer) UploadFile(data []byte, channelId string, filename string) (*model.FileInfo, *model.AppError) { +func (a *OpenTracingAppLayer) UploadFile(data []byte, channelID string, filename string) (*model.FileInfo, *model.AppError) { origCtx := a.ctx span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.UploadFile") @@ -15950,7 +15950,7 @@ func (a *OpenTracingAppLayer) UploadFile(data []byte, channelId string, filename }() defer span.Finish() - resultVar0, resultVar1 := a.app.UploadFile(data, channelId, filename) + resultVar0, resultVar1 := a.app.UploadFile(data, channelID, filename) if resultVar1 != nil { span.LogFields(spanlog.Error(resultVar1)) @@ -15960,7 +15960,7 @@ func (a *OpenTracingAppLayer) UploadFile(data []byte, channelId string, filename return resultVar0, resultVar1 } -func (a *OpenTracingAppLayer) UploadFileX(channelId string, name string, input io.Reader, opts ...func(*app.UploadFileTask)) (*model.FileInfo, *model.AppError) { +func (a *OpenTracingAppLayer) UploadFileX(channelID string, name string, input io.Reader, opts ...func(*app.UploadFileTask)) (*model.FileInfo, *model.AppError) { origCtx := a.ctx span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.UploadFileX") @@ -15972,7 +15972,7 @@ func (a *OpenTracingAppLayer) UploadFileX(channelId string, name string, input i }() defer span.Finish() - resultVar0, resultVar1 := a.app.UploadFileX(channelId, name, input, opts...) + resultVar0, resultVar1 := a.app.UploadFileX(channelID, name, input, opts...) if resultVar1 != nil { span.LogFields(spanlog.Error(resultVar1)) @@ -15982,7 +15982,7 @@ func (a *OpenTracingAppLayer) UploadFileX(channelId string, name string, input i return resultVar0, resultVar1 } -func (a *OpenTracingAppLayer) UploadFiles(teamID string, channelId string, userID string, files []io.ReadCloser, filenames []string, clientIds []string, now time.Time) (*model.FileUploadResponse, *model.AppError) { +func (a *OpenTracingAppLayer) UploadFiles(teamID string, channelID string, userID string, files []io.ReadCloser, filenames []string, clientIds []string, now time.Time) (*model.FileUploadResponse, *model.AppError) { origCtx := a.ctx span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.UploadFiles") @@ -15994,7 +15994,7 @@ func (a *OpenTracingAppLayer) UploadFiles(teamID string, channelId string, userI }() defer span.Finish() - resultVar0, resultVar1 := a.app.UploadFiles(teamID, channelId, userID, files, filenames, clientIds, now) + resultVar0, resultVar1 := a.app.UploadFiles(teamID, channelID, userID, files, filenames, clientIds, now) if resultVar1 != nil { span.LogFields(spanlog.Error(resultVar1)) @@ -16004,7 +16004,7 @@ func (a *OpenTracingAppLayer) UploadFiles(teamID string, channelId string, userI return resultVar0, resultVar1 } -func (a *OpenTracingAppLayer) UploadMultipartFiles(teamID string, channelId string, userID string, fileHeaders []*multipart.FileHeader, clientIds []string, now time.Time) (*model.FileUploadResponse, *model.AppError) { +func (a *OpenTracingAppLayer) UploadMultipartFiles(teamID string, channelID string, userID string, fileHeaders []*multipart.FileHeader, clientIds []string, now time.Time) (*model.FileUploadResponse, *model.AppError) { origCtx := a.ctx span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.UploadMultipartFiles") @@ -16016,7 +16016,7 @@ func (a *OpenTracingAppLayer) UploadMultipartFiles(teamID string, channelId stri }() defer span.Finish() - resultVar0, resultVar1 := a.app.UploadMultipartFiles(teamID, channelId, userID, fileHeaders, clientIds, now) + resultVar0, resultVar1 := a.app.UploadMultipartFiles(teamID, channelID, userID, fileHeaders, clientIds, now) if resultVar1 != nil { span.LogFields(spanlog.Error(resultVar1)) @@ -16202,7 +16202,7 @@ func (a *OpenTracingAppLayer) ViewChannel(view *model.ChannelView, userID string return resultVar0, resultVar1 } -func (a *OpenTracingAppLayer) WaitForChannelMembership(channelId string, userID string) { +func (a *OpenTracingAppLayer) WaitForChannelMembership(channelID string, userID string) { origCtx := a.ctx span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.WaitForChannelMembership") @@ -16214,7 +16214,7 @@ func (a *OpenTracingAppLayer) WaitForChannelMembership(channelId string, userID }() defer span.Finish() - a.app.WaitForChannelMembership(channelId, userID) + a.app.WaitForChannelMembership(channelID, userID) } func (a *OpenTracingAppLayer) WriteFile(fr io.Reader, path string) (int64, *model.AppError) { diff --git a/app/plugin.go b/app/plugin.go index f86c3526e28..b7c136d249a 100644 --- a/app/plugin.go +++ b/app/plugin.go @@ -31,7 +31,7 @@ import ( const prepackagedPluginsDir = "prepackaged_plugins" type pluginSignaturePath struct { - pluginId string + pluginID string path string signaturePath string } @@ -91,9 +91,9 @@ func (a *App) SyncPluginsActiveState() { disabledPlugins := []*model.BundleInfo{} enabledPlugins := []*model.BundleInfo{} for _, plugin := range availablePlugins { - pluginId := plugin.Manifest.Id + pluginID := plugin.Manifest.Id pluginEnabled := false - if state, ok := config.PluginStates[pluginId]; ok { + if state, ok := config.PluginStates[pluginID]; ok { pluginEnabled = state.Enable } @@ -128,8 +128,8 @@ func (a *App) SyncPluginsActiveState() { go func(plugin *model.BundleInfo) { defer wg.Done() - pluginId := plugin.Manifest.Id - updatedManifest, activated, err := pluginsEnvironment.Activate(pluginId) + pluginID := plugin.Manifest.Id + updatedManifest, activated, err := pluginsEnvironment.Activate(pluginID) if err != nil { plugin.WrapLogger(a.Log()).Error("Unable to activate plugin", mlog.Err(err)) return @@ -494,7 +494,7 @@ func (a *App) GetMarketplacePlugins(filter *model.MarketplacePluginFilter) ([]*m } // getPrepackagedPlugin returns a pre-packaged plugin. -func (a *App) getPrepackagedPlugin(pluginId, version string) (*plugin.PrepackagedPlugin, *model.AppError) { +func (a *App) getPrepackagedPlugin(pluginID, version string) (*plugin.PrepackagedPlugin, *model.AppError) { pluginsEnvironment := a.GetPluginsEnvironment() if pluginsEnvironment == nil { return nil, model.NewAppError("getPrepackagedPlugin", "app.plugin.config.app_error", nil, "plugin environment is nil", http.StatusInternalServerError) @@ -502,7 +502,7 @@ func (a *App) getPrepackagedPlugin(pluginId, version string) (*plugin.Prepackage prepackagedPlugins := pluginsEnvironment.PrepackagedPlugins() for _, p := range prepackagedPlugins { - if p.Manifest.Id == pluginId && p.Manifest.Version == version { + if p.Manifest.Id == pluginID && p.Manifest.Version == version { return p, nil } } @@ -511,7 +511,7 @@ func (a *App) getPrepackagedPlugin(pluginId, version string) (*plugin.Prepackage } // getRemoteMarketplacePlugin returns plugin from marketplace-server. -func (a *App) getRemoteMarketplacePlugin(pluginId, version string) (*model.BaseMarketplacePlugin, *model.AppError) { +func (a *App) getRemoteMarketplacePlugin(pluginID, version string) (*model.BaseMarketplacePlugin, *model.AppError) { marketplaceClient, err := marketplace.NewClient( *a.Config().PluginSettings.MarketplaceUrl, a.HTTPService(), @@ -521,7 +521,7 @@ func (a *App) getRemoteMarketplacePlugin(pluginId, version string) (*model.BaseM } filter := a.getBaseMarketplaceFilter() - filter.PluginId = pluginId + filter.PluginId = pluginID filter.ReturnAllVersions = true plugin, err := marketplaceClient.GetPlugin(filter, version) @@ -791,7 +791,7 @@ func (a *App) getPluginsFromFilePaths(fileStorePaths []string) map[string]*plugi if strings.HasSuffix(path, ".tar.gz") { id := strings.TrimSuffix(filepath.Base(path), ".tar.gz") helper := &pluginSignaturePath{ - pluginId: id, + pluginID: id, path: path, signaturePath: "", } @@ -907,16 +907,16 @@ func (a *App) installFeatureFlagPlugins() { return } - for pluginId, version := range ffControledPlugins { + for pluginID, version := range ffControledPlugins { // Skip installing if the plugin has been previously disabled. - pluginState := a.Config().PluginSettings.PluginStates[pluginId] + pluginState := a.Config().PluginSettings.PluginStates[pluginID] if pluginState != nil && !pluginState.Enable { - a.Log().Debug("Not auto installing/upgrade because plugin was disabled", mlog.String("plugin_id", pluginId), mlog.String("version", version)) + a.Log().Debug("Not auto installing/upgrade because plugin was disabled", mlog.String("plugin_id", pluginID), mlog.String("version", version)) continue } // Check if we already installed this version as InstallMarketplacePlugin can't handle re-installs well. - pluginStatus, err := a.Srv().GetPluginStatus(pluginId) + pluginStatus, err := a.Srv().GetPluginStatus(pluginID) pluginExists := err == nil if pluginExists && pluginStatus.Version == version { continue @@ -929,32 +929,32 @@ func (a *App) installFeatureFlagPlugins() { if !inCloud && pluginExists { parsedVersion, err := semver.Parse(version) if err != nil { - a.Log().Debug("Bad version from feature flag", mlog.String("plugin_id", pluginId), mlog.Err(err), mlog.String("version", version)) + a.Log().Debug("Bad version from feature flag", mlog.String("plugin_id", pluginID), mlog.Err(err), mlog.String("version", version)) return } parsedExistingVersion, err := semver.Parse(pluginStatus.Version) if err != nil { - a.Log().Debug("Bad version from plugin manifest", mlog.String("plugin_id", pluginId), mlog.Err(err), mlog.String("version", pluginStatus.Version)) + a.Log().Debug("Bad version from plugin manifest", mlog.String("plugin_id", pluginID), mlog.Err(err), mlog.String("version", pluginStatus.Version)) return } if parsedVersion.LTE(parsedExistingVersion) { - a.Log().Debug("Skip installation because given version was a downgrade and on-prem installations should not downgrade.", mlog.String("plugin_id", pluginId), mlog.Err(err), mlog.String("version", pluginStatus.Version)) + a.Log().Debug("Skip installation because given version was a downgrade and on-prem installations should not downgrade.", mlog.String("plugin_id", pluginID), mlog.Err(err), mlog.String("version", pluginStatus.Version)) return } } _, err := a.InstallMarketplacePlugin(&model.InstallMarketplacePluginRequest{ - Id: pluginId, + Id: pluginID, Version: version, }) if err != nil { - a.Log().Debug("Unable to install plugin from FF manifest", mlog.String("plugin_id", pluginId), mlog.Err(err), mlog.String("version", version)) + a.Log().Debug("Unable to install plugin from FF manifest", mlog.String("plugin_id", pluginID), mlog.Err(err), mlog.String("version", version)) } else { - if err := a.EnablePlugin(pluginId); err != nil { - a.Log().Debug("Unable to enable plugin installed from feature flag.", mlog.String("plugin_id", pluginId), mlog.Err(err), mlog.String("version", version)) + if err := a.EnablePlugin(pluginID); err != nil { + a.Log().Debug("Unable to enable plugin installed from feature flag.", mlog.String("plugin_id", pluginID), mlog.Err(err), mlog.String("version", version)) } else { - a.Log().Debug("Installed and enabled plugin.", mlog.String("plugin_id", pluginId), mlog.String("version", version)) + a.Log().Debug("Installed and enabled plugin.", mlog.String("plugin_id", pluginID), mlog.String("version", version)) } } } diff --git a/app/plugin_api.go b/app/plugin_api.go index 35895075609..8efe843445c 100644 --- a/app/plugin_api.go +++ b/app/plugin_api.go @@ -85,8 +85,8 @@ func (api *PluginAPI) ExecuteSlashCommand(commandArgs *model.CommandArgs) (*mode return response, nil } -func (api *PluginAPI) GetSession(sessionId string) (*model.Session, *model.AppError) { - session, err := api.app.GetSessionById(sessionId) +func (api *PluginAPI) GetSession(sessionID string) (*model.Session, *model.AppError) { + session, err := api.app.GetSessionById(sessionID) if err != nil { return nil, err @@ -311,17 +311,17 @@ func (api *PluginAPI) UpdateUserStatus(userID, status string) (*model.Status, *m return api.app.GetStatus(userID) } -func (api *PluginAPI) GetUsersInChannel(channelId, sortBy string, page, perPage int) ([]*model.User, *model.AppError) { +func (api *PluginAPI) GetUsersInChannel(channelID, sortBy string, page, perPage int) ([]*model.User, *model.AppError) { switch sortBy { case model.CHANNEL_SORT_BY_USERNAME: return api.app.GetUsersInChannel(&model.UserGetOptions{ - InChannelId: channelId, + InChannelId: channelID, Page: page, PerPage: perPage, }) case model.CHANNEL_SORT_BY_STATUS: return api.app.GetUsersInChannelByStatus(&model.UserGetOptions{ - InChannelId: channelId, + InChannelId: channelID, Page: page, PerPage: perPage, }) @@ -357,8 +357,8 @@ func (api *PluginAPI) CreateChannel(channel *model.Channel) (*model.Channel, *mo return api.app.CreateChannel(channel, false) } -func (api *PluginAPI) DeleteChannel(channelId string) *model.AppError { - channel, err := api.app.GetChannel(channelId) +func (api *PluginAPI) DeleteChannel(channelID string) *model.AppError { + channel, err := api.app.GetChannel(channelID) if err != nil { return err } @@ -373,8 +373,8 @@ func (api *PluginAPI) GetPublicChannelsForTeam(teamID string, page, perPage int) return *channels, err } -func (api *PluginAPI) GetChannel(channelId string) (*model.Channel, *model.AppError) { - return api.app.GetChannel(channelId) +func (api *PluginAPI) GetChannel(channelID string) (*model.Channel, *model.AppError) { + return api.app.GetChannel(channelID) } func (api *PluginAPI) GetChannelByName(teamID, name string, includeDeleted bool) (*model.Channel, *model.AppError) { @@ -393,16 +393,16 @@ func (api *PluginAPI) GetChannelsForTeamForUser(teamID, userID string, includeDe return *channels, err } -func (api *PluginAPI) GetChannelStats(channelId string) (*model.ChannelStats, *model.AppError) { - memberCount, err := api.app.GetChannelMemberCount(channelId) +func (api *PluginAPI) GetChannelStats(channelID string) (*model.ChannelStats, *model.AppError) { + memberCount, err := api.app.GetChannelMemberCount(channelID) if err != nil { return nil, err } - guestCount, err := api.app.GetChannelMemberCount(channelId) + guestCount, err := api.app.GetChannelMemberCount(channelID) if err != nil { return nil, err } - return &model.ChannelStats{ChannelId: channelId, MemberCount: memberCount, GuestCount: guestCount}, nil + return &model.ChannelStats{ChannelId: channelID, MemberCount: memberCount, GuestCount: guestCount}, nil } func (api *PluginAPI) GetDirectChannel(userID1, userID2 string) (*model.Channel, *model.AppError) { @@ -476,12 +476,12 @@ func (api *PluginAPI) SearchPostsInTeamForUser(teamID string, userID string, sea return api.app.SearchPostsInTeamForUser(terms, userID, teamID, isOrSearch, includeDeletedChannels, timeZoneOffset, page, perPage) } -func (api *PluginAPI) AddChannelMember(channelId, userID string) (*model.ChannelMember, *model.AppError) { +func (api *PluginAPI) AddChannelMember(channelID, userID string) (*model.ChannelMember, *model.AppError) { // For now, don't allow overriding these via the plugin API. userRequestorId := "" postRootId := "" - channel, err := api.GetChannel(channelId) + channel, err := api.GetChannel(channelID) if err != nil { return nil, err } @@ -489,10 +489,10 @@ func (api *PluginAPI) AddChannelMember(channelId, userID string) (*model.Channel return api.app.AddChannelMember(userID, channel, userRequestorId, postRootId) } -func (api *PluginAPI) AddUserToChannel(channelId, userID, asUserId string) (*model.ChannelMember, *model.AppError) { +func (api *PluginAPI) AddUserToChannel(channelID, userID, asUserId string) (*model.ChannelMember, *model.AppError) { postRootId := "" - channel, err := api.GetChannel(channelId) + channel, err := api.GetChannel(channelID) if err != nil { return nil, err } @@ -500,32 +500,32 @@ func (api *PluginAPI) AddUserToChannel(channelId, userID, asUserId string) (*mod return api.app.AddChannelMember(userID, channel, asUserId, postRootId) } -func (api *PluginAPI) GetChannelMember(channelId, userID string) (*model.ChannelMember, *model.AppError) { - return api.app.GetChannelMember(channelId, userID) +func (api *PluginAPI) GetChannelMember(channelID, userID string) (*model.ChannelMember, *model.AppError) { + return api.app.GetChannelMember(channelID, userID) } -func (api *PluginAPI) GetChannelMembers(channelId string, page, perPage int) (*model.ChannelMembers, *model.AppError) { - return api.app.GetChannelMembersPage(channelId, page, perPage) +func (api *PluginAPI) GetChannelMembers(channelID string, page, perPage int) (*model.ChannelMembers, *model.AppError) { + return api.app.GetChannelMembersPage(channelID, page, perPage) } -func (api *PluginAPI) GetChannelMembersByIds(channelId string, userIDs []string) (*model.ChannelMembers, *model.AppError) { - return api.app.GetChannelMembersByIds(channelId, userIDs) +func (api *PluginAPI) GetChannelMembersByIds(channelID string, userIDs []string) (*model.ChannelMembers, *model.AppError) { + return api.app.GetChannelMembersByIds(channelID, userIDs) } func (api *PluginAPI) GetChannelMembersForUser(teamID, userID string, page, perPage int) ([]*model.ChannelMember, *model.AppError) { return api.app.GetChannelMembersForUserWithPagination(teamID, userID, page, perPage) } -func (api *PluginAPI) UpdateChannelMemberRoles(channelId, userID, newRoles string) (*model.ChannelMember, *model.AppError) { - return api.app.UpdateChannelMemberRoles(channelId, userID, newRoles) +func (api *PluginAPI) UpdateChannelMemberRoles(channelID, userID, newRoles string) (*model.ChannelMember, *model.AppError) { + return api.app.UpdateChannelMemberRoles(channelID, userID, newRoles) } -func (api *PluginAPI) UpdateChannelMemberNotifications(channelId, userID string, notifications map[string]string) (*model.ChannelMember, *model.AppError) { - return api.app.UpdateChannelMemberNotifyProps(notifications, channelId, userID) +func (api *PluginAPI) UpdateChannelMemberNotifications(channelID, userID string, notifications map[string]string) (*model.ChannelMember, *model.AppError) { + return api.app.UpdateChannelMemberNotifyProps(notifications, channelID, userID) } -func (api *PluginAPI) DeleteChannelMember(channelId, userID string) *model.AppError { - return api.app.LeaveChannel(channelId, userID) +func (api *PluginAPI) DeleteChannelMember(channelID, userID string) *model.AppError { + return api.app.LeaveChannel(channelID, userID) } func (api *PluginAPI) GetGroup(groupId string) (*model.Group, *model.AppError) { @@ -552,8 +552,8 @@ func (api *PluginAPI) RemoveReaction(reaction *model.Reaction) *model.AppError { return api.app.DeleteReactionForPost(reaction) } -func (api *PluginAPI) GetReactions(postId string) ([]*model.Reaction, *model.AppError) { - return api.app.GetReactionsForPost(postId) +func (api *PluginAPI) GetReactions(postID string) ([]*model.Reaction, *model.AppError) { + return api.app.GetReactionsForPost(postID) } func (api *PluginAPI) SendEphemeralPost(userID string, post *model.Post) *model.Post { @@ -564,37 +564,37 @@ func (api *PluginAPI) UpdateEphemeralPost(userID string, post *model.Post) *mode return api.app.UpdateEphemeralPost(userID, post) } -func (api *PluginAPI) DeleteEphemeralPost(userID, postId string) { - api.app.DeleteEphemeralPost(userID, postId) +func (api *PluginAPI) DeleteEphemeralPost(userID, postID string) { + api.app.DeleteEphemeralPost(userID, postID) } -func (api *PluginAPI) DeletePost(postId string) *model.AppError { - _, err := api.app.DeletePost(postId, api.id) +func (api *PluginAPI) DeletePost(postID string) *model.AppError { + _, err := api.app.DeletePost(postID, api.id) return err } -func (api *PluginAPI) GetPostThread(postId string) (*model.PostList, *model.AppError) { - return api.app.GetPostThread(postId, false, false, false) +func (api *PluginAPI) GetPostThread(postID string) (*model.PostList, *model.AppError) { + return api.app.GetPostThread(postID, false, false, false) } -func (api *PluginAPI) GetPost(postId string) (*model.Post, *model.AppError) { - return api.app.GetSinglePost(postId) +func (api *PluginAPI) GetPost(postID string) (*model.Post, *model.AppError) { + return api.app.GetSinglePost(postID) } -func (api *PluginAPI) GetPostsSince(channelId string, time int64) (*model.PostList, *model.AppError) { - return api.app.GetPostsSince(model.GetPostsSinceOptions{ChannelId: channelId, Time: time}) +func (api *PluginAPI) GetPostsSince(channelID string, time int64) (*model.PostList, *model.AppError) { + return api.app.GetPostsSince(model.GetPostsSinceOptions{ChannelId: channelID, Time: time}) } -func (api *PluginAPI) GetPostsAfter(channelId, postId string, page, perPage int) (*model.PostList, *model.AppError) { - return api.app.GetPostsAfterPost(model.GetPostsOptions{ChannelId: channelId, PostId: postId, Page: page, PerPage: perPage}) +func (api *PluginAPI) GetPostsAfter(channelID, postID string, page, perPage int) (*model.PostList, *model.AppError) { + return api.app.GetPostsAfterPost(model.GetPostsOptions{ChannelId: channelID, PostId: postID, Page: page, PerPage: perPage}) } -func (api *PluginAPI) GetPostsBefore(channelId, postId string, page, perPage int) (*model.PostList, *model.AppError) { - return api.app.GetPostsBeforePost(model.GetPostsOptions{ChannelId: channelId, PostId: postId, Page: page, PerPage: perPage}) +func (api *PluginAPI) GetPostsBefore(channelID, postID string, page, perPage int) (*model.PostList, *model.AppError) { + return api.app.GetPostsBeforePost(model.GetPostsOptions{ChannelId: channelID, PostId: postID, Page: page, PerPage: perPage}) } -func (api *PluginAPI) GetPostsForChannel(channelId string, page, perPage int) (*model.PostList, *model.AppError) { - return api.app.GetPostsPage(model.GetPostsOptions{ChannelId: channelId, Page: page, PerPage: perPage}) +func (api *PluginAPI) GetPostsForChannel(channelID string, page, perPage int) (*model.PostList, *model.AppError) { + return api.app.GetPostsPage(model.GetPostsOptions{ChannelId: channelID, Page: page, PerPage: perPage}) } func (api *PluginAPI) UpdatePost(post *model.Post) (*model.Post, *model.AppError) { @@ -632,24 +632,24 @@ func (api *PluginAPI) GetEmoji(emojiId string) (*model.Emoji, *model.AppError) { return api.app.GetEmoji(emojiId) } -func (api *PluginAPI) CopyFileInfos(userID string, fileIds []string) ([]string, *model.AppError) { - return api.app.CopyFileInfos(userID, fileIds) +func (api *PluginAPI) CopyFileInfos(userID string, fileIDs []string) ([]string, *model.AppError) { + return api.app.CopyFileInfos(userID, fileIDs) } -func (api *PluginAPI) GetFileInfo(fileId string) (*model.FileInfo, *model.AppError) { - return api.app.GetFileInfo(fileId) +func (api *PluginAPI) GetFileInfo(fileID string) (*model.FileInfo, *model.AppError) { + return api.app.GetFileInfo(fileID) } func (api *PluginAPI) GetFileInfos(page, perPage int, opt *model.GetFileInfosOptions) ([]*model.FileInfo, *model.AppError) { return api.app.GetFileInfos(page, perPage, opt) } -func (api *PluginAPI) GetFileLink(fileId string) (string, *model.AppError) { +func (api *PluginAPI) GetFileLink(fileID string) (string, *model.AppError) { if !*api.app.Config().FileSettings.EnablePublicLink { return "", model.NewAppError("GetFileLink", "plugin_api.get_file_link.disabled.app_error", nil, "", http.StatusNotImplemented) } - info, err := api.app.GetFileInfo(fileId) + info, err := api.app.GetFileInfo(fileID) if err != nil { return "", err } @@ -665,12 +665,12 @@ func (api *PluginAPI) ReadFile(path string) ([]byte, *model.AppError) { return api.app.ReadFile(path) } -func (api *PluginAPI) GetFile(fileId string) ([]byte, *model.AppError) { - return api.app.GetFile(fileId) +func (api *PluginAPI) GetFile(fileID string) ([]byte, *model.AppError) { + return api.app.GetFile(fileID) } -func (api *PluginAPI) UploadFile(data []byte, channelId string, filename string) (*model.FileInfo, *model.AppError) { - return api.app.UploadFile(data, channelId, filename) +func (api *PluginAPI) UploadFile(data []byte, channelID string, filename string) (*model.FileInfo, *model.AppError) { + return api.app.UploadFile(data, channelID, filename) } func (api *PluginAPI) GetEmojiImage(emojiId string) ([]byte, string, *model.AppError) { @@ -836,8 +836,8 @@ func (api *PluginAPI) HasPermissionToTeam(userID, teamID string, permission *mod return api.app.HasPermissionToTeam(userID, teamID, permission) } -func (api *PluginAPI) HasPermissionToChannel(userID, channelId string, permission *model.Permission) bool { - return api.app.HasPermissionToChannel(userID, channelId, permission) +func (api *PluginAPI) HasPermissionToChannel(userID, channelID string, permission *model.Permission) bool { + return api.app.HasPermissionToChannel(userID, channelID, permission) } func (api *PluginAPI) LogDebug(msg string, keyValuePairs ...interface{}) { @@ -915,8 +915,8 @@ func (api *PluginAPI) DeleteBotIconImage(userID string) *model.AppError { return api.app.DeleteBotIconImage(userID) } -func (api *PluginAPI) PublishUserTyping(userID, channelId, parentId string) *model.AppError { - return api.app.PublishUserTyping(userID, channelId, parentId) +func (api *PluginAPI) PublishUserTyping(userID, channelID, parentId string) *model.AppError { + return api.app.PublishUserTyping(userID, channelID, parentId) } func (api *PluginAPI) PluginHTTP(request *http.Request) *http.Response { diff --git a/app/plugin_api_test.go b/app/plugin_api_test.go index b123810c81e..1fedff19494 100644 --- a/app/plugin_api_test.go +++ b/app/plugin_api_test.go @@ -51,9 +51,9 @@ func getDefaultPluginSettingsSchema() string { return string(ret) } -func setDefaultPluginConfig(th *TestHelper, pluginId string) { +func setDefaultPluginConfig(th *TestHelper, pluginID string) { th.App.UpdateConfig(func(cfg *model.Config) { - cfg.PluginSettings.Plugins[pluginId] = map[string]interface{}{ + cfg.PluginSettings.Plugins[pluginID] = map[string]interface{}{ "BasicChannelName": th.BasicChannel.Name, "BasicChannelId": th.BasicChannel.Id, "BasicTeamName": th.BasicTeam.Name, @@ -68,7 +68,7 @@ func setDefaultPluginConfig(th *TestHelper, pluginId string) { }) } -func setupMultiPluginApiTest(t *testing.T, pluginCodes []string, pluginManifests []string, pluginIds []string, app *App) string { +func setupMultiPluginApiTest(t *testing.T, pluginCodes []string, pluginManifests []string, pluginIDs []string, app *App) string { pluginDir, err := ioutil.TempDir("", "") require.NoError(t, err) t.Cleanup(func() { @@ -90,21 +90,21 @@ func setupMultiPluginApiTest(t *testing.T, pluginCodes []string, pluginManifests env, err := plugin.NewEnvironment(app.NewPluginAPI, pluginDir, webappPluginDir, app.Log(), nil) require.NoError(t, err) - require.Equal(t, len(pluginCodes), len(pluginIds)) - require.Equal(t, len(pluginManifests), len(pluginIds)) + require.Equal(t, len(pluginCodes), len(pluginIDs)) + require.Equal(t, len(pluginManifests), len(pluginIDs)) - for i, pluginId := range pluginIds { - backend := filepath.Join(pluginDir, pluginId, "backend.exe") + for i, pluginID := range pluginIDs { + backend := filepath.Join(pluginDir, pluginID, "backend.exe") utils.CompileGo(t, pluginCodes[i], backend) - ioutil.WriteFile(filepath.Join(pluginDir, pluginId, "plugin.json"), []byte(pluginManifests[i]), 0600) - manifest, activated, reterr := env.Activate(pluginId) + ioutil.WriteFile(filepath.Join(pluginDir, pluginID, "plugin.json"), []byte(pluginManifests[i]), 0600) + manifest, activated, reterr := env.Activate(pluginID) require.NoError(t, reterr) require.NotNil(t, manifest) require.True(t, activated) app.UpdateConfig(func(cfg *model.Config) { - cfg.PluginSettings.PluginStates[pluginId] = &model.PluginState{ + cfg.PluginSettings.PluginStates[pluginID] = &model.PluginState{ Enable: true, } }) @@ -115,8 +115,8 @@ func setupMultiPluginApiTest(t *testing.T, pluginCodes []string, pluginManifests return pluginDir } -func setupPluginApiTest(t *testing.T, pluginCode string, pluginManifest string, pluginId string, app *App) string { - return setupMultiPluginApiTest(t, []string{pluginCode}, []string{pluginManifest}, []string{pluginId}, app) +func setupPluginApiTest(t *testing.T, pluginCode string, pluginManifest string, pluginID string, app *App) string { + return setupMultiPluginApiTest(t, []string{pluginCode}, []string{pluginManifest}, []string{pluginID}, app) } func TestPublicFilesPathConfiguration(t *testing.T) { @@ -1263,9 +1263,9 @@ func TestPluginCreatePostWithUploadedFile(t *testing.T) { api := th.SetupPluginAPI() data := []byte("Hello World") - channelId := th.BasicChannel.Id + channelID := th.BasicChannel.Id filename := "testGetFile" - fileInfo, err := api.UploadFile(data, channelId, filename) + fileInfo, err := api.UploadFile(data, channelID, filename) require.Nil(t, err) defer func() { th.App.Srv().Store.FileInfo().PermanentDelete(fileInfo.Id) @@ -1280,7 +1280,7 @@ func TestPluginCreatePostWithUploadedFile(t *testing.T) { post, err := api.CreatePost(&model.Post{ Message: "test", UserId: userID, - ChannelId: channelId, + ChannelId: channelID, FileIds: model.StringArray{fileInfo.Id}, }) require.Nil(t, err) @@ -1496,8 +1496,8 @@ func TestApiMetrics(t *testing.T) { th.App.SetPluginsEnvironment(env) - pluginId := model.NewId() - backend := filepath.Join(pluginDir, pluginId, "backend.exe") + pluginID := model.NewId() + backend := filepath.Join(pluginDir, pluginID, "backend.exe") code := ` package main @@ -1521,7 +1521,7 @@ func TestApiMetrics(t *testing.T) { } ` utils.CompileGo(t, code, backend) - ioutil.WriteFile(filepath.Join(pluginDir, pluginId, "plugin.json"), []byte(`{"id": "`+pluginId+`", "backend": {"executable": "backend.exe"}}`), 0600) + ioutil.WriteFile(filepath.Join(pluginDir, pluginID, "plugin.json"), []byte(`{"id": "`+pluginID+`", "backend": {"executable": "backend.exe"}}`), 0600) // Don't care about these mocks metricsMock.On("ObservePluginHookDuration", mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return() @@ -1529,12 +1529,12 @@ func TestApiMetrics(t *testing.T) { metricsMock.On("ObservePluginMultiHookDuration", mock.Anything).Return() // Setup mocks - metricsMock.On("ObservePluginApiDuration", pluginId, "UpdateUser", true, mock.Anything).Return() + metricsMock.On("ObservePluginApiDuration", pluginID, "UpdateUser", true, mock.Anything).Return() - _, _, activationErr := env.Activate(pluginId) + _, _, activationErr := env.Activate(pluginID) require.NoError(t, activationErr) - require.True(t, th.App.GetPluginsEnvironment().IsActive(pluginId)) + require.True(t, th.App.GetPluginsEnvironment().IsActive(pluginID)) user1 := &model.User{ Email: model.NewId() + "success+test@example.com", @@ -1551,8 +1551,8 @@ func TestApiMetrics(t *testing.T) { require.Equal(t, "plugin-callback-success", user1.Nickname) // Disable plugin - require.True(t, th.App.GetPluginsEnvironment().Deactivate(pluginId)) - require.False(t, th.App.GetPluginsEnvironment().IsActive(pluginId)) + require.True(t, th.App.GetPluginsEnvironment().Deactivate(pluginID)) + require.False(t, th.App.GetPluginsEnvironment().IsActive(pluginID)) metricsMock.AssertExpectations(t) }) diff --git a/app/plugin_commands.go b/app/plugin_commands.go index 090405b64eb..1875c28908c 100644 --- a/app/plugin_commands.go +++ b/app/plugin_commands.go @@ -19,7 +19,7 @@ type PluginCommand struct { PluginId string } -func (a *App) RegisterPluginCommand(pluginId string, command *model.Command) error { +func (a *App) RegisterPluginCommand(pluginID string, command *model.Command) error { if command.Trigger == "" { return errors.New("invalid command") } @@ -32,9 +32,9 @@ func (a *App) RegisterPluginCommand(pluginId string, command *model.Command) err if command.AutocompleteData == nil { command.AutocompleteData = model.NewAutocompleteData(command.Trigger, command.AutoCompleteHint, command.AutoCompleteDesc) } else { - baseURL, err := url.Parse("/plugins/" + pluginId) + baseURL, err := url.Parse("/plugins/" + pluginID) if err != nil { - return errors.Wrapf(err, "Can't parse url %s", "/plugins/"+pluginId) + return errors.Wrapf(err, "Can't parse url %s", "/plugins/"+pluginID) } err = command.AutocompleteData.UpdateRelativeURLsForPluginCommands(baseURL) if err != nil { @@ -58,7 +58,7 @@ func (a *App) RegisterPluginCommand(pluginId string, command *model.Command) err for _, pc := range a.Srv().pluginCommands { if pc.Command.Trigger == command.Trigger && pc.Command.TeamId == command.TeamId { - if pc.PluginId == pluginId { + if pc.PluginId == pluginID { pc.Command = command return nil } @@ -67,12 +67,12 @@ func (a *App) RegisterPluginCommand(pluginId string, command *model.Command) err a.Srv().pluginCommands = append(a.Srv().pluginCommands, &PluginCommand{ Command: command, - PluginId: pluginId, + PluginId: pluginID, }) return nil } -func (a *App) UnregisterPluginCommand(pluginId, teamID, trigger string) { +func (a *App) UnregisterPluginCommand(pluginID, teamID, trigger string) { trigger = strings.ToLower(trigger) a.Srv().pluginCommandsLock.Lock() @@ -87,13 +87,13 @@ func (a *App) UnregisterPluginCommand(pluginId, teamID, trigger string) { a.Srv().pluginCommands = remaining } -func (a *App) UnregisterPluginCommands(pluginId string) { +func (a *App) UnregisterPluginCommands(pluginID string) { a.Srv().pluginCommandsLock.Lock() defer a.Srv().pluginCommandsLock.Unlock() var remaining []*PluginCommand for _, pc := range a.Srv().pluginCommands { - if pc.PluginId != pluginId { + if pc.PluginId != pluginID { remaining = append(remaining, pc) } } @@ -152,8 +152,8 @@ func (a *App) tryExecutePluginCommand(args *model.CommandArgs) (*model.Command, args.AddUserMention(username, userID) } - for channelName, channelId := range a.MentionsToPublicChannels(args.Command, args.TeamId) { - args.AddChannelMention(channelName, channelId) + for channelName, channelID := range a.MentionsToPublicChannels(args.Command, args.TeamId) { + args.AddChannelMention(channelName, channelID) } response, appErr := pluginHooks.ExecuteCommand(a.PluginContext(), args) diff --git a/app/plugin_commands_test.go b/app/plugin_commands_test.go index e19871e0435..1d2ecb78a8b 100644 --- a/app/plugin_commands_test.go +++ b/app/plugin_commands_test.go @@ -35,7 +35,7 @@ func TestPluginCommand(t *testing.T) { } }) - tearDown, pluginIds, activationErrors := SetAppEnvironmentWithPlugins(t, []string{` + tearDown, pluginIDs, activationErrors := SetAppEnvironmentWithPlugins(t, []string{` package main import ( @@ -96,7 +96,7 @@ func TestPluginCommand(t *testing.T) { require.Equal(t, model.COMMAND_RESPONSE_TYPE_EPHEMERAL, resp.ResponseType) require.Equal(t, "text", resp.Text) - err2 := th.App.DisablePlugin(pluginIds[0]) + err2 := th.App.DisablePlugin(pluginIDs[0]) require.Nil(t, err2) commands, err3 := th.App.ListAutocompleteCommands(args.TeamId, utils.T) @@ -106,7 +106,7 @@ func TestPluginCommand(t *testing.T) { require.NotEqual(t, "plugin", commands.Trigger) } - th.App.RemovePlugin(pluginIds[0]) + th.App.RemovePlugin(pluginIDs[0]) }) t.Run("re-entrant command registration on config change", func(t *testing.T) { @@ -116,7 +116,7 @@ func TestPluginCommand(t *testing.T) { } }) - tearDown, pluginIds, activationErrors := SetAppEnvironmentWithPlugins(t, []string{` + tearDown, pluginIDs, activationErrors := SetAppEnvironmentWithPlugins(t, []string{` package main import ( @@ -207,7 +207,7 @@ func TestPluginCommand(t *testing.T) { killed = true } - th.App.RemovePlugin(pluginIds[0]) + th.App.RemovePlugin(pluginIDs[0]) require.False(t, killed, "execute command appears to have deadlocked") }) @@ -223,7 +223,7 @@ func TestPluginCommand(t *testing.T) { } }) - tearDown, pluginIds, activationErrors := SetAppEnvironmentWithPlugins(t, []string{` + tearDown, pluginIDs, activationErrors := SetAppEnvironmentWithPlugins(t, []string{` package main import ( @@ -285,10 +285,10 @@ func TestPluginCommand(t *testing.T) { require.Equal(t, model.COMMAND_RESPONSE_TYPE_EPHEMERAL, resp.ResponseType) require.Equal(t, "text", resp.Text) - th.App.RemovePlugin(pluginIds[0]) + th.App.RemovePlugin(pluginIDs[0]) }) t.Run("plugin has crashed before execution of command", func(t *testing.T) { - tearDown, pluginIds, activationErrors := SetAppEnvironmentWithPlugins(t, []string{` + tearDown, pluginIDs, activationErrors := SetAppEnvironmentWithPlugins(t, []string{` package main import ( @@ -329,11 +329,11 @@ func TestPluginCommand(t *testing.T) { require.Nil(t, resp) require.NotNil(t, err) require.Equal(t, err.Id, "model.plugin_command_error.error.app_error") - th.App.RemovePlugin(pluginIds[0]) + th.App.RemovePlugin(pluginIDs[0]) }) t.Run("plugin has crashed due to the execution of the command", func(t *testing.T) { - tearDown, pluginIds, activationErrors := SetAppEnvironmentWithPlugins(t, []string{` + tearDown, pluginIDs, activationErrors := SetAppEnvironmentWithPlugins(t, []string{` package main import ( @@ -374,7 +374,7 @@ func TestPluginCommand(t *testing.T) { require.Nil(t, resp) require.NotNil(t, err) require.Equal(t, err.Id, "model.plugin_command_crash.error.app_error") - th.App.RemovePlugin(pluginIds[0]) + th.App.RemovePlugin(pluginIDs[0]) }) } diff --git a/app/plugin_hooks_test.go b/app/plugin_hooks_test.go index 69264520f4c..98a00e6fefc 100644 --- a/app/plugin_hooks_test.go +++ b/app/plugin_hooks_test.go @@ -36,20 +36,20 @@ func SetAppEnvironmentWithPlugins(t *testing.T, pluginCode []string, app *App, a require.NoError(t, err) app.SetPluginsEnvironment(env) - pluginIds := []string{} + pluginIDs := []string{} activationErrors := []error{} for _, code := range pluginCode { - pluginId := model.NewId() - backend := filepath.Join(pluginDir, pluginId, "backend.exe") + pluginID := model.NewId() + backend := filepath.Join(pluginDir, pluginID, "backend.exe") utils.CompileGo(t, code, backend) - ioutil.WriteFile(filepath.Join(pluginDir, pluginId, "plugin.json"), []byte(`{"id": "`+pluginId+`", "backend": {"executable": "backend.exe"}}`), 0600) - _, _, activationErr := env.Activate(pluginId) - pluginIds = append(pluginIds, pluginId) + ioutil.WriteFile(filepath.Join(pluginDir, pluginID, "plugin.json"), []byte(`{"id": "`+pluginID+`", "backend": {"executable": "backend.exe"}}`), 0600) + _, _, activationErr := env.Activate(pluginID) + pluginIDs = append(pluginIDs, pluginID) activationErrors = append(activationErrors, activationErr) app.UpdateConfig(func(cfg *model.Config) { - cfg.PluginSettings.PluginStates[pluginId] = &model.PluginState{ + cfg.PluginSettings.PluginStates[pluginID] = &model.PluginState{ Enable: true, } }) @@ -58,7 +58,7 @@ func SetAppEnvironmentWithPlugins(t *testing.T, pluginCode []string, app *App, a return func() { os.RemoveAll(pluginDir) os.RemoveAll(webappPluginDir) - }, pluginIds, activationErrors + }, pluginIDs, activationErrors } func TestHookMessageWillBePosted(t *testing.T) { @@ -573,8 +573,8 @@ func TestHookFileWillBeUploaded(t *testing.T) { assert.NotNil(t, response) assert.Equal(t, 1, len(response.FileInfos)) - fileId := response.FileInfos[0].Id - fileInfo, err := th.App.GetFileInfo(fileId) + fileID := response.FileInfos[0].Id + fileInfo, err := th.App.GetFileInfo(fileID) assert.Nil(t, err) assert.NotNil(t, fileInfo) assert.Equal(t, "testhook.txt", fileInfo.Name) @@ -648,9 +648,9 @@ func TestHookFileWillBeUploaded(t *testing.T) { assert.Nil(t, err) assert.NotNil(t, response) assert.Equal(t, 1, len(response.FileInfos)) - fileId := response.FileInfos[0].Id + fileID := response.FileInfos[0].Id - fileInfo, err := th.App.GetFileInfo(fileId) + fileInfo, err := th.App.GetFileInfo(fileID) assert.Nil(t, err) assert.NotNil(t, fileInfo) assert.Equal(t, "modifiedinfo", fileInfo.Name) @@ -966,7 +966,7 @@ func TestActiveHooks(t *testing.T) { defer th.TearDown() t.Run("", func(t *testing.T) { - tearDown, pluginIds, _ := SetAppEnvironmentWithPlugins(t, + tearDown, pluginIDs, _ := SetAppEnvironmentWithPlugins(t, []string{ ` package main @@ -999,10 +999,10 @@ func TestActiveHooks(t *testing.T) { `}, th.App, th.App.NewPluginAPI) defer tearDown() - require.Len(t, pluginIds, 1) - pluginId := pluginIds[0] + require.Len(t, pluginIDs, 1) + pluginID := pluginIDs[0] - require.True(t, th.App.GetPluginsEnvironment().IsActive(pluginId)) + require.True(t, th.App.GetPluginsEnvironment().IsActive(pluginID)) user1 := &model.User{ Email: model.NewId() + "success+test@example.com", Nickname: "Darth Vader1", @@ -1018,15 +1018,15 @@ func TestActiveHooks(t *testing.T) { require.Equal(t, "plugin-callback-success", user1.Nickname) // Disable plugin - require.True(t, th.App.GetPluginsEnvironment().Deactivate(pluginId)) - require.False(t, th.App.GetPluginsEnvironment().IsActive(pluginId)) + require.True(t, th.App.GetPluginsEnvironment().Deactivate(pluginID)) + require.False(t, th.App.GetPluginsEnvironment().IsActive(pluginID)) - hooks, err := th.App.GetPluginsEnvironment().HooksForPlugin(pluginId) + hooks, err := th.App.GetPluginsEnvironment().HooksForPlugin(pluginID) require.Error(t, err) require.Nil(t, hooks) - // Should fail to find pluginId as it was deleted when deactivated - path, err := th.App.GetPluginsEnvironment().PublicFilesPath(pluginId) + // Should fail to find pluginID as it was deleted when deactivated + path, err := th.App.GetPluginsEnvironment().PublicFilesPath(pluginID) require.Error(t, err) require.Empty(t, path) }) @@ -1051,8 +1051,8 @@ func TestHookMetrics(t *testing.T) { th.App.SetPluginsEnvironment(env) - pluginId := model.NewId() - backend := filepath.Join(pluginDir, pluginId, "backend.exe") + pluginID := model.NewId() + backend := filepath.Join(pluginDir, pluginID, "backend.exe") code := ` package main @@ -1084,30 +1084,30 @@ func TestHookMetrics(t *testing.T) { } ` utils.CompileGo(t, code, backend) - ioutil.WriteFile(filepath.Join(pluginDir, pluginId, "plugin.json"), []byte(`{"id": "`+pluginId+`", "backend": {"executable": "backend.exe"}}`), 0600) + ioutil.WriteFile(filepath.Join(pluginDir, pluginID, "plugin.json"), []byte(`{"id": "`+pluginID+`", "backend": {"executable": "backend.exe"}}`), 0600) // Setup mocks before activating - metricsMock.On("ObservePluginHookDuration", pluginId, "Implemented", true, mock.Anything).Return() - metricsMock.On("ObservePluginHookDuration", pluginId, "OnActivate", true, mock.Anything).Return() - metricsMock.On("ObservePluginHookDuration", pluginId, "OnDeactivate", true, mock.Anything).Return() - metricsMock.On("ObservePluginHookDuration", pluginId, "OnConfigurationChange", true, mock.Anything).Return() - metricsMock.On("ObservePluginHookDuration", pluginId, "UserHasBeenCreated", true, mock.Anything).Return() + metricsMock.On("ObservePluginHookDuration", pluginID, "Implemented", true, mock.Anything).Return() + metricsMock.On("ObservePluginHookDuration", pluginID, "OnActivate", true, mock.Anything).Return() + metricsMock.On("ObservePluginHookDuration", pluginID, "OnDeactivate", true, mock.Anything).Return() + metricsMock.On("ObservePluginHookDuration", pluginID, "OnConfigurationChange", true, mock.Anything).Return() + metricsMock.On("ObservePluginHookDuration", pluginID, "UserHasBeenCreated", true, mock.Anything).Return() // Don't care about these calls. metricsMock.On("ObservePluginApiDuration", mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return() metricsMock.On("ObservePluginMultiHookIterationDuration", mock.Anything, mock.Anything, mock.Anything).Return() metricsMock.On("ObservePluginMultiHookDuration", mock.Anything).Return() - _, _, activationErr := env.Activate(pluginId) + _, _, activationErr := env.Activate(pluginID) require.NoError(t, activationErr) th.App.UpdateConfig(func(cfg *model.Config) { - cfg.PluginSettings.PluginStates[pluginId] = &model.PluginState{ + cfg.PluginSettings.PluginStates[pluginID] = &model.PluginState{ Enable: true, } }) - require.True(t, th.App.GetPluginsEnvironment().IsActive(pluginId)) + require.True(t, th.App.GetPluginsEnvironment().IsActive(pluginID)) user1 := &model.User{ Email: model.NewId() + "success+test@example.com", @@ -1124,8 +1124,8 @@ func TestHookMetrics(t *testing.T) { require.Equal(t, "plugin-callback-success", user1.Nickname) // Disable plugin - require.True(t, th.App.GetPluginsEnvironment().Deactivate(pluginId)) - require.False(t, th.App.GetPluginsEnvironment().IsActive(pluginId)) + require.True(t, th.App.GetPluginsEnvironment().Deactivate(pluginID)) + require.False(t, th.App.GetPluginsEnvironment().IsActive(pluginID)) metricsMock.AssertExpectations(t) }) diff --git a/app/plugin_install.go b/app/plugin_install.go index 8cba380d4e0..eab050b8ddf 100644 --- a/app/plugin_install.go +++ b/app/plugin_install.go @@ -466,14 +466,14 @@ func (a *App) removePluginLocally(id string) *model.AppError { return nil } -func (a *App) removeSignature(pluginId string) *model.AppError { - filePath := a.getSignatureStorePath(pluginId) +func (a *App) removeSignature(pluginID string) *model.AppError { + filePath := a.getSignatureStorePath(pluginID) exists, err := a.FileExists(filePath) if err != nil { return model.NewAppError("removeSignature", "app.plugin.remove_bundle.app_error", nil, err.Error(), http.StatusInternalServerError) } if !exists { - mlog.Debug("no plugin signature to remove", mlog.String("plugin_id", pluginId)) + mlog.Debug("no plugin signature to remove", mlog.String("plugin_id", pluginID)) return nil } if err = a.RemoveFile(filePath); err != nil { diff --git a/app/plugin_key_value_store.go b/app/plugin_key_value_store.go index 33413afb3c2..e3b519d8f00 100644 --- a/app/plugin_key_value_store.go +++ b/app/plugin_key_value_store.go @@ -20,35 +20,35 @@ func getKeyHash(key string) string { return base64.StdEncoding.EncodeToString(hash.Sum(nil)) } -func (a *App) SetPluginKey(pluginId string, key string, value []byte) *model.AppError { - return a.SetPluginKeyWithExpiry(pluginId, key, value, 0) +func (a *App) SetPluginKey(pluginID string, key string, value []byte) *model.AppError { + return a.SetPluginKeyWithExpiry(pluginID, key, value, 0) } -func (a *App) SetPluginKeyWithExpiry(pluginId string, key string, value []byte, expireInSeconds int64) *model.AppError { +func (a *App) SetPluginKeyWithExpiry(pluginID string, key string, value []byte, expireInSeconds int64) *model.AppError { options := model.PluginKVSetOptions{ ExpireInSeconds: expireInSeconds, } - _, err := a.SetPluginKeyWithOptions(pluginId, key, value, options) + _, err := a.SetPluginKeyWithOptions(pluginID, key, value, options) return err } -func (a *App) CompareAndSetPluginKey(pluginId string, key string, oldValue, newValue []byte) (bool, *model.AppError) { +func (a *App) CompareAndSetPluginKey(pluginID string, key string, oldValue, newValue []byte) (bool, *model.AppError) { options := model.PluginKVSetOptions{ Atomic: true, OldValue: oldValue, } - return a.SetPluginKeyWithOptions(pluginId, key, newValue, options) + return a.SetPluginKeyWithOptions(pluginID, key, newValue, options) } -func (a *App) SetPluginKeyWithOptions(pluginId string, key string, value []byte, options model.PluginKVSetOptions) (bool, *model.AppError) { +func (a *App) SetPluginKeyWithOptions(pluginID string, key string, value []byte, options model.PluginKVSetOptions) (bool, *model.AppError) { if err := options.IsValid(); err != nil { - mlog.Debug("Failed to set plugin key value with options", mlog.String("plugin_id", pluginId), mlog.String("key", key), mlog.Err(err)) + mlog.Debug("Failed to set plugin key value with options", mlog.String("plugin_id", pluginID), mlog.String("key", key), mlog.Err(err)) return false, err } - updated, err := a.Srv().Store.Plugin().SetWithOptions(pluginId, key, value, options) + updated, err := a.Srv().Store.Plugin().SetWithOptions(pluginID, key, value, options) if err != nil { - mlog.Error("Failed to set plugin key value with options", mlog.String("plugin_id", pluginId), mlog.String("key", key), mlog.Err(err)) + mlog.Error("Failed to set plugin key value with options", mlog.String("plugin_id", pluginID), mlog.String("key", key), mlog.Err(err)) var appErr *model.AppError switch { case errors.As(err, &appErr): @@ -59,22 +59,22 @@ func (a *App) SetPluginKeyWithOptions(pluginId string, key string, value []byte, } // Clean up a previous entry using the hashed key, if it exists. - if err := a.Srv().Store.Plugin().Delete(pluginId, getKeyHash(key)); err != nil { - mlog.Warn("Failed to clean up previously hashed plugin key value", mlog.String("plugin_id", pluginId), mlog.String("key", key), mlog.Err(err)) + if err := a.Srv().Store.Plugin().Delete(pluginID, getKeyHash(key)); err != nil { + mlog.Warn("Failed to clean up previously hashed plugin key value", mlog.String("plugin_id", pluginID), mlog.String("key", key), mlog.Err(err)) } return updated, nil } -func (a *App) CompareAndDeletePluginKey(pluginId string, key string, oldValue []byte) (bool, *model.AppError) { +func (a *App) CompareAndDeletePluginKey(pluginID string, key string, oldValue []byte) (bool, *model.AppError) { kv := &model.PluginKeyValue{ - PluginId: pluginId, + PluginId: pluginID, Key: key, } deleted, err := a.Srv().Store.Plugin().CompareAndDelete(kv, oldValue) if err != nil { - mlog.Error("Failed to compare and delete plugin key value", mlog.String("plugin_id", pluginId), mlog.String("key", key), mlog.Err(err)) + mlog.Error("Failed to compare and delete plugin key value", mlog.String("plugin_id", pluginID), mlog.String("key", key), mlog.Err(err)) var appErr *model.AppError switch { case errors.As(err, &appErr): @@ -85,50 +85,50 @@ func (a *App) CompareAndDeletePluginKey(pluginId string, key string, oldValue [] } // Clean up a previous entry using the hashed key, if it exists. - if err := a.Srv().Store.Plugin().Delete(pluginId, getKeyHash(key)); err != nil { - mlog.Warn("Failed to clean up previously hashed plugin key value", mlog.String("plugin_id", pluginId), mlog.String("key", key), mlog.Err(err)) + if err := a.Srv().Store.Plugin().Delete(pluginID, getKeyHash(key)); err != nil { + mlog.Warn("Failed to clean up previously hashed plugin key value", mlog.String("plugin_id", pluginID), mlog.String("key", key), mlog.Err(err)) } return deleted, nil } -func (a *App) GetPluginKey(pluginId string, key string) ([]byte, *model.AppError) { - if kv, err := a.Srv().Store.Plugin().Get(pluginId, key); err == nil { +func (a *App) GetPluginKey(pluginID string, key string) ([]byte, *model.AppError) { + if kv, err := a.Srv().Store.Plugin().Get(pluginID, key); err == nil { return kv.Value, nil } else if nfErr := new(store.ErrNotFound); !errors.As(err, &nfErr) { - mlog.Error("Failed to query plugin key value", mlog.String("plugin_id", pluginId), mlog.String("key", key), mlog.Err(err)) + mlog.Error("Failed to query plugin key value", mlog.String("plugin_id", pluginID), mlog.String("key", key), mlog.Err(err)) return nil, model.NewAppError("GetPluginKey", "app.plugin_store.get.app_error", nil, err.Error(), http.StatusInternalServerError) } // Lookup using the hashed version of the key for keys written prior to v5.6. - if kv, err := a.Srv().Store.Plugin().Get(pluginId, getKeyHash(key)); err == nil { + if kv, err := a.Srv().Store.Plugin().Get(pluginID, getKeyHash(key)); err == nil { return kv.Value, nil } else if nfErr := new(store.ErrNotFound); !errors.As(err, &nfErr) { - mlog.Error("Failed to query plugin key value using hashed key", mlog.String("plugin_id", pluginId), mlog.String("key", key), mlog.Err(err)) + mlog.Error("Failed to query plugin key value using hashed key", mlog.String("plugin_id", pluginID), mlog.String("key", key), mlog.Err(err)) return nil, model.NewAppError("GetPluginKey", "app.plugin_store.get.app_error", nil, err.Error(), http.StatusInternalServerError) } return nil, nil } -func (a *App) DeletePluginKey(pluginId string, key string) *model.AppError { - if err := a.Srv().Store.Plugin().Delete(pluginId, getKeyHash(key)); err != nil { - mlog.Error("Failed to delete plugin key value", mlog.String("plugin_id", pluginId), mlog.String("key", key), mlog.Err(err)) +func (a *App) DeletePluginKey(pluginID string, key string) *model.AppError { + if err := a.Srv().Store.Plugin().Delete(pluginID, getKeyHash(key)); err != nil { + mlog.Error("Failed to delete plugin key value", mlog.String("plugin_id", pluginID), mlog.String("key", key), mlog.Err(err)) return model.NewAppError("DeletePluginKey", "app.plugin_store.delete.app_error", nil, err.Error(), http.StatusInternalServerError) } // Also delete the key without hashing - if err := a.Srv().Store.Plugin().Delete(pluginId, key); err != nil { - mlog.Error("Failed to delete plugin key value using hashed key", mlog.String("plugin_id", pluginId), mlog.String("key", key), mlog.Err(err)) + if err := a.Srv().Store.Plugin().Delete(pluginID, key); err != nil { + mlog.Error("Failed to delete plugin key value using hashed key", mlog.String("plugin_id", pluginID), mlog.String("key", key), mlog.Err(err)) return model.NewAppError("DeletePluginKey", "app.plugin_store.delete.app_error", nil, err.Error(), http.StatusInternalServerError) } return nil } -func (a *App) DeleteAllKeysForPlugin(pluginId string) *model.AppError { - if err := a.Srv().Store.Plugin().DeleteAllForPlugin(pluginId); err != nil { - mlog.Error("Failed to delete all plugin key values", mlog.String("plugin_id", pluginId), mlog.Err(err)) +func (a *App) DeleteAllKeysForPlugin(pluginID string) *model.AppError { + if err := a.Srv().Store.Plugin().DeleteAllForPlugin(pluginID); err != nil { + mlog.Error("Failed to delete all plugin key values", mlog.String("plugin_id", pluginID), mlog.Err(err)) return model.NewAppError("DeleteAllKeysForPlugin", "app.plugin_store.delete.app_error", nil, err.Error(), http.StatusInternalServerError) } @@ -148,8 +148,8 @@ func (a *App) DeleteAllExpiredPluginKeys() *model.AppError { return nil } -func (a *App) ListPluginKeys(pluginId string, page, perPage int) ([]string, *model.AppError) { - data, err := a.Srv().Store.Plugin().List(pluginId, page*perPage, perPage) +func (a *App) ListPluginKeys(pluginID string, page, perPage int) ([]string, *model.AppError) { + data, err := a.Srv().Store.Plugin().List(pluginID, page*perPage, perPage) if err != nil { mlog.Error("Failed to list plugin key values", mlog.Int("page", page), mlog.Int("perPage", perPage), mlog.Err(err)) diff --git a/app/plugin_test.go b/app/plugin_test.go index 16efc644b80..65f7566aba2 100644 --- a/app/plugin_test.go +++ b/app/plugin_test.go @@ -37,38 +37,38 @@ func TestPluginKeyValueStore(t *testing.T) { th := Setup(t) defer th.TearDown() - pluginId := "testpluginid" + pluginID := "testpluginid" defer func() { - assert.Nil(t, th.App.DeletePluginKey(pluginId, "key")) - assert.Nil(t, th.App.DeletePluginKey(pluginId, "key2")) - assert.Nil(t, th.App.DeletePluginKey(pluginId, "key3")) - assert.Nil(t, th.App.DeletePluginKey(pluginId, "key4")) + assert.Nil(t, th.App.DeletePluginKey(pluginID, "key")) + assert.Nil(t, th.App.DeletePluginKey(pluginID, "key2")) + assert.Nil(t, th.App.DeletePluginKey(pluginID, "key3")) + assert.Nil(t, th.App.DeletePluginKey(pluginID, "key4")) }() - assert.Nil(t, th.App.SetPluginKey(pluginId, "key", []byte("test"))) - ret, err := th.App.GetPluginKey(pluginId, "key") + assert.Nil(t, th.App.SetPluginKey(pluginID, "key", []byte("test"))) + ret, err := th.App.GetPluginKey(pluginID, "key") assert.Nil(t, err) assert.Equal(t, []byte("test"), ret) // Test inserting over existing entries - assert.Nil(t, th.App.SetPluginKey(pluginId, "key", []byte("test2"))) - ret, err = th.App.GetPluginKey(pluginId, "key") + assert.Nil(t, th.App.SetPluginKey(pluginID, "key", []byte("test2"))) + ret, err = th.App.GetPluginKey(pluginID, "key") assert.Nil(t, err) assert.Equal(t, []byte("test2"), ret) // Test getting non-existent key - ret, err = th.App.GetPluginKey(pluginId, "notakey") + ret, err = th.App.GetPluginKey(pluginID, "notakey") assert.Nil(t, err) assert.Nil(t, ret) // Test deleting non-existent keys. - assert.Nil(t, th.App.DeletePluginKey(pluginId, "notrealkey")) + assert.Nil(t, th.App.DeletePluginKey(pluginID, "notrealkey")) // Verify behaviour for the old approach that involved storing the hashed keys. hashedKey2 := getHashedKey("key2") kv := &model.PluginKeyValue{ - PluginId: pluginId, + PluginId: pluginID, Key: hashedKey2, Value: []byte("test"), ExpireAt: 0, @@ -78,57 +78,57 @@ func TestPluginKeyValueStore(t *testing.T) { assert.NoError(t, nErr) // Test fetch by keyname (this key does not exist but hashed key will be used for lookup) - ret, err = th.App.GetPluginKey(pluginId, "key2") + ret, err = th.App.GetPluginKey(pluginID, "key2") assert.Nil(t, err) assert.Equal(t, kv.Value, ret) // Test fetch by hashed keyname - ret, err = th.App.GetPluginKey(pluginId, hashedKey2) + ret, err = th.App.GetPluginKey(pluginID, hashedKey2) assert.Nil(t, err) assert.Equal(t, kv.Value, ret) // Test ListKeys - assert.Nil(t, th.App.SetPluginKey(pluginId, "key3", []byte("test3"))) - assert.Nil(t, th.App.SetPluginKey(pluginId, "key4", []byte("test4"))) + assert.Nil(t, th.App.SetPluginKey(pluginID, "key3", []byte("test3"))) + assert.Nil(t, th.App.SetPluginKey(pluginID, "key4", []byte("test4"))) - list, err := th.App.ListPluginKeys(pluginId, 0, 1) + list, err := th.App.ListPluginKeys(pluginID, 0, 1) assert.Nil(t, err) assert.Equal(t, []string{"key"}, list) - list, err = th.App.ListPluginKeys(pluginId, 1, 1) + list, err = th.App.ListPluginKeys(pluginID, 1, 1) assert.Nil(t, err) assert.Equal(t, []string{"key3"}, list) - list, err = th.App.ListPluginKeys(pluginId, 0, 4) + list, err = th.App.ListPluginKeys(pluginID, 0, 4) assert.Nil(t, err) assert.Equal(t, []string{"key", "key3", "key4", hashedKey2}, list) - list, err = th.App.ListPluginKeys(pluginId, 0, 2) + list, err = th.App.ListPluginKeys(pluginID, 0, 2) assert.Nil(t, err) assert.Equal(t, []string{"key", "key3"}, list) - list, err = th.App.ListPluginKeys(pluginId, 1, 2) + list, err = th.App.ListPluginKeys(pluginID, 1, 2) assert.Nil(t, err) assert.Equal(t, []string{"key4", hashedKey2}, list) - list, err = th.App.ListPluginKeys(pluginId, 2, 2) + list, err = th.App.ListPluginKeys(pluginID, 2, 2) assert.Nil(t, err) assert.Equal(t, []string{}, list) // List Keys bad input - list, err = th.App.ListPluginKeys(pluginId, 0, 0) + list, err = th.App.ListPluginKeys(pluginID, 0, 0) assert.Nil(t, err) assert.Equal(t, []string{"key", "key3", "key4", hashedKey2}, list) - list, err = th.App.ListPluginKeys(pluginId, 0, -1) + list, err = th.App.ListPluginKeys(pluginID, 0, -1) assert.Nil(t, err) assert.Equal(t, []string{"key", "key3", "key4", hashedKey2}, list) - list, err = th.App.ListPluginKeys(pluginId, -1, 1) + list, err = th.App.ListPluginKeys(pluginID, -1, 1) assert.Nil(t, err) assert.Equal(t, []string{"key"}, list) - list, err = th.App.ListPluginKeys(pluginId, -1, 0) + list, err = th.App.ListPluginKeys(pluginID, -1, 0) assert.Nil(t, err) assert.Equal(t, []string{"key", "key3", "key4", hashedKey2}, list) } @@ -137,72 +137,72 @@ func TestPluginKeyValueStoreCompareAndSet(t *testing.T) { th := Setup(t) defer th.TearDown() - pluginId := "testpluginid" + pluginID := "testpluginid" defer func() { - assert.Nil(t, th.App.DeletePluginKey(pluginId, "key")) + assert.Nil(t, th.App.DeletePluginKey(pluginID, "key")) }() // Set using Set api for key2 - assert.Nil(t, th.App.SetPluginKey(pluginId, "key2", []byte("test"))) - ret, err := th.App.GetPluginKey(pluginId, "key2") + assert.Nil(t, th.App.SetPluginKey(pluginID, "key2", []byte("test"))) + ret, err := th.App.GetPluginKey(pluginID, "key2") assert.Nil(t, err) assert.Equal(t, []byte("test"), ret) // Attempt to insert value for key2 - updated, err := th.App.CompareAndSetPluginKey(pluginId, "key2", nil, []byte("test2")) + updated, err := th.App.CompareAndSetPluginKey(pluginID, "key2", nil, []byte("test2")) assert.Nil(t, err) assert.False(t, updated) - ret, err = th.App.GetPluginKey(pluginId, "key2") + ret, err = th.App.GetPluginKey(pluginID, "key2") assert.Nil(t, err) assert.Equal(t, []byte("test"), ret) // Insert new value for key - updated, err = th.App.CompareAndSetPluginKey(pluginId, "key", nil, []byte("test")) + updated, err = th.App.CompareAndSetPluginKey(pluginID, "key", nil, []byte("test")) assert.Nil(t, err) assert.True(t, updated) - ret, err = th.App.GetPluginKey(pluginId, "key") + ret, err = th.App.GetPluginKey(pluginID, "key") assert.Nil(t, err) assert.Equal(t, []byte("test"), ret) // Should fail to insert again - updated, err = th.App.CompareAndSetPluginKey(pluginId, "key", nil, []byte("test3")) + updated, err = th.App.CompareAndSetPluginKey(pluginID, "key", nil, []byte("test3")) assert.Nil(t, err) assert.False(t, updated) - ret, err = th.App.GetPluginKey(pluginId, "key") + ret, err = th.App.GetPluginKey(pluginID, "key") assert.Nil(t, err) assert.Equal(t, []byte("test"), ret) // Test updating using incorrect old value - updated, err = th.App.CompareAndSetPluginKey(pluginId, "key", []byte("oldvalue"), []byte("test3")) + updated, err = th.App.CompareAndSetPluginKey(pluginID, "key", []byte("oldvalue"), []byte("test3")) assert.Nil(t, err) assert.False(t, updated) - ret, err = th.App.GetPluginKey(pluginId, "key") + ret, err = th.App.GetPluginKey(pluginID, "key") assert.Nil(t, err) assert.Equal(t, []byte("test"), ret) // Test updating using correct old value - updated, err = th.App.CompareAndSetPluginKey(pluginId, "key", []byte("test"), []byte("test2")) + updated, err = th.App.CompareAndSetPluginKey(pluginID, "key", []byte("test"), []byte("test2")) assert.Nil(t, err) assert.True(t, updated) - ret, err = th.App.GetPluginKey(pluginId, "key") + ret, err = th.App.GetPluginKey(pluginID, "key") assert.Nil(t, err) assert.Equal(t, []byte("test2"), ret) } func TestPluginKeyValueStoreSetWithOptionsJSON(t *testing.T) { - pluginId := "testpluginid" + pluginID := "testpluginid" t.Run("storing a value without providing options works", func(t *testing.T) { th := Setup(t) defer th.TearDown() - result, err := th.App.SetPluginKeyWithOptions(pluginId, "key", []byte("value-1"), model.PluginKVSetOptions{}) + result, err := th.App.SetPluginKeyWithOptions(pluginID, "key", []byte("value-1"), model.PluginKVSetOptions{}) assert.True(t, result) assert.Nil(t, err) // and I can get it back! - ret, err := th.App.GetPluginKey(pluginId, "key") + ret, err := th.App.GetPluginKey(pluginID, "key") assert.Nil(t, err) assert.Equal(t, []byte(`value-1`), ret) }) @@ -211,10 +211,10 @@ func TestPluginKeyValueStoreSetWithOptionsJSON(t *testing.T) { th := Setup(t) defer th.TearDown() - err := th.App.SetPluginKey(pluginId, "key", []byte("value-1")) + err := th.App.SetPluginKey(pluginID, "key", []byte("value-1")) require.Nil(t, err) - result, err := th.App.SetPluginKeyWithOptions(pluginId, "key", []byte("value-3"), model.PluginKVSetOptions{ + result, err := th.App.SetPluginKeyWithOptions(pluginID, "key", []byte("value-3"), model.PluginKVSetOptions{ Atomic: true, OldValue: []byte("value-2"), }) @@ -222,7 +222,7 @@ func TestPluginKeyValueStoreSetWithOptionsJSON(t *testing.T) { assert.Nil(t, err) // test that the value didn't change - ret, err := th.App.GetPluginKey(pluginId, "key") + ret, err := th.App.GetPluginKey(pluginID, "key") assert.Nil(t, err) assert.Equal(t, []byte(`value-1`), ret) }) @@ -231,10 +231,10 @@ func TestPluginKeyValueStoreSetWithOptionsJSON(t *testing.T) { th := Setup(t) defer th.TearDown() - err := th.App.SetPluginKey(pluginId, "key", []byte("value-2")) + err := th.App.SetPluginKey(pluginID, "key", []byte("value-2")) require.Nil(t, err) - result, err := th.App.SetPluginKeyWithOptions(pluginId, "key", []byte("value-3"), model.PluginKVSetOptions{ + result, err := th.App.SetPluginKeyWithOptions(pluginID, "key", []byte("value-3"), model.PluginKVSetOptions{ Atomic: true, OldValue: []byte("value-2"), }) @@ -242,7 +242,7 @@ func TestPluginKeyValueStoreSetWithOptionsJSON(t *testing.T) { assert.Nil(t, err) // test that the value did change - ret, err := th.App.GetPluginKey(pluginId, "key") + ret, err := th.App.GetPluginKey(pluginID, "key") assert.Nil(t, err) assert.Equal(t, []byte(`value-3`), ret) }) @@ -252,19 +252,19 @@ func TestPluginKeyValueStoreSetWithOptionsJSON(t *testing.T) { defer th.TearDown() // first set a value. - result, err := th.App.SetPluginKeyWithOptions(pluginId, "nil-test-key-2", []byte("value-1"), model.PluginKVSetOptions{}) + result, err := th.App.SetPluginKeyWithOptions(pluginID, "nil-test-key-2", []byte("value-1"), model.PluginKVSetOptions{}) require.Nil(t, err) require.True(t, result) // now it should delete the set value. - result, err = th.App.SetPluginKeyWithOptions(pluginId, "nil-test-key-2", nil, model.PluginKVSetOptions{ + result, err = th.App.SetPluginKeyWithOptions(pluginID, "nil-test-key-2", nil, model.PluginKVSetOptions{ Atomic: true, OldValue: []byte("value-1"), }) assert.Nil(t, err) assert.True(t, result) - ret, err := th.App.GetPluginKey(pluginId, "nil-test-key-2") + ret, err := th.App.GetPluginKey(pluginID, "nil-test-key-2") assert.Nil(t, err) assert.Nil(t, ret) }) @@ -274,22 +274,22 @@ func TestPluginKeyValueStoreSetWithOptionsJSON(t *testing.T) { defer th.TearDown() // first set a value. - result, err := th.App.SetPluginKeyWithOptions(pluginId, "nil-test-key-3", []byte("value-1"), model.PluginKVSetOptions{}) + result, err := th.App.SetPluginKeyWithOptions(pluginID, "nil-test-key-3", []byte("value-1"), model.PluginKVSetOptions{}) require.Nil(t, err) require.True(t, result) // now it should delete the set value. - result, err = th.App.SetPluginKeyWithOptions(pluginId, "nil-test-key-3", nil, model.PluginKVSetOptions{}) + result, err = th.App.SetPluginKeyWithOptions(pluginID, "nil-test-key-3", nil, model.PluginKVSetOptions{}) assert.Nil(t, err) assert.True(t, result) // verify a nil value is returned - ret, err := th.App.GetPluginKey(pluginId, "nil-test-key-3") + ret, err := th.App.GetPluginKey(pluginID, "nil-test-key-3") assert.Nil(t, err) assert.Nil(t, ret) // verify the row is actually gone - list, err := th.App.ListPluginKeys(pluginId, 0, 1) + list, err := th.App.ListPluginKeys(pluginID, 0, 1) assert.Nil(t, err) assert.Empty(t, list) }) @@ -298,14 +298,14 @@ func TestPluginKeyValueStoreSetWithOptionsJSON(t *testing.T) { th := Setup(t) defer th.TearDown() - result, err := th.App.SetPluginKeyWithOptions(pluginId, "nil-test-key-4", []byte("value-1"), model.PluginKVSetOptions{ + result, err := th.App.SetPluginKeyWithOptions(pluginID, "nil-test-key-4", []byte("value-1"), model.PluginKVSetOptions{ Atomic: true, OldValue: nil, }) assert.Nil(t, err) assert.True(t, result) - ret, err := th.App.GetPluginKey(pluginId, "nil-test-key-4") + ret, err := th.App.GetPluginKey(pluginID, "nil-test-key-4") assert.Nil(t, err) assert.Equal(t, []byte("value-1"), ret) }) @@ -314,21 +314,21 @@ func TestPluginKeyValueStoreSetWithOptionsJSON(t *testing.T) { th := Setup(t) defer th.TearDown() - result, err := th.App.SetPluginKeyWithOptions(pluginId, "key", []byte("value-1"), model.PluginKVSetOptions{ + result, err := th.App.SetPluginKeyWithOptions(pluginID, "key", []byte("value-1"), model.PluginKVSetOptions{ ExpireInSeconds: 1, }) assert.True(t, result) assert.Nil(t, err) // test that the value is set - ret, err := th.App.GetPluginKey(pluginId, "key") + ret, err := th.App.GetPluginKey(pluginID, "key") assert.Nil(t, err) assert.Equal(t, []byte(`value-1`), ret) // test that the value is not longer time.Sleep(1500 * time.Millisecond) - ret, err = th.App.GetPluginKey(pluginId, "key") + ret, err = th.App.GetPluginKey(pluginID, "key") assert.Nil(t, err) assert.Nil(t, ret) }) diff --git a/app/post.go b/app/post.go index 65be0aeac80..a3aeb3afa59 100644 --- a/app/post.go +++ b/app/post.go @@ -126,8 +126,8 @@ func (a *App) deduplicateCreatePost(post *model.Post) (foundPost *model.Post, er // Query the cache atomically for the given pending post id, saving a record if // it hasn't previously been seen. - var postId string - nErr := a.Srv().seenPendingPostIdsCache.Get(post.PendingPostId, &postId) + var postID string + nErr := a.Srv().seenPendingPostIdsCache.Get(post.PendingPostId, &postID) if nErr == cache.ErrKeyNotFound { a.Srv().seenPendingPostIdsCache.SetWithExpiry(post.PendingPostId, unknownPostId, PendingPostIDsCacheTTL) return nil, nil @@ -140,13 +140,13 @@ func (a *App) deduplicateCreatePost(post *model.Post) (foundPost *model.Post, er // If another thread saved the cache record, but hasn't yet updated it with the actual post // id (because it's still saving), notify the client with an error. Ideally, we'd wait // for the other thread, but coordinating that adds complexity to the happy path. - if postId == unknownPostId { + if postID == unknownPostId { return nil, model.NewAppError("deduplicateCreatePost", "api.post.deduplicate_create_post.pending", nil, "", http.StatusInternalServerError) } // If the other thread finished creating the post, return the created post back to the // client, making the API call feel idempotent. - actualPost, err := a.GetSinglePost(postId) + actualPost, err := a.GetSinglePost(postID) if err != nil { return nil, model.NewAppError("deduplicateCreatePost", "api.post.deduplicate_create_post.failed_to_get", nil, err.Error(), http.StatusInternalServerError) } @@ -365,14 +365,14 @@ func (a *App) CreatePost(post *model.Post, channel *model.Channel, triggerWebhoo func (a *App) attachFilesToPost(post *model.Post) *model.AppError { var attachedIds []string - for _, fileId := range post.FileIds { - err := a.Srv().Store.FileInfo().AttachToPost(fileId, post.Id, post.UserId) + for _, fileID := range post.FileIds { + err := a.Srv().Store.FileInfo().AttachToPost(fileID, post.Id, post.UserId) if err != nil { - mlog.Warn("Failed to attach file to post", mlog.String("file_id", fileId), mlog.String("post_id", post.Id), mlog.Err(err)) + mlog.Warn("Failed to attach file to post", mlog.String("file_id", fileID), mlog.String("post_id", post.Id), mlog.Err(err)) continue } - attachedIds = append(attachedIds, fileId) + attachedIds = append(attachedIds, fileID) } if len(post.FileIds) != len(attachedIds) { @@ -526,9 +526,9 @@ func (a *App) UpdateEphemeralPost(userID string, post *model.Post) *model.Post { return post } -func (a *App) DeleteEphemeralPost(userID, postId string) { +func (a *App) DeleteEphemeralPost(userID, postID string) { post := &model.Post{ - Id: postId, + Id: postID, UserId: userID, Type: model.POST_EPHEMERAL, DeleteAt: model.GetMillis(), @@ -659,8 +659,8 @@ func (a *App) UpdatePost(post *model.Post, safeUpdate bool) (*model.Post, *model return rpost, nil } -func (a *App) PatchPost(postId string, patch *model.PostPatch) (*model.Post, *model.AppError) { - post, err := a.GetSinglePost(postId) +func (a *App) PatchPost(postID string, patch *model.PostPatch) (*model.Post, *model.AppError) { + post, err := a.GetSinglePost(postID) if err != nil { return nil, err } @@ -704,8 +704,8 @@ func (a *App) GetPostsPage(options model.GetPostsOptions) (*model.PostList, *mod return postList, nil } -func (a *App) GetPosts(channelId string, offset int, limit int) (*model.PostList, *model.AppError) { - postList, err := a.Srv().Store.Post().GetPosts(model.GetPostsOptions{ChannelId: channelId, Page: offset, PerPage: limit}, true) +func (a *App) GetPosts(channelID string, offset int, limit int) (*model.PostList, *model.AppError) { + postList, err := a.Srv().Store.Post().GetPosts(model.GetPostsOptions{ChannelId: channelID, Page: offset, PerPage: limit}, true) if err != nil { var invErr *store.ErrInvalidInput switch { @@ -719,8 +719,8 @@ func (a *App) GetPosts(channelId string, offset int, limit int) (*model.PostList return postList, nil } -func (a *App) GetPostsEtag(channelId string, collapsedThreads bool) string { - return a.Srv().Store.Post().GetEtag(channelId, true, collapsedThreads) +func (a *App) GetPostsEtag(channelID string, collapsedThreads bool) string { + return a.Srv().Store.Post().GetEtag(channelID, true, collapsedThreads) } func (a *App) GetPostsSince(options model.GetPostsSinceOptions) (*model.PostList, *model.AppError) { @@ -732,8 +732,8 @@ func (a *App) GetPostsSince(options model.GetPostsSinceOptions) (*model.PostList return postList, nil } -func (a *App) GetSinglePost(postId string) (*model.Post, *model.AppError) { - post, err := a.Srv().Store.Post().GetSingle(postId) +func (a *App) GetSinglePost(postID string) (*model.Post, *model.AppError) { + post, err := a.Srv().Store.Post().GetSingle(postID) if err != nil { var nfErr *store.ErrNotFound switch { @@ -747,8 +747,8 @@ func (a *App) GetSinglePost(postId string) (*model.Post, *model.AppError) { return post, nil } -func (a *App) GetPostThread(postId string, skipFetchThreads, collapsedThreads, collapsedThreadsExtended bool) (*model.PostList, *model.AppError) { - posts, err := a.Srv().Store.Post().Get(postId, skipFetchThreads, collapsedThreads, collapsedThreadsExtended) +func (a *App) GetPostThread(postID string, skipFetchThreads, collapsedThreads, collapsedThreadsExtended bool) (*model.PostList, *model.AppError) { + posts, err := a.Srv().Store.Post().Get(postID, skipFetchThreads, collapsedThreads, collapsedThreadsExtended) if err != nil { var nfErr *store.ErrNotFound var invErr *store.ErrInvalidInput @@ -783,8 +783,8 @@ func (a *App) GetFlaggedPostsForTeam(userID, teamID string, offset int, limit in return postList, nil } -func (a *App) GetFlaggedPostsForChannel(userID, channelId string, offset int, limit int) (*model.PostList, *model.AppError) { - postList, err := a.Srv().Store.Post().GetFlaggedPostsForChannel(userID, channelId, offset, limit) +func (a *App) GetFlaggedPostsForChannel(userID, channelID string, offset int, limit int) (*model.PostList, *model.AppError) { + postList, err := a.Srv().Store.Post().GetFlaggedPostsForChannel(userID, channelID, offset, limit) if err != nil { return nil, model.NewAppError("GetFlaggedPostsForChannel", "app.post.get_flagged_posts.app_error", nil, err.Error(), http.StatusInternalServerError) } @@ -792,8 +792,8 @@ func (a *App) GetFlaggedPostsForChannel(userID, channelId string, offset int, li return postList, nil } -func (a *App) GetPermalinkPost(postId string, userID string) (*model.PostList, *model.AppError) { - list, nErr := a.Srv().Store.Post().Get(postId, false, false, false) +func (a *App) GetPermalinkPost(postID string, userID string) (*model.PostList, *model.AppError) { + list, nErr := a.Srv().Store.Post().Get(postID, false, false, false) if nErr != nil { var nfErr *store.ErrNotFound var invErr *store.ErrInvalidInput @@ -876,8 +876,8 @@ func (a *App) GetPostsAroundPost(before bool, options model.GetPostsOptions) (*m return postList, nil } -func (a *App) GetPostAfterTime(channelId string, time int64) (*model.Post, *model.AppError) { - post, err := a.Srv().Store.Post().GetPostAfterTime(channelId, time) +func (a *App) GetPostAfterTime(channelID string, time int64) (*model.Post, *model.AppError) { + post, err := a.Srv().Store.Post().GetPostAfterTime(channelID, time) if err != nil { return nil, model.NewAppError("GetPostAfterTime", "app.post.get_post_after_time.app_error", nil, err.Error(), http.StatusInternalServerError) } @@ -885,22 +885,22 @@ func (a *App) GetPostAfterTime(channelId string, time int64) (*model.Post, *mode return post, nil } -func (a *App) GetPostIdAfterTime(channelId string, time int64) (string, *model.AppError) { - postId, err := a.Srv().Store.Post().GetPostIdAfterTime(channelId, time) +func (a *App) GetPostIdAfterTime(channelID string, time int64) (string, *model.AppError) { + postID, err := a.Srv().Store.Post().GetPostIdAfterTime(channelID, time) if err != nil { return "", model.NewAppError("GetPostIdAfterTime", "app.post.get_post_id_around.app_error", nil, err.Error(), http.StatusInternalServerError) } - return postId, nil + return postID, nil } -func (a *App) GetPostIdBeforeTime(channelId string, time int64) (string, *model.AppError) { - postId, err := a.Srv().Store.Post().GetPostIdBeforeTime(channelId, time) +func (a *App) GetPostIdBeforeTime(channelID string, time int64) (string, *model.AppError) { + postID, err := a.Srv().Store.Post().GetPostIdBeforeTime(channelID, time) if err != nil { return "", model.NewAppError("GetPostIdBeforeTime", "app.post.get_post_id_around.app_error", nil, err.Error(), http.StatusInternalServerError) } - return postId, nil + return postID, nil } func (a *App) GetNextPostIdFromPostList(postList *model.PostList) string { @@ -976,16 +976,16 @@ func (a *App) AddCursorIdsForPostList(originalList *model.PostList, afterPost, b originalList.NextPostId = nextPostId originalList.PrevPostId = prevPostId } -func (a *App) GetPostsForChannelAroundLastUnread(channelId, userID string, limitBefore, limitAfter int, skipFetchThreads bool, collapsedThreads, collapsedThreadsExtended bool) (*model.PostList, *model.AppError) { +func (a *App) GetPostsForChannelAroundLastUnread(channelID, userID string, limitBefore, limitAfter int, skipFetchThreads bool, collapsedThreads, collapsedThreadsExtended bool) (*model.PostList, *model.AppError) { var member *model.ChannelMember var err *model.AppError - if member, err = a.GetChannelMember(channelId, userID); err != nil { + if member, err = a.GetChannelMember(channelID, userID); err != nil { return nil, err } else if member.LastViewedAt == 0 { return model.NewPostList(), nil } - lastUnreadPostId, err := a.GetPostIdAfterTime(channelId, member.LastViewedAt) + lastUnreadPostId, err := a.GetPostIdAfterTime(channelID, member.LastViewedAt) if err != nil { return nil, err } else if lastUnreadPostId == "" { @@ -1000,13 +1000,13 @@ func (a *App) GetPostsForChannelAroundLastUnread(channelId, userID string, limit // channel organically, those replies will be added below. postList.Order = []string{lastUnreadPostId} - if postListBefore, err := a.GetPostsBeforePost(model.GetPostsOptions{ChannelId: channelId, PostId: lastUnreadPostId, Page: PageDefault, PerPage: limitBefore, SkipFetchThreads: skipFetchThreads, CollapsedThreads: collapsedThreads, CollapsedThreadsExtended: collapsedThreadsExtended}); err != nil { + if postListBefore, err := a.GetPostsBeforePost(model.GetPostsOptions{ChannelId: channelID, PostId: lastUnreadPostId, Page: PageDefault, PerPage: limitBefore, SkipFetchThreads: skipFetchThreads, CollapsedThreads: collapsedThreads, CollapsedThreadsExtended: collapsedThreadsExtended}); err != nil { return nil, err } else if postListBefore != nil { postList.Extend(postListBefore) } - if postListAfter, err := a.GetPostsAfterPost(model.GetPostsOptions{ChannelId: channelId, PostId: lastUnreadPostId, Page: PageDefault, PerPage: limitAfter - 1, SkipFetchThreads: skipFetchThreads, CollapsedThreads: collapsedThreads, CollapsedThreadsExtended: collapsedThreadsExtended}); err != nil { + if postListAfter, err := a.GetPostsAfterPost(model.GetPostsOptions{ChannelId: channelID, PostId: lastUnreadPostId, Page: PageDefault, PerPage: limitAfter - 1, SkipFetchThreads: skipFetchThreads, CollapsedThreads: collapsedThreads, CollapsedThreadsExtended: collapsedThreadsExtended}); err != nil { return nil, err } else if postListAfter != nil { postList.Extend(postListAfter) @@ -1016,8 +1016,8 @@ func (a *App) GetPostsForChannelAroundLastUnread(channelId, userID string, limit return postList, nil } -func (a *App) DeletePost(postId, deleteByID string) (*model.Post, *model.AppError) { - post, nErr := a.Srv().Store.Post().GetSingle(postId) +func (a *App) DeletePost(postID, deleteByID string) (*model.Post, *model.AppError) { + post, nErr := a.Srv().Store.Post().GetSingle(postID) if nErr != nil { return nil, model.NewAppError("DeletePost", "app.post.get.app_error", nil, nErr.Error(), http.StatusBadRequest) } @@ -1032,7 +1032,7 @@ func (a *App) DeletePost(postId, deleteByID string) (*model.Post, *model.AppErro return nil, err } - if err := a.Srv().Store.Post().Delete(postId, model.GetMillis(), deleteByID); err != nil { + if err := a.Srv().Store.Post().Delete(postID, model.GetMillis(), deleteByID); err != nil { var nfErr *store.ErrNotFound switch { case errors.As(err, &nfErr): @@ -1067,8 +1067,8 @@ func (a *App) DeletePost(postId, deleteByID string) (*model.Post, *model.AppErro return post, nil } -func (a *App) DeleteFlaggedPosts(postId string) { - if err := a.Srv().Store.Preference().DeleteCategoryAndName(model.PREFERENCE_CATEGORY_FLAGGED_POST, postId); err != nil { +func (a *App) DeleteFlaggedPosts(postID string) { + if err := a.Srv().Store.Preference().DeleteCategoryAndName(model.PREFERENCE_CATEGORY_FLAGGED_POST, postID); err != nil { mlog.Warn("Unable to delete flagged post preference when deleting post.", mlog.Err(err)) return } @@ -1238,16 +1238,16 @@ func (a *App) SearchPostsInTeamForUser(terms string, userID string, teamID strin return postSearchResults, nil } -func (a *App) GetFileInfosForPostWithMigration(postId string) ([]*model.FileInfo, *model.AppError) { +func (a *App) GetFileInfosForPostWithMigration(postID string) ([]*model.FileInfo, *model.AppError) { pchan := make(chan store.StoreResult, 1) go func() { - post, err := a.Srv().Store.Post().GetSingle(postId) + post, err := a.Srv().Store.Post().GetSingle(postID) pchan <- store.StoreResult{Data: post, NErr: err} close(pchan) }() - infos, err := a.GetFileInfosForPost(postId, false) + infos, err := a.GetFileInfosForPost(postID, false) if err != nil { return nil, err } @@ -1267,8 +1267,8 @@ func (a *App) GetFileInfosForPostWithMigration(postId string) ([]*model.FileInfo post := result.Data.(*model.Post) if len(post.Filenames) > 0 { - a.Srv().Store.FileInfo().InvalidateFileInfosForPostCache(postId, false) - a.Srv().Store.FileInfo().InvalidateFileInfosForPostCache(postId, true) + a.Srv().Store.FileInfo().InvalidateFileInfosForPostCache(postID, false) + a.Srv().Store.FileInfo().InvalidateFileInfosForPostCache(postID, true) // The post has Filenames that need to be replaced with FileInfos infos = a.MigrateFilenamesToFileInfos(post) } @@ -1277,8 +1277,8 @@ func (a *App) GetFileInfosForPostWithMigration(postId string) ([]*model.FileInfo return infos, nil } -func (a *App) GetFileInfosForPost(postId string, fromMaster bool) ([]*model.FileInfo, *model.AppError) { - fileInfos, err := a.Srv().Store.FileInfo().GetForPost(postId, fromMaster, false, true) +func (a *App) GetFileInfosForPost(postID string, fromMaster bool) ([]*model.FileInfo, *model.AppError) { + fileInfos, err := a.Srv().Store.FileInfo().GetForPost(postID, fromMaster, false, true) if err != nil { return nil, model.NewAppError("GetFileInfosForPost", "app.file_info.get_for_post.app_error", nil, err.Error(), http.StatusInternalServerError) } @@ -1464,8 +1464,8 @@ func (a *App) countMentionsFromPost(user *model.User, post *model.Post) (int, *m return 0, err } - for _, postId := range postList.Order { - if isPostMention(user, postList.Posts[postId], keywords, postList.Posts, mentionedByThread, checkForCommentMentions) { + for _, postID := range postList.Order { + if isPostMention(user, postList.Posts[postID], keywords, postList.Posts, mentionedByThread, checkForCommentMentions) { count += 1 } } diff --git a/app/post_test.go b/app/post_test.go index 6e5081a65ea..4c1f1b1c2e6 100644 --- a/app/post_test.go +++ b/app/post_test.go @@ -625,12 +625,12 @@ func TestDeletePostWithFileAttachments(t *testing.T) { // Create a post with a file attachment. teamID := th.BasicTeam.Id - channelId := th.BasicChannel.Id + channelID := th.BasicChannel.Id userID := th.BasicUser.Id filename := "test" data := []byte("abcd") - info1, err := th.App.DoUploadFile(time.Date(2007, 2, 4, 1, 2, 3, 4, time.Local), teamID, channelId, userID, filename, data) + info1, err := th.App.DoUploadFile(time.Date(2007, 2, 4, 1, 2, 3, 4, time.Local), teamID, channelID, userID, filename, data) require.Nil(t, err) defer func() { th.App.Srv().Store.FileInfo().PermanentDelete(info1.Id) @@ -639,7 +639,7 @@ func TestDeletePostWithFileAttachments(t *testing.T) { post := &model.Post{ Message: "asd", - ChannelId: channelId, + ChannelId: channelID, PendingPostId: model.NewId() + ":" + fmt.Sprint(model.GetMillis()), UserId: userID, CreateAt: 0, diff --git a/app/reaction.go b/app/reaction.go index e5909b04f50..2d0395ddf37 100644 --- a/app/reaction.go +++ b/app/reaction.go @@ -69,18 +69,18 @@ func (a *App) SaveReactionForPost(reaction *model.Reaction) (*model.Reaction, *m return reaction, nil } -func (a *App) GetReactionsForPost(postId string) ([]*model.Reaction, *model.AppError) { - reactions, err := a.Srv().Store.Reaction().GetForPost(postId, true) +func (a *App) GetReactionsForPost(postID string) ([]*model.Reaction, *model.AppError) { + reactions, err := a.Srv().Store.Reaction().GetForPost(postID, true) if err != nil { return nil, model.NewAppError("GetReactionsForPost", "app.reaction.get_for_post.app_error", nil, err.Error(), http.StatusInternalServerError) } return reactions, nil } -func (a *App) GetBulkReactionsForPosts(postIds []string) (map[string][]*model.Reaction, *model.AppError) { +func (a *App) GetBulkReactionsForPosts(postIDs []string) (map[string][]*model.Reaction, *model.AppError) { reactions := make(map[string][]*model.Reaction) - allReactions, err := a.Srv().Store.Reaction().BulkGetForPosts(postIds) + allReactions, err := a.Srv().Store.Reaction().BulkGetForPosts(postIDs) if err != nil { return nil, model.NewAppError("GetBulkReactionsForPosts", "app.reaction.bulk_get_for_post_ids.app_error", nil, err.Error(), http.StatusInternalServerError) } @@ -92,14 +92,14 @@ func (a *App) GetBulkReactionsForPosts(postIds []string) (map[string][]*model.Re reactions[reaction.PostId] = reactionsForPost } - reactions = populateEmptyReactions(postIds, reactions) + reactions = populateEmptyReactions(postIDs, reactions) return reactions, nil } -func populateEmptyReactions(postIds []string, reactions map[string][]*model.Reaction) map[string][]*model.Reaction { - for _, postId := range postIds { - if _, present := reactions[postId]; !present { - reactions[postId] = []*model.Reaction{} +func populateEmptyReactions(postIDs []string, reactions map[string][]*model.Reaction) map[string][]*model.Reaction { + for _, postID := range postIDs { + if _, present := reactions[postID]; !present { + reactions[postID] = []*model.Reaction{} } } return reactions diff --git a/app/session.go b/app/session.go index 9fb94901fe4..717b2588d74 100644 --- a/app/session.go +++ b/app/session.go @@ -269,16 +269,16 @@ func (a *App) SessionCacheLength() int { return 0 } -func (a *App) RevokeSessionsForDeviceId(userID string, deviceId string, currentSessionId string) *model.AppError { +func (a *App) RevokeSessionsForDeviceId(userID string, deviceID string, currentSessionId string) *model.AppError { sessions, err := a.Srv().Store.Session().GetSessions(userID) if err != nil { return model.NewAppError("RevokeSessionsForDeviceId", "app.session.get_sessions.app_error", nil, err.Error(), http.StatusInternalServerError) } for _, session := range sessions { - if session.DeviceId == deviceId && session.Id != currentSessionId { + if session.DeviceId == deviceID && session.Id != currentSessionId { mlog.Debug("Revoking sessionId for userId. Re-login with the same device Id", mlog.String("session_id", session.Id), mlog.String("user_id", userID)) if err := a.RevokeSession(session); err != nil { - mlog.Warn("Could not revoke session for device", mlog.String("device_id", deviceId), mlog.Err(err)) + mlog.Warn("Could not revoke session for device", mlog.String("device_id", deviceID), mlog.Err(err)) } } } @@ -286,8 +286,8 @@ func (a *App) RevokeSessionsForDeviceId(userID string, deviceId string, currentS return nil } -func (a *App) GetSessionById(sessionId string) (*model.Session, *model.AppError) { - session, err := a.Srv().Store.Session().Get(sessionId) +func (a *App) GetSessionById(sessionID string) (*model.Session, *model.AppError) { + session, err := a.Srv().Store.Session().Get(sessionID) if err != nil { return nil, model.NewAppError("GetSessionById", "app.session.get.app_error", nil, err.Error(), http.StatusBadRequest) } @@ -295,8 +295,8 @@ func (a *App) GetSessionById(sessionId string) (*model.Session, *model.AppError) return session, nil } -func (a *App) RevokeSessionById(sessionId string) *model.AppError { - session, err := a.Srv().Store.Session().Get(sessionId) +func (a *App) RevokeSessionById(sessionID string) *model.AppError { + session, err := a.Srv().Store.Session().Get(sessionID) if err != nil { return model.NewAppError("RevokeSessionById", "app.session.get.app_error", nil, err.Error(), http.StatusBadRequest) } @@ -320,8 +320,8 @@ func (a *App) RevokeSession(session *model.Session) *model.AppError { return nil } -func (a *App) AttachDeviceId(sessionId string, deviceId string, expiresAt int64) *model.AppError { - _, err := a.Srv().Store.Session().UpdateDeviceId(sessionId, deviceId, expiresAt) +func (a *App) AttachDeviceId(sessionID string, deviceID string, expiresAt int64) *model.AppError { + _, err := a.Srv().Store.Session().UpdateDeviceId(sessionID, deviceID, expiresAt) if err != nil { return model.NewAppError("AttachDeviceId", "app.session.update_device_id.app_error", nil, err.Error(), http.StatusInternalServerError) } diff --git a/app/slashcommands/auto_posts.go b/app/slashcommands/auto_posts.go index aa09c18cdee..dc78f2134cc 100644 --- a/app/slashcommands/auto_posts.go +++ b/app/slashcommands/auto_posts.go @@ -73,10 +73,10 @@ func (cfg *AutoPostCreator) CreateRandomPost() (*model.Post, error) { } func (cfg *AutoPostCreator) CreateRandomPostNested(parentId, rootId string) (*model.Post, error) { - var fileIds []string + var fileIDs []string if cfg.HasImage { var err error - fileIds, err = cfg.UploadTestFile() + fileIDs, err = cfg.UploadTestFile() if err != nil { return nil, err } @@ -95,7 +95,7 @@ func (cfg *AutoPostCreator) CreateRandomPostNested(parentId, rootId string) (*mo ParentId: parentId, RootId: rootId, Message: postText, - FileIds: fileIds, + FileIds: fileIDs, } rpost, err := cfg.a.CreatePostMissingChannel(post, true) if err != nil { diff --git a/app/user.go b/app/user.go index baae1f60d45..94cc5cd3766 100644 --- a/app/user.go +++ b/app/user.go @@ -274,7 +274,7 @@ func (a *App) createUserOrGuest(user *model.User, guest bool) (*model.User, *mod if appErr != nil { return nil, appErr } - // This message goes to everyone, so the teamID, channelId and userID are irrelevant + // This message goes to everyone, so the teamID, channelID and userID are irrelevant message := model.NewWebSocketEvent(model.WEBSOCKET_EVENT_NEW_USER, "", "", "", nil) message.Add("user_id", ruser.Id) a.Publish(message) @@ -609,8 +609,8 @@ func (a *App) GetUsersInChannelPageByStatus(options *model.UserGetOptions, asAdm return a.sanitizeProfiles(users, asAdmin), nil } -func (a *App) GetUsersNotInChannel(teamID string, channelId string, groupConstrained bool, offset int, limit int, viewRestrictions *model.ViewUsersRestrictions) ([]*model.User, *model.AppError) { - users, err := a.Srv().Store.User().GetProfilesNotInChannel(teamID, channelId, groupConstrained, offset, limit, viewRestrictions) +func (a *App) GetUsersNotInChannel(teamID string, channelID string, groupConstrained bool, offset int, limit int, viewRestrictions *model.ViewUsersRestrictions) ([]*model.User, *model.AppError) { + users, err := a.Srv().Store.User().GetProfilesNotInChannel(teamID, channelID, groupConstrained, offset, limit, viewRestrictions) if err != nil { return nil, model.NewAppError("GetUsersNotInChannel", "app.user.get_profiles.app_error", nil, err.Error(), http.StatusInternalServerError) } @@ -618,8 +618,8 @@ func (a *App) GetUsersNotInChannel(teamID string, channelId string, groupConstra return users, nil } -func (a *App) GetUsersNotInChannelMap(teamID string, channelId string, groupConstrained bool, offset int, limit int, asAdmin bool, viewRestrictions *model.ViewUsersRestrictions) (map[string]*model.User, *model.AppError) { - users, err := a.GetUsersNotInChannel(teamID, channelId, groupConstrained, offset, limit, viewRestrictions) +func (a *App) GetUsersNotInChannelMap(teamID string, channelID string, groupConstrained bool, offset int, limit int, asAdmin bool, viewRestrictions *model.ViewUsersRestrictions) (map[string]*model.User, *model.AppError) { + users, err := a.GetUsersNotInChannel(teamID, channelID, groupConstrained, offset, limit, viewRestrictions) if err != nil { return nil, err } @@ -634,8 +634,8 @@ func (a *App) GetUsersNotInChannelMap(teamID string, channelId string, groupCons return userMap, nil } -func (a *App) GetUsersNotInChannelPage(teamID string, channelId string, groupConstrained bool, page int, perPage int, asAdmin bool, viewRestrictions *model.ViewUsersRestrictions) ([]*model.User, *model.AppError) { - users, err := a.GetUsersNotInChannel(teamID, channelId, groupConstrained, page*perPage, perPage, viewRestrictions) +func (a *App) GetUsersNotInChannelPage(teamID string, channelID string, groupConstrained bool, page int, perPage int, asAdmin bool, viewRestrictions *model.ViewUsersRestrictions) ([]*model.User, *model.AppError) { + users, err := a.GetUsersNotInChannel(teamID, channelID, groupConstrained, page*perPage, perPage, viewRestrictions) if err != nil { return nil, err } @@ -692,13 +692,13 @@ func (a *App) GetUsersByIds(userIDs []string, options *store.UserGetByIdsOpts) ( return a.sanitizeProfiles(users, options.IsAdmin), nil } -func (a *App) GetUsersByGroupChannelIds(channelIds []string, asAdmin bool) (map[string][]*model.User, *model.AppError) { - usersByChannelId, err := a.Srv().Store.User().GetProfileByGroupChannelIdsForUser(a.Session().UserId, channelIds) +func (a *App) GetUsersByGroupChannelIds(channelIDs []string, asAdmin bool) (map[string][]*model.User, *model.AppError) { + usersByChannelId, err := a.Srv().Store.User().GetProfileByGroupChannelIdsForUser(a.Session().UserId, channelIDs) if err != nil { return nil, model.NewAppError("GetUsersByGroupChannelIds", "app.user.get_profile_by_group_channel_ids_for_user.app_error", nil, err.Error(), http.StatusInternalServerError) } - for channelId, userList := range usersByChannelId { - usersByChannelId[channelId] = a.sanitizeProfiles(userList, asAdmin) + for channelID, userList := range usersByChannelId { + usersByChannelId[channelID] = a.sanitizeProfiles(userList, asAdmin) } return usersByChannelId, nil @@ -1863,9 +1863,9 @@ func (a *App) SearchUsers(props *model.UserSearch, options *model.UserSearchOpti return a.SearchUsersInTeam(props.TeamId, props.Term, options) } -func (a *App) SearchUsersInChannel(channelId string, term string, options *model.UserSearchOptions) ([]*model.User, *model.AppError) { +func (a *App) SearchUsersInChannel(channelID string, term string, options *model.UserSearchOptions) ([]*model.User, *model.AppError) { term = strings.TrimSpace(term) - users, err := a.Srv().Store.User().SearchInChannel(channelId, term, options) + users, err := a.Srv().Store.User().SearchInChannel(channelID, term, options) if err != nil { return nil, model.NewAppError("SearchUsersInChannel", "app.user.search.app_error", nil, err.Error(), http.StatusInternalServerError) } @@ -1876,9 +1876,9 @@ func (a *App) SearchUsersInChannel(channelId string, term string, options *model return users, nil } -func (a *App) SearchUsersNotInChannel(teamID string, channelId string, term string, options *model.UserSearchOptions) ([]*model.User, *model.AppError) { +func (a *App) SearchUsersNotInChannel(teamID string, channelID string, term string, options *model.UserSearchOptions) ([]*model.User, *model.AppError) { term = strings.TrimSpace(term) - users, err := a.Srv().Store.User().SearchNotInChannel(teamID, channelId, term, options) + users, err := a.Srv().Store.User().SearchNotInChannel(teamID, channelID, term, options) if err != nil { return nil, model.NewAppError("SearchUsersNotInChannel", "app.user.search.app_error", nil, err.Error(), http.StatusInternalServerError) } @@ -1947,10 +1947,10 @@ func (a *App) SearchUsersInGroup(groupID string, term string, options *model.Use return users, nil } -func (a *App) AutocompleteUsersInChannel(teamID string, channelId string, term string, options *model.UserSearchOptions) (*model.UserAutocompleteInChannel, *model.AppError) { +func (a *App) AutocompleteUsersInChannel(teamID string, channelID string, term string, options *model.UserSearchOptions) (*model.UserAutocompleteInChannel, *model.AppError) { term = strings.TrimSpace(term) - autocomplete, err := a.Srv().Store.User().AutocompleteUsersInChannel(teamID, channelId, term, options) + autocomplete, err := a.Srv().Store.User().AutocompleteUsersInChannel(teamID, channelID, term, options) if err != nil { return nil, model.NewAppError("AutocompleteUsersInChannel", "app.user.search.app_error", nil, err.Error(), http.StatusInternalServerError) } @@ -2142,8 +2142,8 @@ func (a *App) UserCanSeeOtherUser(userID string, otherUserId string) (bool, *mod return false, nil } -func (a *App) userBelongsToChannels(userID string, channelIds []string) (bool, *model.AppError) { - belongs, err := a.Srv().Store.Channel().UserBelongsToChannels(userID, channelIds) +func (a *App) userBelongsToChannels(userID string, channelIDs []string) (bool, *model.AppError) { + belongs, err := a.Srv().Store.Channel().UserBelongsToChannels(userID, channelIDs) if err != nil { return false, model.NewAppError("userBelongsToChannels", "app.channel.user_belongs_to_channels.app_error", nil, err.Error(), http.StatusInternalServerError) } @@ -2173,12 +2173,12 @@ func (a *App) GetViewUsersRestrictions(userID string) (*model.ViewUsersRestricti return nil, model.NewAppError("GetViewUsersRestrictions", "app.channel.get_channels.get.app_error", nil, err.Error(), http.StatusInternalServerError) } - channelIds := []string{} - for channelId := range userChannelMembers { - channelIds = append(channelIds, channelId) + channelIDs := []string{} + for channelID := range userChannelMembers { + channelIDs = append(channelIDs, channelID) } - return &model.ViewUsersRestrictions{Teams: teamIDsWithPermission, Channels: channelIds}, nil + return &model.ViewUsersRestrictions{Teams: teamIDsWithPermission, Channels: channelIDs}, nil } // PromoteGuestToUser Convert user's roles and all his mermbership's roles from @@ -2274,11 +2274,11 @@ func (a *App) DemoteUserToGuest(user *model.User) *model.AppError { return nil } -func (a *App) PublishUserTyping(userID, channelId, parentId string) *model.AppError { +func (a *App) PublishUserTyping(userID, channelID, parentId string) *model.AppError { omitUsers := make(map[string]bool, 1) omitUsers[userID] = true - event := model.NewWebSocketEvent(model.WEBSOCKET_EVENT_TYPING, "", channelId, "", omitUsers) + event := model.NewWebSocketEvent(model.WEBSOCKET_EVENT_TYPING, "", channelID, "", omitUsers) event.Add("parent_id", parentId) event.Add("user_id", userID) a.Publish(event) diff --git a/app/web_hub.go b/app/web_hub.go index a6491ebdd0a..1dff393345f 100644 --- a/app/web_hub.go +++ b/app/web_hub.go @@ -234,27 +234,27 @@ func (a *App) invalidateCacheForChannel(channel *model.Channel) { } } -func (a *App) invalidateCacheForChannelMembers(channelId string) { - a.Srv().Store.User().InvalidateProfilesInChannelCache(channelId) - a.Srv().Store.Channel().InvalidateMemberCount(channelId) - a.Srv().Store.Channel().InvalidateGuestCount(channelId) +func (a *App) invalidateCacheForChannelMembers(channelID string) { + a.Srv().Store.User().InvalidateProfilesInChannelCache(channelID) + a.Srv().Store.Channel().InvalidateMemberCount(channelID) + a.Srv().Store.Channel().InvalidateGuestCount(channelID) } -func (a *App) invalidateCacheForChannelMembersNotifyProps(channelId string) { - a.invalidateCacheForChannelMembersNotifyPropsSkipClusterSend(channelId) +func (a *App) invalidateCacheForChannelMembersNotifyProps(channelID string) { + a.invalidateCacheForChannelMembersNotifyPropsSkipClusterSend(channelID) if a.Cluster() != nil { msg := &model.ClusterMessage{ Event: model.CLUSTER_EVENT_INVALIDATE_CACHE_FOR_CHANNEL_MEMBERS_NOTIFY_PROPS, SendType: model.CLUSTER_SEND_BEST_EFFORT, - Data: channelId, + Data: channelID, } a.Cluster().SendClusterMessage(msg) } } -func (a *App) invalidateCacheForChannelMembersNotifyPropsSkipClusterSend(channelId string) { - a.Srv().Store.Channel().InvalidateCacheForChannelMembersNotifyProps(channelId) +func (a *App) invalidateCacheForChannelMembersNotifyPropsSkipClusterSend(channelID string) { + a.Srv().Store.Channel().InvalidateCacheForChannelMembersNotifyProps(channelID) } func (a *App) invalidateCacheForChannelByNameSkipClusterSend(teamID, name string) { @@ -265,9 +265,9 @@ func (a *App) invalidateCacheForChannelByNameSkipClusterSend(teamID, name string a.Srv().Store.Channel().InvalidateChannelByName(teamID, name) } -func (a *App) invalidateCacheForChannelPosts(channelId string) { - a.Srv().Store.Channel().InvalidatePinnedPostCount(channelId) - a.Srv().Store.Post().InvalidateLastPostTimeCache(channelId) +func (a *App) invalidateCacheForChannelPosts(channelID string) { + a.Srv().Store.Channel().InvalidatePinnedPostCount(channelID) + a.Srv().Store.Post().InvalidateLastPostTimeCache(channelID) } func (a *App) InvalidateCacheForUser(userID string) { diff --git a/app/webhook.go b/app/webhook.go index a731841ec93..b06eae65a85 100644 --- a/app/webhook.go +++ b/app/webhook.go @@ -585,12 +585,12 @@ func (a *App) GetOutgoingWebhooksPageByUser(userID string, page, perPage int) ([ return webhooks, nil } -func (a *App) GetOutgoingWebhooksForChannelPageByUser(channelId string, userID string, page, perPage int) ([]*model.OutgoingWebhook, *model.AppError) { +func (a *App) GetOutgoingWebhooksForChannelPageByUser(channelID string, userID string, page, perPage int) ([]*model.OutgoingWebhook, *model.AppError) { if !*a.Config().ServiceSettings.EnableOutgoingWebhooks { return nil, model.NewAppError("GetOutgoingWebhooksForChannelPage", "api.outgoing_webhook.disabled.app_error", nil, "", http.StatusNotImplemented) } - webhooks, err := a.Srv().Store.Webhook().GetOutgoingByChannelByUser(channelId, userID, page*perPage, perPage) + webhooks, err := a.Srv().Store.Webhook().GetOutgoingByChannelByUser(channelID, userID, page*perPage, perPage) if err != nil { return nil, model.NewAppError("GetOutgoingWebhooksForChannelPage", "app.webhooks.get_outgoing_by_channel.app_error", nil, err.Error(), http.StatusInternalServerError) }