MM-26055 Remove session requirement from command args. (#14880)

* Remove session requirement from command args.

* Removing unused server side translation.

* Restoring model.CommandArgs.Session for compatibility.

* Feedback fixes.

* Build fix

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Этот коммит содержится в:
Christopher Speller
2020-06-23 08:33:45 -07:00
коммит произвёл GitHub
родитель e7aaf0ea6a
Коммит 574b48835d
23 изменённых файлов: 87 добавлений и 116 удалений

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

@@ -64,21 +64,22 @@ func TestGroupMsgProvider(t *testing.T) {
th.LinkUserToTeam(th.BasicUser, team)
cmd := &groupmsgProvider{}
th.RemovePermissionFromRole(model.PERMISSION_CREATE_GROUP_CHANNEL.Id, model.SYSTEM_USER_ROLE_ID)
t.Run("Check without permission to create a GM channel.", func(t *testing.T) {
resp := cmd.DoCommand(th.App, &model.CommandArgs{
T: i18n.IdentityTfunc(),
SiteURL: "http://test.url",
TeamId: team.Id,
UserId: th.BasicUser.Id,
Session: model.Session{
Roles: "",
},
}, targetUsers+"hello")
assert.Equal(t, "api.command_groupmsg.permission.app_error", resp.Text)
assert.Equal(t, "", resp.GotoLocation)
})
th.AddPermissionToRole(model.PERMISSION_CREATE_GROUP_CHANNEL.Id, model.SYSTEM_USER_ROLE_ID)
t.Run("Check without permissions to view a user in the list.", func(t *testing.T) {
th.RemovePermissionFromRole(model.PERMISSION_VIEW_MEMBERS.Id, model.SYSTEM_USER_ROLE_ID)
defer th.AddPermissionToRole(model.PERMISSION_VIEW_MEMBERS.Id, model.SYSTEM_USER_ROLE_ID)
@@ -87,9 +88,6 @@ func TestGroupMsgProvider(t *testing.T) {
SiteURL: "http://test.url",
TeamId: team.Id,
UserId: th.BasicUser.Id,
Session: model.Session{
Roles: model.SYSTEM_USER_ROLE_ID,
},
}, targetUsers+"hello")
assert.Equal(t, "api.command_groupmsg.invalid_user.app_error", resp.Text)
@@ -102,9 +100,6 @@ func TestGroupMsgProvider(t *testing.T) {
SiteURL: "http://test.url",
TeamId: team.Id,
UserId: th.BasicUser.Id,
Session: model.Session{
Roles: model.SYSTEM_USER_ROLE_ID,
},
}, targetUsers+"hello")
channelName := model.GetGroupNameFromUserIds([]string{th.BasicUser.Id, th.BasicUser2.Id, user3.Id})
@@ -118,9 +113,6 @@ func TestGroupMsgProvider(t *testing.T) {
SiteURL: "http://test.url",
TeamId: team.Id,
UserId: th.BasicUser.Id,
Session: model.Session{
Roles: "",
},
}, targetUsers+"hello")
channelName := model.GetGroupNameFromUserIds([]string{th.BasicUser.Id, th.BasicUser2.Id, user3.Id})