[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
Этот коммит содержится в:
Shota Gvinepadze
2019-10-31 12:49:50 +04:00
коммит произвёл GitHub
родитель df0bb8aaa0
Коммит b208bbc43e
3 изменённых файлов: 9 добавлений и 1 удалений

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

@@ -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")
}

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

@@ -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,
},
{

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

@@ -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."