diff --git a/server/channels/api4/apitestlib.go b/server/channels/api4/apitestlib.go index e124758fc5..950415a6d6 100644 --- a/server/channels/api4/apitestlib.go +++ b/server/channels/api4/apitestlib.go @@ -681,14 +681,14 @@ func (th *TestHelper) CreateChannelWithClient(client *model.Client4, channelType return th.CreateChannelWithClientAndTeam(client, channelType, th.BasicTeam.Id) } -func (th *TestHelper) CreateChannelWithClientAndTeam(client *model.Client4, channelType model.ChannelType, teamId string) *model.Channel { +func (th *TestHelper) CreateChannelWithClientAndTeam(client *model.Client4, channelType model.ChannelType, teamID string) *model.Channel { id := model.NewId() channel := &model.Channel{ DisplayName: "dn_" + id, Name: GenerateTestChannelName(), Type: channelType, - TeamId: teamId, + TeamId: teamID, } rchannel, _, err := client.CreateChannel(context.Background(), channel) @@ -975,7 +975,7 @@ func GenerateTestAppName() string { return "fakeoauthapp" + model.NewRandomString(10) } -func GenerateTestId() string { +func GenerateTestID() string { return model.NewId() } diff --git a/server/channels/api4/channel_test.go b/server/channels/api4/channel_test.go index 8628fae8d8..15371a2dba 100644 --- a/server/channels/api4/channel_test.go +++ b/server/channels/api4/channel_test.go @@ -732,7 +732,7 @@ func TestCreateGroupChannel(t *testing.T) { CheckBadRequestStatus(t, resp) require.Nil(t, rgc) - _, resp, err = client.CreateGroupChannel(context.Background(), []string{user.Id, user2.Id, user3.Id, GenerateTestId()}) + _, resp, err = client.CreateGroupChannel(context.Background(), []string{user.Id, user2.Id, user3.Id, GenerateTestID()}) require.Error(t, err) CheckBadRequestStatus(t, resp) @@ -1087,7 +1087,7 @@ func TestGetPublicChannelsByIdsForTeam(t *testing.T) { require.Len(t, channels, 1, "should return 1 channel") require.Equal(t, output[0], channels[0].DisplayName, "missing channel") - input = append(input, GenerateTestId()) + input = append(input, GenerateTestID()) input = append(input, th.BasicChannel2.Id) input = append(input, th.BasicPrivateChannel.Id) output = append(output, th.BasicChannel2.DisplayName) @@ -1101,7 +1101,7 @@ func TestGetPublicChannelsByIdsForTeam(t *testing.T) { require.Equal(t, output[i], c.DisplayName, "missing channel") } - _, resp, err := client.GetPublicChannelsByIdsForTeam(context.Background(), GenerateTestId(), input) + _, resp, err := client.GetPublicChannelsByIdsForTeam(context.Background(), GenerateTestID(), input) require.Error(t, err) CheckForbiddenStatus(t, resp) @@ -1113,7 +1113,7 @@ func TestGetPublicChannelsByIdsForTeam(t *testing.T) { require.Error(t, err) CheckBadRequestStatus(t, resp) - _, resp, err = client.GetPublicChannelsByIdsForTeam(context.Background(), teamId, []string{GenerateTestId()}) + _, resp, err = client.GetPublicChannelsByIdsForTeam(context.Background(), teamId, []string{GenerateTestID()}) require.Error(t, err) CheckNotFoundStatus(t, resp) @@ -1978,7 +1978,7 @@ func TestDeleteChannel(t *testing.T) { require.Nilf(t, appErr, "Expected nil, Got %v", appErr) require.True(t, ch.DeleteAt != 0, "should have returned one with a populated DeleteAt.") - post1 := &model.Post{ChannelId: publicChannel1.Id, Message: "a" + GenerateTestId() + "a"} + post1 := &model.Post{ChannelId: publicChannel1.Id, Message: "a" + GenerateTestID() + "a"} _, resp, _ := client.CreatePost(context.Background(), post1) require.NotNil(t, resp, "expected response to not be nil") @@ -2039,7 +2039,7 @@ func TestDeleteChannel(t *testing.T) { CheckUnauthorizedStatus(t, resp) c.Logout(context.Background()) - resp, err = c.DeleteChannel(context.Background(), GenerateTestId()) + resp, err = c.DeleteChannel(context.Background(), GenerateTestID()) require.Error(t, err) CheckUnauthorizedStatus(t, resp) @@ -2795,7 +2795,7 @@ func TestGetPinnedPosts(t *testing.T) { posts, resp, _ = client.GetPinnedPosts(context.Background(), channel.Id, resp.Etag) CheckEtag(t, posts, resp) - _, resp, err = client.GetPinnedPosts(context.Background(), GenerateTestId(), "") + _, resp, err = client.GetPinnedPosts(context.Background(), GenerateTestID(), "") require.Error(t, err) CheckForbiddenStatus(t, resp) @@ -3092,7 +3092,7 @@ func TestAddChannelMember(t *testing.T) { require.Equal(t, privateChannel.Id, cm.ChannelId, "should have returned exact channel") require.Equal(t, user2.Id, cm.UserId, "should have returned exact user added to private channel") - post := &model.Post{ChannelId: publicChannel.Id, Message: "a" + GenerateTestId() + "a"} + post := &model.Post{ChannelId: publicChannel.Id, Message: "a" + GenerateTestID() + "a"} rpost, _, err := client.CreatePost(context.Background(), post) require.NoError(t, err) @@ -3106,7 +3106,7 @@ func TestAddChannelMember(t *testing.T) { require.Error(t, err) CheckBadRequestStatus(t, resp) - _, resp, err = client.AddChannelMemberWithRootId(context.Background(), publicChannel.Id, user.Id, GenerateTestId()) + _, resp, err = client.AddChannelMemberWithRootId(context.Background(), publicChannel.Id, user.Id, GenerateTestID()) require.Error(t, err) CheckNotFoundStatus(t, resp) @@ -3119,7 +3119,7 @@ func TestAddChannelMember(t *testing.T) { CheckBadRequestStatus(t, resp) require.Nil(t, cm, "should return nothing") - _, resp, err = client.AddChannelMember(context.Background(), publicChannel.Id, GenerateTestId()) + _, resp, err = client.AddChannelMember(context.Background(), publicChannel.Id, GenerateTestID()) require.Error(t, err) CheckNotFoundStatus(t, resp) @@ -3127,7 +3127,7 @@ func TestAddChannelMember(t *testing.T) { require.Error(t, err) CheckBadRequestStatus(t, resp) - _, resp, err = client.AddChannelMember(context.Background(), GenerateTestId(), user2.Id) + _, resp, err = client.AddChannelMember(context.Background(), GenerateTestID(), user2.Id) require.Error(t, err) CheckNotFoundStatus(t, resp) diff --git a/server/channels/api4/command_test.go b/server/channels/api4/command_test.go index bba6111499..c9cf00dd17 100644 --- a/server/channels/api4/command_test.go +++ b/server/channels/api4/command_test.go @@ -104,7 +104,7 @@ func TestUpdateCommand(t *testing.T) { cmd1, _ = th.App.CreateCommand(cmd1) cmd2 := &model.Command{ - CreatorId: GenerateTestId(), + CreatorId: GenerateTestID(), TeamId: team.Id, URL: "http://nowhere.com/change", Method: model.CommandMethodGet, @@ -127,7 +127,7 @@ func TestUpdateCommand(t *testing.T) { require.Equal(t, cmd1.Token, rcmd.Token, "Token should have not updated") - cmd2.Id = GenerateTestId() + cmd2.Id = GenerateTestID() rcmd, resp, err := client.UpdateCommand(context.Background(), cmd2) require.Error(t, err) @@ -142,7 +142,7 @@ func TestUpdateCommand(t *testing.T) { CheckBadRequestStatus(t, resp) cmd2.Id = cmd1.Id - cmd2.TeamId = GenerateTestId() + cmd2.TeamId = GenerateTestID() _, resp, err = client.UpdateCommand(context.Background(), cmd2) require.Error(t, err) @@ -194,7 +194,7 @@ func TestMoveCommand(t *testing.T) { require.Error(t, err) CheckBadRequestStatus(t, resp) - resp, err = client.MoveCommand(context.Background(), GenerateTestId(), rcmd1.Id) + resp, err = client.MoveCommand(context.Background(), GenerateTestID(), rcmd1.Id) require.Error(t, err) CheckNotFoundStatus(t, resp) }) @@ -252,7 +252,7 @@ func TestDeleteCommand(t *testing.T) { require.Error(t, err) CheckBadRequestStatus(t, resp) - resp, err = client.DeleteCommand(context.Background(), GenerateTestId()) + resp, err = client.DeleteCommand(context.Background(), GenerateTestID()) require.Error(t, err) CheckNotFoundStatus(t, resp) }) diff --git a/server/channels/api4/post_test.go b/server/channels/api4/post_test.go index 813a843daa..db57b23767 100644 --- a/server/channels/api4/post_test.go +++ b/server/channels/api4/post_test.go @@ -1514,7 +1514,7 @@ func TestPatchPost(t *testing.T) { t.Run("unknown post", func(t *testing.T) { patch := &model.PostPatch{} - _, resp, err := client.PatchPost(context.Background(), GenerateTestId(), patch) + _, resp, err := client.PatchPost(context.Background(), GenerateTestID(), patch) require.Error(t, err) CheckForbiddenStatus(t, resp) }) @@ -1634,7 +1634,7 @@ func TestPinPost(t *testing.T) { require.Error(t, err) CheckBadRequestStatus(t, resp) - resp, err = client.PinPost(context.Background(), GenerateTestId()) + resp, err = client.PinPost(context.Background(), GenerateTestID()) require.Error(t, err) CheckForbiddenStatus(t, resp) @@ -1664,7 +1664,7 @@ func TestUnpinPost(t *testing.T) { require.Error(t, err) CheckBadRequestStatus(t, resp) - resp, err = client.UnpinPost(context.Background(), GenerateTestId()) + resp, err = client.UnpinPost(context.Background(), GenerateTestID()) require.Error(t, err) CheckForbiddenStatus(t, resp) @@ -1920,7 +1920,7 @@ func TestGetFlaggedPostsForUser(t *testing.T) { require.NoError(t, err) require.Empty(t, rpl.Posts) - rpl, _, err = client.GetFlaggedPostsForUserInChannel(context.Background(), user.Id, GenerateTestId(), 0, 10) + rpl, _, err = client.GetFlaggedPostsForUserInChannel(context.Background(), user.Id, GenerateTestID(), 0, 10) require.NoError(t, err) require.Empty(t, rpl.Posts) @@ -1948,7 +1948,7 @@ func TestGetFlaggedPostsForUser(t *testing.T) { require.NoError(t, err) require.Empty(t, rpl.Posts) - rpl, _, err = client.GetFlaggedPostsForUserInTeam(context.Background(), user.Id, GenerateTestId(), 0, 10) + rpl, _, err = client.GetFlaggedPostsForUserInTeam(context.Background(), user.Id, GenerateTestID(), 0, 10) require.NoError(t, err) require.Empty(t, rpl.Posts) @@ -2028,7 +2028,7 @@ func TestGetFlaggedPostsForUser(t *testing.T) { require.Error(t, err) CheckBadRequestStatus(t, resp) - _, resp, err = client.GetFlaggedPostsForUser(context.Background(), GenerateTestId(), 0, 10) + _, resp, err = client.GetFlaggedPostsForUser(context.Background(), GenerateTestID(), 0, 10) require.Error(t, err) CheckForbiddenStatus(t, resp) @@ -4273,7 +4273,7 @@ func TestAcknowledgePost(t *testing.T) { require.Error(t, err) CheckBadRequestStatus(t, resp) - _, resp, err = client.AcknowledgePost(context.Background(), GenerateTestId(), th.BasicUser.Id) + _, resp, err = client.AcknowledgePost(context.Background(), GenerateTestID(), th.BasicUser.Id) require.Error(t, err) CheckForbiddenStatus(t, resp) @@ -4313,7 +4313,7 @@ func TestUnacknowledgePost(t *testing.T) { require.Error(t, err) CheckBadRequestStatus(t, resp) - resp, err = client.UnacknowledgePost(context.Background(), GenerateTestId(), th.BasicUser.Id) + resp, err = client.UnacknowledgePost(context.Background(), GenerateTestID(), th.BasicUser.Id) require.Error(t, err) CheckForbiddenStatus(t, resp) diff --git a/server/channels/api4/reaction_test.go b/server/channels/api4/reaction_test.go index c0b08a17ad..308c1a3757 100644 --- a/server/channels/api4/reaction_test.go +++ b/server/channels/api4/reaction_test.go @@ -79,7 +79,7 @@ func TestSaveReaction(t *testing.T) { }) t.Run("react-to-not-existing-post-id", func(t *testing.T) { - reaction.PostId = GenerateTestId() + reaction.PostId = GenerateTestID() _, resp, err := client.SaveReaction(context.Background(), reaction) require.Error(t, err) @@ -96,7 +96,7 @@ func TestSaveReaction(t *testing.T) { t.Run("react-as-not-existing-user-id", func(t *testing.T) { reaction.PostId = postId - reaction.UserId = GenerateTestId() + reaction.UserId = GenerateTestID() _, resp, err := client.SaveReaction(context.Background(), reaction) require.Error(t, err) @@ -254,7 +254,7 @@ func TestGetReactions(t *testing.T) { }) t.Run("get-reactions-of-not-existing-post-id", func(t *testing.T) { - _, resp, err := client.GetReactions(context.Background(), GenerateTestId()) + _, resp, err := client.GetReactions(context.Background(), GenerateTestID()) require.Error(t, err) CheckForbiddenStatus(t, resp) }) @@ -375,7 +375,7 @@ func TestDeleteReaction(t *testing.T) { }) t.Run("delete-reaction-from-not-existing-post-id", func(t *testing.T) { - r1.PostId = GenerateTestId() + r1.PostId = GenerateTestID() resp, err := client.DeleteReaction(context.Background(), r1) require.Error(t, err) CheckForbiddenStatus(t, resp) @@ -391,7 +391,7 @@ func TestDeleteReaction(t *testing.T) { t.Run("delete-reaction-from-not-existing-user-id", func(t *testing.T) { r1.PostId = postId - r1.UserId = GenerateTestId() + r1.UserId = GenerateTestID() resp, err := client.DeleteReaction(context.Background(), r1) require.Error(t, err) diff --git a/server/channels/api4/team_test.go b/server/channels/api4/team_test.go index 2da75efa52..d4f0a572b5 100644 --- a/server/channels/api4/team_test.go +++ b/server/channels/api4/team_test.go @@ -524,7 +524,7 @@ func TestPatchTeam(t *testing.T) { patch.CompanyName = model.NewString("Other company name") patch.AllowOpenInvite = model.NewBool(true) - _, resp, err := th.Client.PatchTeam(context.Background(), GenerateTestId(), patch) + _, resp, err := th.Client.PatchTeam(context.Background(), GenerateTestID(), patch) require.Error(t, err) CheckForbiddenStatus(t, resp) @@ -2162,11 +2162,11 @@ func TestAddTeamMember(t *testing.T) { require.Error(t, err) CheckBadRequestStatus(t, resp) - _, resp, err = client.AddTeamMember(context.Background(), GenerateTestId(), otherUser.Id) + _, resp, err = client.AddTeamMember(context.Background(), GenerateTestID(), otherUser.Id) require.Error(t, err) CheckForbiddenStatus(t, resp) - _, resp, err = client.AddTeamMember(context.Background(), team.Id, GenerateTestId()) + _, resp, err = client.AddTeamMember(context.Background(), team.Id, GenerateTestID()) require.Error(t, err) CheckNotFoundStatus(t, resp) @@ -2257,7 +2257,7 @@ func TestAddTeamMember(t *testing.T) { th.App.DeleteToken(token) // invalid team id - testId := GenerateTestId() + testId := GenerateTestID() token = model.NewToken( app.TokenTypeTeamInvitation, model.MapToJSON(map[string]string{"teamId": testId}), @@ -2531,18 +2531,18 @@ func TestAddTeamMembers(t *testing.T) { require.Error(t, err) CheckBadRequestStatus(t, resp) - _, resp, err = client.AddTeamMembers(context.Background(), GenerateTestId(), userList) + _, resp, err = client.AddTeamMembers(context.Background(), GenerateTestID(), userList) require.Error(t, err) CheckNotFoundStatus(t, resp) - testUserList := append(userList, GenerateTestId()) + testUserList := append(userList, GenerateTestID()) _, resp, err = client.AddTeamMembers(context.Background(), team.Id, testUserList) require.Error(t, err) CheckNotFoundStatus(t, resp) // Test with many users. for i := 0; i < 260; i++ { - testUserList = append(testUserList, GenerateTestId()) + testUserList = append(testUserList, GenerateTestID()) } _, resp, err = client.AddTeamMembers(context.Background(), team.Id, testUserList) require.Error(t, err) diff --git a/server/channels/api4/user_test.go b/server/channels/api4/user_test.go index 73eae7c4dd..dad0e69f58 100644 --- a/server/channels/api4/user_test.go +++ b/server/channels/api4/user_test.go @@ -2469,7 +2469,7 @@ func TestUpdateUserActive(t *testing.T) { require.Error(t, err) CheckForbiddenStatus(t, resp) - resp, err = th.Client.UpdateUserActive(context.Background(), GenerateTestId(), true) + resp, err = th.Client.UpdateUserActive(context.Background(), GenerateTestID(), true) require.Error(t, err) CheckForbiddenStatus(t, resp) @@ -3672,7 +3672,7 @@ func TestVerifyUserEmail(t *testing.T) { _, err = th.Client.VerifyUserEmail(context.Background(), token.Token) require.NoError(t, err) - resp, err := th.Client.VerifyUserEmail(context.Background(), GenerateTestId()) + resp, err := th.Client.VerifyUserEmail(context.Background(), GenerateTestID()) require.Error(t, err) CheckBadRequestStatus(t, resp) diff --git a/server/channels/app/slashcommands/auto_posts.go b/server/channels/app/slashcommands/auto_posts.go index 7cea8bc7de..9c66c84907 100644 --- a/server/channels/app/slashcommands/auto_posts.go +++ b/server/channels/app/slashcommands/auto_posts.go @@ -79,7 +79,7 @@ func (cfg *AutoPostCreator) CreateRandomPost(c request.CTX) (*model.Post, error) return cfg.CreateRandomPostNested(c, "") } -func (cfg *AutoPostCreator) CreateRandomPostNested(c request.CTX, rootId string) (*model.Post, error) { +func (cfg *AutoPostCreator) CreateRandomPostNested(c request.CTX, rootID string) (*model.Post, error) { var fileIDs []string if cfg.HasImage { var err error @@ -99,7 +99,7 @@ func (cfg *AutoPostCreator) CreateRandomPostNested(c request.CTX, rootId string) post := &model.Post{ ChannelId: cfg.channelid, UserId: cfg.userid, - RootId: rootId, + RootId: rootID, Message: postText, FileIds: fileIDs, } diff --git a/server/channels/app/slashcommands/command_invite_people.go b/server/channels/app/slashcommands/command_invite_people.go index 54d59e46bd..b0936e1a4b 100644 --- a/server/channels/app/slashcommands/command_invite_people.go +++ b/server/channels/app/slashcommands/command_invite_people.go @@ -16,7 +16,7 @@ type InvitePeopleProvider struct { } const ( - CmdInvite_PEOPLE = "invite_people" + CmdInvitePeople = "invite_people" ) func init() { @@ -24,7 +24,7 @@ func init() { } func (*InvitePeopleProvider) GetTrigger() string { - return CmdInvite_PEOPLE + return CmdInvitePeople } func (*InvitePeopleProvider) GetCommand(a *app.App, T i18n.TranslateFunc) *model.Command { @@ -33,7 +33,7 @@ func (*InvitePeopleProvider) GetCommand(a *app.App, T i18n.TranslateFunc) *model autoComplete = false } return &model.Command{ - Trigger: CmdInvite_PEOPLE, + Trigger: CmdInvitePeople, AutoComplete: autoComplete, AutoCompleteDesc: T("api.command.invite_people.desc"), AutoCompleteHint: T("api.command.invite_people.hint"), diff --git a/server/channels/app/slashcommands/command_loadtest.go b/server/channels/app/slashcommands/command_loadtest.go index 33f75daf59..818d9de13a 100644 --- a/server/channels/app/slashcommands/command_loadtest.go +++ b/server/channels/app/slashcommands/command_loadtest.go @@ -195,7 +195,7 @@ func (lt *LoadTestProvider) doCommand(a *app.App, c request.CTX, args *model.Com } if strings.HasPrefix(message, "json") { - return lt.JsonCommand(a, c, args, message) + return lt.JSONCommand(a, c, args, message) } return lt.HelpCommand(args, message), nil @@ -292,8 +292,8 @@ func (*LoadTestProvider) SetupCommand(a *app.App, c request.CTX, args *model.Com } func (*LoadTestProvider) ActivateUserCommand(a *app.App, c request.CTX, args *model.CommandArgs, message string) (*model.CommandResponse, error) { - user_id := strings.TrimSpace(strings.TrimPrefix(message, "activate_user")) - if err := a.UpdateUserActive(c, user_id, true); err != nil { + userID := strings.TrimSpace(strings.TrimPrefix(message, "activate_user")) + if err := a.UpdateUserActive(c, userID, true); err != nil { return &model.CommandResponse{Text: "Failed to activate user", ResponseType: model.CommandResponseTypeEphemeral}, err } @@ -301,8 +301,8 @@ func (*LoadTestProvider) ActivateUserCommand(a *app.App, c request.CTX, args *mo } func (*LoadTestProvider) DeActivateUserCommand(a *app.App, c request.CTX, args *model.CommandArgs, message string) (*model.CommandResponse, error) { - user_id := strings.TrimSpace(strings.TrimPrefix(message, "deactivate_user")) - if err := a.UpdateUserActive(c, user_id, false); err != nil { + userID := strings.TrimSpace(strings.TrimPrefix(message, "deactivate_user")) + if err := a.UpdateUserActive(c, userID, false); err != nil { return &model.CommandResponse{Text: "Failed to deactivate user", ResponseType: model.CommandResponseTypeEphemeral}, err } @@ -670,7 +670,7 @@ func (*LoadTestProvider) URLCommand(a *app.App, c request.CTX, args *model.Comma return &model.CommandResponse{Text: "Loaded data", ResponseType: model.CommandResponseTypeEphemeral}, nil } -func (*LoadTestProvider) JsonCommand(a *app.App, c request.CTX, args *model.CommandArgs, message string) (*model.CommandResponse, error) { +func (*LoadTestProvider) JSONCommand(a *app.App, c request.CTX, args *model.CommandArgs, message string) (*model.CommandResponse, error) { url := strings.TrimSpace(strings.TrimPrefix(message, "json")) if url == "" { return &model.CommandResponse{Text: "Command must contain a url", ResponseType: model.CommandResponseTypeEphemeral}, nil diff --git a/server/channels/app/slashcommands/command_msg.go b/server/channels/app/slashcommands/command_msg.go index 502d543392..fc45a8fbb8 100644 --- a/server/channels/app/slashcommands/command_msg.go +++ b/server/channels/app/slashcommands/command_msg.go @@ -73,7 +73,7 @@ func (*msgProvider) DoCommand(a *app.App, c request.CTX, args *model.CommandArgs // Find the channel based on this user channelName := model.GetDMNameFromIds(args.UserId, userProfile.Id) - targetChannelId := "" + targetChannelID := "" if channel, channelErr := a.Srv().Store().Channel().GetByName(args.TeamId, channelName, true); channelErr != nil { var nfErr *store.ErrNotFound if errors.As(channelErr, &nfErr) { @@ -86,19 +86,19 @@ func (*msgProvider) DoCommand(a *app.App, c request.CTX, args *model.CommandArgs c.Logger().Error(err.Error()) return &model.CommandResponse{Text: args.T(err.Id), ResponseType: model.CommandResponseTypeEphemeral} } - targetChannelId = directChannel.Id + targetChannelID = directChannel.Id } else { c.Logger().Error(channelErr.Error()) return &model.CommandResponse{Text: args.T("api.command_msg.dm_fail.app_error"), ResponseType: model.CommandResponseTypeEphemeral} } } else { - targetChannelId = channel.Id + targetChannelID = channel.Id } if parsedMessage != "" { post := &model.Post{} post.Message = parsedMessage - post.ChannelId = targetChannelId + post.ChannelId = targetChannelID post.UserId = args.UserId if _, err = a.CreatePostMissingChannel(c, post, true, true); err != nil { return &model.CommandResponse{Text: args.T("api.command_msg.fail.app_error"), ResponseType: model.CommandResponseTypeEphemeral} diff --git a/server/channels/app/slashcommands/command_remote.go b/server/channels/app/slashcommands/command_remote.go index 49dd8fa9b9..bffa1cddda 100644 --- a/server/channels/app/slashcommands/command_remote.go +++ b/server/channels/app/slashcommands/command_remote.go @@ -279,10 +279,10 @@ func getRemoteClusterAutocompleteListItems(a *app.App, includeOffline bool) ([]m return list, nil } -func getRemoteClusterAutocompleteListItemsNotInChannel(a *app.App, channelId string, includeOffline bool) ([]model.AutocompleteListItem, error) { +func getRemoteClusterAutocompleteListItemsNotInChannel(a *app.App, channelID string, includeOffline bool) ([]model.AutocompleteListItem, error) { filter := model.RemoteClusterQueryFilter{ ExcludeOffline: !includeOffline, - NotInChannel: channelId, + NotInChannel: channelID, } all, err := a.GetAllRemoteClusters(filter) if err != nil || len(all) == 0 { diff --git a/server/channels/app/slashcommands/command_share.go b/server/channels/app/slashcommands/command_share.go index 8b6329e30e..b4ca40c056 100644 --- a/server/channels/app/slashcommands/command_share.go +++ b/server/channels/app/slashcommands/command_share.go @@ -225,12 +225,12 @@ func (sp *ShareProvider) doUnshareChannel(a *app.App, args *model.CommandArgs, m } func (sp *ShareProvider) doInviteRemote(a *app.App, c request.CTX, args *model.CommandArgs, margs map[string]string) (resp *model.CommandResponse) { - remoteId, ok := margs["connectionID"] - if !ok || remoteId == "" { + remoteID, ok := margs["connectionID"] + if !ok || remoteID == "" { return responsef(args.T("api.command_share.must_specify_valid_remote")) } - hasRemote, err := a.HasRemote(args.ChannelId, remoteId) + hasRemote, err := a.HasRemote(args.ChannelId, remoteID) if err != nil { return responsef(args.T("api.command_share.fetch_remote.error", map[string]any{"Error": err.Error()})) } @@ -259,7 +259,7 @@ func (sp *ShareProvider) doInviteRemote(a *app.App, c request.CTX, args *model.C return responsef(args.T("api.command_share.channel_invite_not_home.error")) } - rc, appErr := a.GetRemoteCluster(remoteId) + rc, appErr := a.GetRemoteCluster(remoteID) if appErr != nil { return responsef(args.T("api.command_share.remote_id_invalid.error", map[string]any{"Error": appErr.Error()})) } @@ -277,21 +277,21 @@ func (sp *ShareProvider) doInviteRemote(a *app.App, c request.CTX, args *model.C } func (sp *ShareProvider) doUninviteRemote(a *app.App, args *model.CommandArgs, margs map[string]string) *model.CommandResponse { - remoteId, ok := margs["connectionID"] - if !ok || remoteId == "" { + remoteID, ok := margs["connectionID"] + if !ok || remoteID == "" { return responsef(args.T("api.command_share.remote_not_valid")) } - scr, err := a.GetSharedChannelRemoteByIds(args.ChannelId, remoteId) + scr, err := a.GetSharedChannelRemoteByIds(args.ChannelId, remoteID) if err != nil || scr.ChannelId != args.ChannelId { - return responsef(args.T("api.command_share.channel_remote_id_not_exists", map[string]any{"RemoteId": remoteId})) + return responsef(args.T("api.command_share.channel_remote_id_not_exists", map[string]any{"RemoteId": remoteID})) } deleted, err := a.DeleteSharedChannelRemote(scr.Id) if err != nil || !deleted { - return responsef(args.T("api.command_share.could_not_uninvite.error", map[string]any{"RemoteId": remoteId, "Error": err.Error()})) + return responsef(args.T("api.command_share.could_not_uninvite.error", map[string]any{"RemoteId": remoteID, "Error": err.Error()})) } - return responsef("##### " + args.T("api.command_share.remote_uninvited", map[string]any{"RemoteId": remoteId})) + return responsef("##### " + args.T("api.command_share.remote_uninvited", map[string]any{"RemoteId": remoteID})) } func (sp *ShareProvider) doStatus(a *app.App, args *model.CommandArgs, _ map[string]string) *model.CommandResponse { diff --git a/server/cmd/mmctl/commands/command_e2e_test.go b/server/cmd/mmctl/commands/command_e2e_test.go index 883c24613a..7a427c0878 100644 --- a/server/cmd/mmctl/commands/command_e2e_test.go +++ b/server/cmd/mmctl/commands/command_e2e_test.go @@ -195,7 +195,7 @@ func (s *MmctlE2ETestSuite) TestArchiveCommandCmdF() { TeamId: teamOfBasicUser.Id, DisplayName: "command", Description: "command", - Trigger: api4.GenerateTestId(), + Trigger: api4.GenerateTestID(), URL: "http://localhost:8000/example", CreatorId: s.th.BasicUser.Id, Username: s.th.BasicUser.Username, @@ -231,7 +231,7 @@ func (s *MmctlE2ETestSuite) TestArchiveCommandCmdF() { TeamId: teamOfAdminUser.Id, DisplayName: "command", Description: "command", - Trigger: api4.GenerateTestId(), + Trigger: api4.GenerateTestID(), URL: "http://localhost:8000/example", CreatorId: s.th.SystemAdminUser.Id, Username: s.th.SystemAdminUser.Username,