PLT-4138 Fix /join command for non-admin accounts (#4265)

* Fix /join command for non-admin accounts

* Implement found check in join command unit test properly
Этот коммит содержится в:
Joram Wilander
2016-10-20 10:27:18 -04:00
коммит произвёл Harrison Healey
родитель 6517b0f9e1
Коммит 2e34d8843e
2 изменённых файлов: 10 добавлений и 3 удалений

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

@@ -46,7 +46,7 @@ func (me *JoinProvider) DoCommand(c *Context, channelId string, message string)
return &model.CommandResponse{Text: c.T("api.command_join.fail.app_error"), ResponseType: model.COMMAND_RESPONSE_TYPE_EPHEMERAL}
}
if err, _ := JoinChannelById(c, c.Session.UserId, channelId); err != nil {
if err, _ := JoinChannelById(c, c.Session.UserId, v.Id); err != nil {
return &model.CommandResponse{Text: c.T("api.command_join.fail.app_error"), ResponseType: model.COMMAND_RESPONSE_TYPE_EPHEMERAL}
}

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

@@ -41,7 +41,14 @@ func TestJoinCommands(t *testing.T) {
c1 := Client.Must(Client.GetChannels("")).Data.(*model.ChannelList)
if len(c1.Channels) != 5 {
t.Fatal("didn't join channel")
found := false
for _, c := range c1.Channels {
if c.Id == channel2.Id {
found = true
}
}
if !found {
t.Fatal("did not join channel")
}
}