[MM-18830] Unhelpful error message when adding bot to a channel before adding to team (#12844)

* Fix error message

* Rename User to Username

* Add '@' to the username
This commit is contained in:
Shota Gvinepadze
2019-10-31 12:49:50 +04:00
committed by GitHub
parent df0bb8aaa0
commit b208bbc43e
3 changed files with 9 additions and 1 deletions

View File

@@ -143,6 +143,10 @@ func (me *InviteProvider) DoCommand(a *App, args *model.CommandArgs, message str
var text string
if err.Id == "api.channel.add_members.user_denied" {
text = args.T("api.command_invite.group_constrained_user_denied")
} else if err.Id == "store.sql_team.get_member.missing.app_error" {
text = args.T("api.command_invite.user_not_in_team.app_error", map[string]interface{}{
"Username": userProfile.Username,
})
} else {
text = args.T("api.command_invite.fail.app_error")
}

View File

@@ -94,7 +94,7 @@ func TestInviteProvider(t *testing.T) {
},
{
desc: "try to add a user which is not part of the team",
expected: "api.command_invite.fail.app_error",
expected: "api.command_invite.user_not_in_team.app_error",
msg: basicUser4.Username,
},
{

View File

@@ -798,6 +798,10 @@
"id": "api.command_invite.user_already_in_channel.app_error",
"translation": "{{.User}} is already in the channel."
},
{
"id": "api.command_invite.user_not_in_team.app_error",
"translation": "@{{.Username}} is not a member of the team."
},
{
"id": "api.command_invite_people.permission.app_error",
"translation": "You don't have permission to invite new users to this server."