Skip to content

Commit

Permalink
Fix missing translations when updating username. (#3564)
Browse files Browse the repository at this point in the history
* Fix missing translations when updating username.

* Fix reserved username translated string test.

* Fix 'username reserved' string test a bit more.
  • Loading branch information
bugreport0 authored and lafriks committed Feb 25, 2018
1 parent fc265b0 commit 521945a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion integrations/user_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ func TestRenameReservedUsername(t *testing.T) {
htmlDoc := NewHTMLParser(t, resp.Body)
assert.Contains(t,
htmlDoc.doc.Find(".ui.negative.message").Text(),
i18n.Tr("en", "user.newName_reserved"),
i18n.Tr("en", "user.form.name_reserved", reservedUsername),
)

models.AssertNotExistsBean(t, &models.User{Name: reservedUsername})
Expand Down
6 changes: 3 additions & 3 deletions routers/user/setting.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,16 +61,16 @@ func handleUsernameChange(ctx *context.Context, newName string) {
if err := models.ChangeUserName(ctx.User, newName); err != nil {
switch {
case models.IsErrUserAlreadyExist(err):
ctx.Flash.Error(ctx.Tr("newName_been_taken"))
ctx.Flash.Error(ctx.Tr("form.username_been_taken"))
ctx.Redirect(setting.AppSubURL + "/user/settings")
case models.IsErrEmailAlreadyUsed(err):
ctx.Flash.Error(ctx.Tr("form.email_been_used"))
ctx.Redirect(setting.AppSubURL + "/user/settings")
case models.IsErrNameReserved(err):
ctx.Flash.Error(ctx.Tr("user.newName_reserved"))
ctx.Flash.Error(ctx.Tr("user.form.name_reserved", newName))
ctx.Redirect(setting.AppSubURL + "/user/settings")
case models.IsErrNamePatternNotAllowed(err):
ctx.Flash.Error(ctx.Tr("user.newName_pattern_not_allowed"))
ctx.Flash.Error(ctx.Tr("user.form.name_pattern_not_allowed", newName))
ctx.Redirect(setting.AppSubURL + "/user/settings")
default:
ctx.ServerError("ChangeUserName", err)
Expand Down

0 comments on commit 521945a

Please sign in to comment.