MM-15485: In-channel system behaviour for at-mentions and slash commands for group-constrained channels. (#10855)

* MM-15108: Prevent non-group-members from being added to group-constrained channels.

* MM-15485: Updates ephemeral message when non-group member is invited to group-constrained channel.

* MM-15485: Prevent group-permitted members from being removed from group-constrained channels. Show custom ephemeral when attempting /kick or /remove.
This commit is contained in:
Martin Kraft
2019-05-17 07:43:19 -04:00
committed by George Goldberg
parent 6d2fa0f3d2
commit 8d8a4d8614
11 changed files with 72 additions and 16 deletions

View File

@@ -135,10 +135,16 @@ func doCommand(a *App, args *model.CommandArgs, message string) *model.CommandRe
}
if err = a.RemoveUserFromChannel(userProfile.Id, args.UserId, channel); err != nil {
return &model.CommandResponse{
Text: args.T(err.Id, map[string]interface{}{
var text string
if err.Id == "api.channel.remove_members.denied" {
text = args.T("api.command_remove.group_constrained_user_denied")
} else {
text = args.T(err.Id, map[string]interface{}{
"Channel": model.DEFAULT_CHANNEL,
}),
})
}
return &model.CommandResponse{
Text: text,
ResponseType: model.COMMAND_RESPONSE_TYPE_EPHEMERAL,
}
}