Fixed double join messages (#3059)
Этот коммит содержится в:
коммит произвёл
Christopher Speller
родитель
36be959cd9
Коммит
981a08e80e
@@ -42,17 +42,9 @@ func (me *JoinProvider) DoCommand(c *Context, channelId string, message string)
|
||||
|
||||
if v.Name == message {
|
||||
|
||||
if v.Type == model.CHANNEL_DIRECT {
|
||||
if v.Type != model.CHANNEL_OPEN {
|
||||
return &model.CommandResponse{Text: c.T("api.command_join.fail.app_error"), ResponseType: model.COMMAND_RESPONSE_TYPE_EPHEMERAL}
|
||||
}
|
||||
|
||||
JoinChannelById(c, c.Session.UserId, v.Id)
|
||||
|
||||
if c.Err != nil {
|
||||
c.Err = nil
|
||||
return &model.CommandResponse{Text: c.T("api.command_join.fail.app_error"), ResponseType: model.COMMAND_RESPONSE_TYPE_EPHEMERAL}
|
||||
}
|
||||
|
||||
return &model.CommandResponse{GotoLocation: c.GetTeamURL() + "/channels/" + v.Name, Text: c.T("api.command_join.success"), ResponseType: model.COMMAND_RESPONSE_TYPE_EPHEMERAL}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,18 +41,7 @@ func TestJoinCommands(t *testing.T) {
|
||||
|
||||
c1 := Client.Must(Client.GetChannels("")).Data.(*model.ChannelList)
|
||||
|
||||
if len(c1.Channels) != 6 { // 4 because of town-square, off-topic and direct
|
||||
t.Fatal("didn't join channel")
|
||||
}
|
||||
|
||||
found := false
|
||||
for _, c := range c1.Channels {
|
||||
if c.Name == channel2.Name {
|
||||
found = true
|
||||
break
|
||||
}
|
||||
}
|
||||
if !found {
|
||||
if len(c1.Channels) != 5 {
|
||||
t.Fatal("didn't join channel")
|
||||
}
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user