[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
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
df0bb8aaa0
Коммит
b208bbc43e
@@ -143,6 +143,10 @@ func (me *InviteProvider) DoCommand(a *App, args *model.CommandArgs, message str
|
|||||||
var text string
|
var text string
|
||||||
if err.Id == "api.channel.add_members.user_denied" {
|
if err.Id == "api.channel.add_members.user_denied" {
|
||||||
text = args.T("api.command_invite.group_constrained_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 {
|
} else {
|
||||||
text = args.T("api.command_invite.fail.app_error")
|
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",
|
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,
|
msg: basicUser4.Username,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -798,6 +798,10 @@
|
|||||||
"id": "api.command_invite.user_already_in_channel.app_error",
|
"id": "api.command_invite.user_already_in_channel.app_error",
|
||||||
"translation": "{{.User}} is already in the channel."
|
"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",
|
"id": "api.command_invite_people.permission.app_error",
|
||||||
"translation": "You don't have permission to invite new users to this server."
|
"translation": "You don't have permission to invite new users to this server."
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user