Fix missing translations when updating username. (#3564)
* Fix missing translations when updating username. * Fix reserved username translated string test. * Fix 'username reserved' string test a bit more.
This commit is contained in:
parent
fc265b036f
commit
521945a2d2
2 changed files with 4 additions and 4 deletions
|
@ -92,7 +92,7 @@ func TestRenameReservedUsername(t *testing.T) {
|
||||||
htmlDoc := NewHTMLParser(t, resp.Body)
|
htmlDoc := NewHTMLParser(t, resp.Body)
|
||||||
assert.Contains(t,
|
assert.Contains(t,
|
||||||
htmlDoc.doc.Find(".ui.negative.message").Text(),
|
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})
|
models.AssertNotExistsBean(t, &models.User{Name: reservedUsername})
|
||||||
|
|
|
@ -61,16 +61,16 @@ func handleUsernameChange(ctx *context.Context, newName string) {
|
||||||
if err := models.ChangeUserName(ctx.User, newName); err != nil {
|
if err := models.ChangeUserName(ctx.User, newName); err != nil {
|
||||||
switch {
|
switch {
|
||||||
case models.IsErrUserAlreadyExist(err):
|
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")
|
ctx.Redirect(setting.AppSubURL + "/user/settings")
|
||||||
case models.IsErrEmailAlreadyUsed(err):
|
case models.IsErrEmailAlreadyUsed(err):
|
||||||
ctx.Flash.Error(ctx.Tr("form.email_been_used"))
|
ctx.Flash.Error(ctx.Tr("form.email_been_used"))
|
||||||
ctx.Redirect(setting.AppSubURL + "/user/settings")
|
ctx.Redirect(setting.AppSubURL + "/user/settings")
|
||||||
case models.IsErrNameReserved(err):
|
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")
|
ctx.Redirect(setting.AppSubURL + "/user/settings")
|
||||||
case models.IsErrNamePatternNotAllowed(err):
|
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")
|
ctx.Redirect(setting.AppSubURL + "/user/settings")
|
||||||
default:
|
default:
|
||||||
ctx.ServerError("ChangeUserName", err)
|
ctx.ServerError("ChangeUserName", err)
|
||||||
|
|
Reference in a new issue