From ca714db4fd8ed8aad88b5e2205e99a72ec2bdfc8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E8=B5=B5=E6=99=BA=E8=B6=85?= <1012112796@qq.com>
Date: Fri, 10 Apr 2020 01:22:17 +0800
Subject: [PATCH] ui:Add flash notify for email preference seting success
 (#11027)

* Add flash notify for email preference seting success

Signed-off-by: a1012112796 <1012112796@qq.com>

* add review suggest changes

Co-authored-by: Lauris BH <lauris@nix.lv>

Co-Authored-By: Lauris BH <lauris@nix.lv>

Co-authored-by: Lauris BH <lauris@nix.lv>
---
 options/locale/locale_en-US.ini | 1 +
 routers/user/setting/account.go | 1 +
 2 files changed, 2 insertions(+)

diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini
index dfdae8f82b..2e0f07ada9 100644
--- a/options/locale/locale_en-US.ini
+++ b/options/locale/locale_en-US.ini
@@ -460,6 +460,7 @@ add_email = Add Email Address
 add_openid = Add OpenID URI
 add_email_confirmation_sent = A confirmation email has been sent to '%s'. Please check your inbox within the next %s to confirm your email address.
 add_email_success = The new email address has been added.
+email_preference_set_success = Email preference has been set successfully.
 add_openid_success = The new OpenID address has been added.
 keep_email_private = Hide Email Address
 keep_email_private_popup = Your email address will be hidden from other users.
diff --git a/routers/user/setting/account.go b/routers/user/setting/account.go
index 3c0c64ca27..27f0bf1c86 100644
--- a/routers/user/setting/account.go
+++ b/routers/user/setting/account.go
@@ -149,6 +149,7 @@ func EmailPost(ctx *context.Context, form auth.AddEmailForm) {
 			return
 		}
 		log.Trace("Email notifications preference made %s: %s", preference, ctx.User.Name)
+		ctx.Flash.Success(ctx.Tr("settings.email_preference_set_success"))
 		ctx.Redirect(setting.AppSubURL + "/user/settings/account")
 		return
 	}