Mm 16623 fix all initialism errors in channels/app and channels/api4 dir (#25743)

* updated go mod and sum files

* fixed var-naming errors in channels/app and channels/api4 dir

* Revert "updated go mod and sum files"

This reverts commit 088dd00a848c2c31952c29f0a2a28a9fb47fc3f7.

* renamed a cost .
Этот коммит содержится в:
Matthew Straughn
2023-12-20 00:46:54 -05:00
коммит произвёл GitHub
родитель 293caec0c7
Коммит ebdc964161
14 изменённых файлов: 70 добавлений и 70 удалений

Просмотреть файл

@@ -681,14 +681,14 @@ func (th *TestHelper) CreateChannelWithClient(client *model.Client4, channelType
return th.CreateChannelWithClientAndTeam(client, channelType, th.BasicTeam.Id) 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() id := model.NewId()
channel := &model.Channel{ channel := &model.Channel{
DisplayName: "dn_" + id, DisplayName: "dn_" + id,
Name: GenerateTestChannelName(), Name: GenerateTestChannelName(),
Type: channelType, Type: channelType,
TeamId: teamId, TeamId: teamID,
} }
rchannel, _, err := client.CreateChannel(context.Background(), channel) rchannel, _, err := client.CreateChannel(context.Background(), channel)
@@ -975,7 +975,7 @@ func GenerateTestAppName() string {
return "fakeoauthapp" + model.NewRandomString(10) return "fakeoauthapp" + model.NewRandomString(10)
} }
func GenerateTestId() string { func GenerateTestID() string {
return model.NewId() return model.NewId()
} }

Просмотреть файл

@@ -732,7 +732,7 @@ func TestCreateGroupChannel(t *testing.T) {
CheckBadRequestStatus(t, resp) CheckBadRequestStatus(t, resp)
require.Nil(t, rgc) 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) require.Error(t, err)
CheckBadRequestStatus(t, resp) CheckBadRequestStatus(t, resp)
@@ -1087,7 +1087,7 @@ func TestGetPublicChannelsByIdsForTeam(t *testing.T) {
require.Len(t, channels, 1, "should return 1 channel") require.Len(t, channels, 1, "should return 1 channel")
require.Equal(t, output[0], channels[0].DisplayName, "missing 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.BasicChannel2.Id)
input = append(input, th.BasicPrivateChannel.Id) input = append(input, th.BasicPrivateChannel.Id)
output = append(output, th.BasicChannel2.DisplayName) output = append(output, th.BasicChannel2.DisplayName)
@@ -1101,7 +1101,7 @@ func TestGetPublicChannelsByIdsForTeam(t *testing.T) {
require.Equal(t, output[i], c.DisplayName, "missing channel") 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) require.Error(t, err)
CheckForbiddenStatus(t, resp) CheckForbiddenStatus(t, resp)
@@ -1113,7 +1113,7 @@ func TestGetPublicChannelsByIdsForTeam(t *testing.T) {
require.Error(t, err) require.Error(t, err)
CheckBadRequestStatus(t, resp) 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) require.Error(t, err)
CheckNotFoundStatus(t, resp) CheckNotFoundStatus(t, resp)
@@ -1978,7 +1978,7 @@ func TestDeleteChannel(t *testing.T) {
require.Nilf(t, appErr, "Expected nil, Got %v", appErr) require.Nilf(t, appErr, "Expected nil, Got %v", appErr)
require.True(t, ch.DeleteAt != 0, "should have returned one with a populated DeleteAt.") 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) _, resp, _ := client.CreatePost(context.Background(), post1)
require.NotNil(t, resp, "expected response to not be nil") require.NotNil(t, resp, "expected response to not be nil")
@@ -2039,7 +2039,7 @@ func TestDeleteChannel(t *testing.T) {
CheckUnauthorizedStatus(t, resp) CheckUnauthorizedStatus(t, resp)
c.Logout(context.Background()) c.Logout(context.Background())
resp, err = c.DeleteChannel(context.Background(), GenerateTestId()) resp, err = c.DeleteChannel(context.Background(), GenerateTestID())
require.Error(t, err) require.Error(t, err)
CheckUnauthorizedStatus(t, resp) CheckUnauthorizedStatus(t, resp)
@@ -2795,7 +2795,7 @@ func TestGetPinnedPosts(t *testing.T) {
posts, resp, _ = client.GetPinnedPosts(context.Background(), channel.Id, resp.Etag) posts, resp, _ = client.GetPinnedPosts(context.Background(), channel.Id, resp.Etag)
CheckEtag(t, posts, resp) CheckEtag(t, posts, resp)
_, resp, err = client.GetPinnedPosts(context.Background(), GenerateTestId(), "") _, resp, err = client.GetPinnedPosts(context.Background(), GenerateTestID(), "")
require.Error(t, err) require.Error(t, err)
CheckForbiddenStatus(t, resp) 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, 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") 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) rpost, _, err := client.CreatePost(context.Background(), post)
require.NoError(t, err) require.NoError(t, err)
@@ -3106,7 +3106,7 @@ func TestAddChannelMember(t *testing.T) {
require.Error(t, err) require.Error(t, err)
CheckBadRequestStatus(t, resp) 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) require.Error(t, err)
CheckNotFoundStatus(t, resp) CheckNotFoundStatus(t, resp)
@@ -3119,7 +3119,7 @@ func TestAddChannelMember(t *testing.T) {
CheckBadRequestStatus(t, resp) CheckBadRequestStatus(t, resp)
require.Nil(t, cm, "should return nothing") 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) require.Error(t, err)
CheckNotFoundStatus(t, resp) CheckNotFoundStatus(t, resp)
@@ -3127,7 +3127,7 @@ func TestAddChannelMember(t *testing.T) {
require.Error(t, err) require.Error(t, err)
CheckBadRequestStatus(t, resp) 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) require.Error(t, err)
CheckNotFoundStatus(t, resp) CheckNotFoundStatus(t, resp)

Просмотреть файл

@@ -104,7 +104,7 @@ func TestUpdateCommand(t *testing.T) {
cmd1, _ = th.App.CreateCommand(cmd1) cmd1, _ = th.App.CreateCommand(cmd1)
cmd2 := &model.Command{ cmd2 := &model.Command{
CreatorId: GenerateTestId(), CreatorId: GenerateTestID(),
TeamId: team.Id, TeamId: team.Id,
URL: "http://nowhere.com/change", URL: "http://nowhere.com/change",
Method: model.CommandMethodGet, Method: model.CommandMethodGet,
@@ -127,7 +127,7 @@ func TestUpdateCommand(t *testing.T) {
require.Equal(t, cmd1.Token, rcmd.Token, "Token should have not updated") 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) rcmd, resp, err := client.UpdateCommand(context.Background(), cmd2)
require.Error(t, err) require.Error(t, err)
@@ -142,7 +142,7 @@ func TestUpdateCommand(t *testing.T) {
CheckBadRequestStatus(t, resp) CheckBadRequestStatus(t, resp)
cmd2.Id = cmd1.Id cmd2.Id = cmd1.Id
cmd2.TeamId = GenerateTestId() cmd2.TeamId = GenerateTestID()
_, resp, err = client.UpdateCommand(context.Background(), cmd2) _, resp, err = client.UpdateCommand(context.Background(), cmd2)
require.Error(t, err) require.Error(t, err)
@@ -194,7 +194,7 @@ func TestMoveCommand(t *testing.T) {
require.Error(t, err) require.Error(t, err)
CheckBadRequestStatus(t, resp) 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) require.Error(t, err)
CheckNotFoundStatus(t, resp) CheckNotFoundStatus(t, resp)
}) })
@@ -252,7 +252,7 @@ func TestDeleteCommand(t *testing.T) {
require.Error(t, err) require.Error(t, err)
CheckBadRequestStatus(t, resp) CheckBadRequestStatus(t, resp)
resp, err = client.DeleteCommand(context.Background(), GenerateTestId()) resp, err = client.DeleteCommand(context.Background(), GenerateTestID())
require.Error(t, err) require.Error(t, err)
CheckNotFoundStatus(t, resp) CheckNotFoundStatus(t, resp)
}) })

Просмотреть файл

@@ -1514,7 +1514,7 @@ func TestPatchPost(t *testing.T) {
t.Run("unknown post", func(t *testing.T) { t.Run("unknown post", func(t *testing.T) {
patch := &model.PostPatch{} patch := &model.PostPatch{}
_, resp, err := client.PatchPost(context.Background(), GenerateTestId(), patch) _, resp, err := client.PatchPost(context.Background(), GenerateTestID(), patch)
require.Error(t, err) require.Error(t, err)
CheckForbiddenStatus(t, resp) CheckForbiddenStatus(t, resp)
}) })
@@ -1634,7 +1634,7 @@ func TestPinPost(t *testing.T) {
require.Error(t, err) require.Error(t, err)
CheckBadRequestStatus(t, resp) CheckBadRequestStatus(t, resp)
resp, err = client.PinPost(context.Background(), GenerateTestId()) resp, err = client.PinPost(context.Background(), GenerateTestID())
require.Error(t, err) require.Error(t, err)
CheckForbiddenStatus(t, resp) CheckForbiddenStatus(t, resp)
@@ -1664,7 +1664,7 @@ func TestUnpinPost(t *testing.T) {
require.Error(t, err) require.Error(t, err)
CheckBadRequestStatus(t, resp) CheckBadRequestStatus(t, resp)
resp, err = client.UnpinPost(context.Background(), GenerateTestId()) resp, err = client.UnpinPost(context.Background(), GenerateTestID())
require.Error(t, err) require.Error(t, err)
CheckForbiddenStatus(t, resp) CheckForbiddenStatus(t, resp)
@@ -1920,7 +1920,7 @@ func TestGetFlaggedPostsForUser(t *testing.T) {
require.NoError(t, err) require.NoError(t, err)
require.Empty(t, rpl.Posts) 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.NoError(t, err)
require.Empty(t, rpl.Posts) require.Empty(t, rpl.Posts)
@@ -1948,7 +1948,7 @@ func TestGetFlaggedPostsForUser(t *testing.T) {
require.NoError(t, err) require.NoError(t, err)
require.Empty(t, rpl.Posts) 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.NoError(t, err)
require.Empty(t, rpl.Posts) require.Empty(t, rpl.Posts)
@@ -2028,7 +2028,7 @@ func TestGetFlaggedPostsForUser(t *testing.T) {
require.Error(t, err) require.Error(t, err)
CheckBadRequestStatus(t, resp) 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) require.Error(t, err)
CheckForbiddenStatus(t, resp) CheckForbiddenStatus(t, resp)
@@ -4273,7 +4273,7 @@ func TestAcknowledgePost(t *testing.T) {
require.Error(t, err) require.Error(t, err)
CheckBadRequestStatus(t, resp) 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) require.Error(t, err)
CheckForbiddenStatus(t, resp) CheckForbiddenStatus(t, resp)
@@ -4313,7 +4313,7 @@ func TestUnacknowledgePost(t *testing.T) {
require.Error(t, err) require.Error(t, err)
CheckBadRequestStatus(t, resp) 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) require.Error(t, err)
CheckForbiddenStatus(t, resp) CheckForbiddenStatus(t, resp)

Просмотреть файл

@@ -79,7 +79,7 @@ func TestSaveReaction(t *testing.T) {
}) })
t.Run("react-to-not-existing-post-id", func(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) _, resp, err := client.SaveReaction(context.Background(), reaction)
require.Error(t, err) 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) { t.Run("react-as-not-existing-user-id", func(t *testing.T) {
reaction.PostId = postId reaction.PostId = postId
reaction.UserId = GenerateTestId() reaction.UserId = GenerateTestID()
_, resp, err := client.SaveReaction(context.Background(), reaction) _, resp, err := client.SaveReaction(context.Background(), reaction)
require.Error(t, err) 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) { 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) require.Error(t, err)
CheckForbiddenStatus(t, resp) 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) { 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) resp, err := client.DeleteReaction(context.Background(), r1)
require.Error(t, err) require.Error(t, err)
CheckForbiddenStatus(t, resp) 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) { t.Run("delete-reaction-from-not-existing-user-id", func(t *testing.T) {
r1.PostId = postId r1.PostId = postId
r1.UserId = GenerateTestId() r1.UserId = GenerateTestID()
resp, err := client.DeleteReaction(context.Background(), r1) resp, err := client.DeleteReaction(context.Background(), r1)
require.Error(t, err) require.Error(t, err)

Просмотреть файл

@@ -524,7 +524,7 @@ func TestPatchTeam(t *testing.T) {
patch.CompanyName = model.NewString("Other company name") patch.CompanyName = model.NewString("Other company name")
patch.AllowOpenInvite = model.NewBool(true) 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) require.Error(t, err)
CheckForbiddenStatus(t, resp) CheckForbiddenStatus(t, resp)
@@ -2162,11 +2162,11 @@ func TestAddTeamMember(t *testing.T) {
require.Error(t, err) require.Error(t, err)
CheckBadRequestStatus(t, resp) 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) require.Error(t, err)
CheckForbiddenStatus(t, resp) 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) require.Error(t, err)
CheckNotFoundStatus(t, resp) CheckNotFoundStatus(t, resp)
@@ -2257,7 +2257,7 @@ func TestAddTeamMember(t *testing.T) {
th.App.DeleteToken(token) th.App.DeleteToken(token)
// invalid team id // invalid team id
testId := GenerateTestId() testId := GenerateTestID()
token = model.NewToken( token = model.NewToken(
app.TokenTypeTeamInvitation, app.TokenTypeTeamInvitation,
model.MapToJSON(map[string]string{"teamId": testId}), model.MapToJSON(map[string]string{"teamId": testId}),
@@ -2531,18 +2531,18 @@ func TestAddTeamMembers(t *testing.T) {
require.Error(t, err) require.Error(t, err)
CheckBadRequestStatus(t, resp) CheckBadRequestStatus(t, resp)
_, resp, err = client.AddTeamMembers(context.Background(), GenerateTestId(), userList) _, resp, err = client.AddTeamMembers(context.Background(), GenerateTestID(), userList)
require.Error(t, err) require.Error(t, err)
CheckNotFoundStatus(t, resp) CheckNotFoundStatus(t, resp)
testUserList := append(userList, GenerateTestId()) testUserList := append(userList, GenerateTestID())
_, resp, err = client.AddTeamMembers(context.Background(), team.Id, testUserList) _, resp, err = client.AddTeamMembers(context.Background(), team.Id, testUserList)
require.Error(t, err) require.Error(t, err)
CheckNotFoundStatus(t, resp) CheckNotFoundStatus(t, resp)
// Test with many users. // Test with many users.
for i := 0; i < 260; i++ { for i := 0; i < 260; i++ {
testUserList = append(testUserList, GenerateTestId()) testUserList = append(testUserList, GenerateTestID())
} }
_, resp, err = client.AddTeamMembers(context.Background(), team.Id, testUserList) _, resp, err = client.AddTeamMembers(context.Background(), team.Id, testUserList)
require.Error(t, err) require.Error(t, err)

Просмотреть файл

@@ -2469,7 +2469,7 @@ func TestUpdateUserActive(t *testing.T) {
require.Error(t, err) require.Error(t, err)
CheckForbiddenStatus(t, resp) 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) require.Error(t, err)
CheckForbiddenStatus(t, resp) CheckForbiddenStatus(t, resp)
@@ -3672,7 +3672,7 @@ func TestVerifyUserEmail(t *testing.T) {
_, err = th.Client.VerifyUserEmail(context.Background(), token.Token) _, err = th.Client.VerifyUserEmail(context.Background(), token.Token)
require.NoError(t, err) require.NoError(t, err)
resp, err := th.Client.VerifyUserEmail(context.Background(), GenerateTestId()) resp, err := th.Client.VerifyUserEmail(context.Background(), GenerateTestID())
require.Error(t, err) require.Error(t, err)
CheckBadRequestStatus(t, resp) CheckBadRequestStatus(t, resp)

Просмотреть файл

@@ -79,7 +79,7 @@ func (cfg *AutoPostCreator) CreateRandomPost(c request.CTX) (*model.Post, error)
return cfg.CreateRandomPostNested(c, "") 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 var fileIDs []string
if cfg.HasImage { if cfg.HasImage {
var err error var err error
@@ -99,7 +99,7 @@ func (cfg *AutoPostCreator) CreateRandomPostNested(c request.CTX, rootId string)
post := &model.Post{ post := &model.Post{
ChannelId: cfg.channelid, ChannelId: cfg.channelid,
UserId: cfg.userid, UserId: cfg.userid,
RootId: rootId, RootId: rootID,
Message: postText, Message: postText,
FileIds: fileIDs, FileIds: fileIDs,
} }

Просмотреть файл

@@ -16,7 +16,7 @@ type InvitePeopleProvider struct {
} }
const ( const (
CmdInvite_PEOPLE = "invite_people" CmdInvitePeople = "invite_people"
) )
func init() { func init() {
@@ -24,7 +24,7 @@ func init() {
} }
func (*InvitePeopleProvider) GetTrigger() string { func (*InvitePeopleProvider) GetTrigger() string {
return CmdInvite_PEOPLE return CmdInvitePeople
} }
func (*InvitePeopleProvider) GetCommand(a *app.App, T i18n.TranslateFunc) *model.Command { 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 autoComplete = false
} }
return &model.Command{ return &model.Command{
Trigger: CmdInvite_PEOPLE, Trigger: CmdInvitePeople,
AutoComplete: autoComplete, AutoComplete: autoComplete,
AutoCompleteDesc: T("api.command.invite_people.desc"), AutoCompleteDesc: T("api.command.invite_people.desc"),
AutoCompleteHint: T("api.command.invite_people.hint"), AutoCompleteHint: T("api.command.invite_people.hint"),

Просмотреть файл

@@ -195,7 +195,7 @@ func (lt *LoadTestProvider) doCommand(a *app.App, c request.CTX, args *model.Com
} }
if strings.HasPrefix(message, "json") { 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 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) { 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")) userID := strings.TrimSpace(strings.TrimPrefix(message, "activate_user"))
if err := a.UpdateUserActive(c, user_id, true); err != nil { if err := a.UpdateUserActive(c, userID, true); err != nil {
return &model.CommandResponse{Text: "Failed to activate user", ResponseType: model.CommandResponseTypeEphemeral}, err 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) { 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")) userID := strings.TrimSpace(strings.TrimPrefix(message, "deactivate_user"))
if err := a.UpdateUserActive(c, user_id, false); err != nil { if err := a.UpdateUserActive(c, userID, false); err != nil {
return &model.CommandResponse{Text: "Failed to deactivate user", ResponseType: model.CommandResponseTypeEphemeral}, err 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 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")) url := strings.TrimSpace(strings.TrimPrefix(message, "json"))
if url == "" { if url == "" {
return &model.CommandResponse{Text: "Command must contain a url", ResponseType: model.CommandResponseTypeEphemeral}, nil return &model.CommandResponse{Text: "Command must contain a url", ResponseType: model.CommandResponseTypeEphemeral}, nil

Просмотреть файл

@@ -73,7 +73,7 @@ func (*msgProvider) DoCommand(a *app.App, c request.CTX, args *model.CommandArgs
// Find the channel based on this user // Find the channel based on this user
channelName := model.GetDMNameFromIds(args.UserId, userProfile.Id) channelName := model.GetDMNameFromIds(args.UserId, userProfile.Id)
targetChannelId := "" targetChannelID := ""
if channel, channelErr := a.Srv().Store().Channel().GetByName(args.TeamId, channelName, true); channelErr != nil { if channel, channelErr := a.Srv().Store().Channel().GetByName(args.TeamId, channelName, true); channelErr != nil {
var nfErr *store.ErrNotFound var nfErr *store.ErrNotFound
if errors.As(channelErr, &nfErr) { 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()) c.Logger().Error(err.Error())
return &model.CommandResponse{Text: args.T(err.Id), ResponseType: model.CommandResponseTypeEphemeral} return &model.CommandResponse{Text: args.T(err.Id), ResponseType: model.CommandResponseTypeEphemeral}
} }
targetChannelId = directChannel.Id targetChannelID = directChannel.Id
} else { } else {
c.Logger().Error(channelErr.Error()) c.Logger().Error(channelErr.Error())
return &model.CommandResponse{Text: args.T("api.command_msg.dm_fail.app_error"), ResponseType: model.CommandResponseTypeEphemeral} return &model.CommandResponse{Text: args.T("api.command_msg.dm_fail.app_error"), ResponseType: model.CommandResponseTypeEphemeral}
} }
} else { } else {
targetChannelId = channel.Id targetChannelID = channel.Id
} }
if parsedMessage != "" { if parsedMessage != "" {
post := &model.Post{} post := &model.Post{}
post.Message = parsedMessage post.Message = parsedMessage
post.ChannelId = targetChannelId post.ChannelId = targetChannelID
post.UserId = args.UserId post.UserId = args.UserId
if _, err = a.CreatePostMissingChannel(c, post, true, true); err != nil { 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} return &model.CommandResponse{Text: args.T("api.command_msg.fail.app_error"), ResponseType: model.CommandResponseTypeEphemeral}

Просмотреть файл

@@ -279,10 +279,10 @@ func getRemoteClusterAutocompleteListItems(a *app.App, includeOffline bool) ([]m
return list, nil 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{ filter := model.RemoteClusterQueryFilter{
ExcludeOffline: !includeOffline, ExcludeOffline: !includeOffline,
NotInChannel: channelId, NotInChannel: channelID,
} }
all, err := a.GetAllRemoteClusters(filter) all, err := a.GetAllRemoteClusters(filter)
if err != nil || len(all) == 0 { if err != nil || len(all) == 0 {

Просмотреть файл

@@ -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) { func (sp *ShareProvider) doInviteRemote(a *app.App, c request.CTX, args *model.CommandArgs, margs map[string]string) (resp *model.CommandResponse) {
remoteId, ok := margs["connectionID"] remoteID, ok := margs["connectionID"]
if !ok || remoteId == "" { if !ok || remoteID == "" {
return responsef(args.T("api.command_share.must_specify_valid_remote")) 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 { if err != nil {
return responsef(args.T("api.command_share.fetch_remote.error", map[string]any{"Error": err.Error()})) 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")) 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 { if appErr != nil {
return responsef(args.T("api.command_share.remote_id_invalid.error", map[string]any{"Error": appErr.Error()})) 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 { func (sp *ShareProvider) doUninviteRemote(a *app.App, args *model.CommandArgs, margs map[string]string) *model.CommandResponse {
remoteId, ok := margs["connectionID"] remoteID, ok := margs["connectionID"]
if !ok || remoteId == "" { if !ok || remoteID == "" {
return responsef(args.T("api.command_share.remote_not_valid")) 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 { 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) deleted, err := a.DeleteSharedChannelRemote(scr.Id)
if err != nil || !deleted { 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 { func (sp *ShareProvider) doStatus(a *app.App, args *model.CommandArgs, _ map[string]string) *model.CommandResponse {

Просмотреть файл

@@ -195,7 +195,7 @@ func (s *MmctlE2ETestSuite) TestArchiveCommandCmdF() {
TeamId: teamOfBasicUser.Id, TeamId: teamOfBasicUser.Id,
DisplayName: "command", DisplayName: "command",
Description: "command", Description: "command",
Trigger: api4.GenerateTestId(), Trigger: api4.GenerateTestID(),
URL: "http://localhost:8000/example", URL: "http://localhost:8000/example",
CreatorId: s.th.BasicUser.Id, CreatorId: s.th.BasicUser.Id,
Username: s.th.BasicUser.Username, Username: s.th.BasicUser.Username,
@@ -231,7 +231,7 @@ func (s *MmctlE2ETestSuite) TestArchiveCommandCmdF() {
TeamId: teamOfAdminUser.Id, TeamId: teamOfAdminUser.Id,
DisplayName: "command", DisplayName: "command",
Description: "command", Description: "command",
Trigger: api4.GenerateTestId(), Trigger: api4.GenerateTestID(),
URL: "http://localhost:8000/example", URL: "http://localhost:8000/example",
CreatorId: s.th.SystemAdminUser.Id, CreatorId: s.th.SystemAdminUser.Id,
Username: s.th.SystemAdminUser.Username, Username: s.th.SystemAdminUser.Username,