@@ -35,15 +35,14 @@ const (
3535
3636// Account renders change user's password, user's email and user suicide page
3737func Account (ctx * context.Context ) {
38- if user_model .IsFeatureDisabledWithLoginType (ctx .Doer , setting .UserFeatureManageCredentials , setting .UserFeatureDeletion ) && ! setting . Service . EnableNotifyMail {
38+ if user_model .IsFeatureDisabledWithLoginType (ctx .Doer , setting .UserFeatureManageCredentials , setting .UserFeatureDeletion ) {
3939 ctx .NotFound (errors .New ("account setting are not allowed to be changed" ))
4040 return
4141 }
4242
4343 ctx .Data ["Title" ] = ctx .Tr ("settings.account" )
4444 ctx .Data ["PageIsSettingsAccount" ] = true
4545 ctx .Data ["Email" ] = ctx .Doer .Email
46- ctx .Data ["EnableNotifyMail" ] = setting .Service .EnableNotifyMail
4746
4847 loadAccountData (ctx )
4948
@@ -61,7 +60,6 @@ func AccountPost(ctx *context.Context) {
6160 ctx .Data ["Title" ] = ctx .Tr ("settings" )
6261 ctx .Data ["PageIsSettingsAccount" ] = true
6362 ctx .Data ["Email" ] = ctx .Doer .Email
64- ctx .Data ["EnableNotifyMail" ] = setting .Service .EnableNotifyMail
6563
6664 if ctx .HasError () {
6765 loadAccountData (ctx )
@@ -112,7 +110,6 @@ func EmailPost(ctx *context.Context) {
112110 ctx .Data ["Title" ] = ctx .Tr ("settings" )
113111 ctx .Data ["PageIsSettingsAccount" ] = true
114112 ctx .Data ["Email" ] = ctx .Doer .Email
115- ctx .Data ["EnableNotifyMail" ] = setting .Service .EnableNotifyMail
116113
117114 // Make email address primary.
118115 if ctx .FormString ("_method" ) == "PRIMARY" {
@@ -172,30 +169,6 @@ func EmailPost(ctx *context.Context) {
172169 ctx .Redirect (setting .AppSubURL + "/user/settings/account" )
173170 return
174171 }
175- // Set Email Notification Preference
176- if ctx .FormString ("_method" ) == "NOTIFICATION" {
177- preference := ctx .FormString ("preference" )
178- if ! (preference == user_model .EmailNotificationsEnabled ||
179- preference == user_model .EmailNotificationsOnMention ||
180- preference == user_model .EmailNotificationsDisabled ||
181- preference == user_model .EmailNotificationsAndYourOwn ) {
182- log .Error ("Email notifications preference change returned unrecognized option %s: %s" , preference , ctx .Doer .Name )
183- ctx .ServerError ("SetEmailPreference" , errors .New ("option unrecognized" ))
184- return
185- }
186- opts := & user.UpdateOptions {
187- EmailNotificationsPreference : optional .Some (preference ),
188- }
189- if err := user .UpdateUser (ctx , ctx .Doer , opts ); err != nil {
190- log .Error ("Set Email Notifications failed: %v" , err )
191- ctx .ServerError ("UpdateUser" , err )
192- return
193- }
194- log .Trace ("Email notifications preference made %s: %s" , preference , ctx .Doer .Name )
195- ctx .Flash .Success (ctx .Tr ("settings.email_preference_set_success" ))
196- ctx .Redirect (setting .AppSubURL + "/user/settings/account" )
197- return
198- }
199172
200173 if ctx .HasError () {
201174 loadAccountData (ctx )
@@ -267,7 +240,6 @@ func DeleteAccount(ctx *context.Context) {
267240 ctx .Data ["Title" ] = ctx .Tr ("settings" )
268241 ctx .Data ["PageIsSettingsAccount" ] = true
269242 ctx .Data ["Email" ] = ctx .Doer .Email
270- ctx .Data ["EnableNotifyMail" ] = setting .Service .EnableNotifyMail
271243
272244 if _ , _ , err := auth .UserSignIn (ctx , ctx .Doer .Name , ctx .FormString ("password" )); err != nil {
273245 switch {
@@ -342,7 +314,6 @@ func loadAccountData(ctx *context.Context) {
342314 emails [i ] = & email
343315 }
344316 ctx .Data ["Emails" ] = emails
345- ctx .Data ["EmailNotificationsPreference" ] = ctx .Doer .EmailNotificationsPreference
346317 ctx .Data ["ActivationsPending" ] = pendingActivation
347318 ctx .Data ["CanAddEmails" ] = ! pendingActivation || ! setting .Service .RegisterEmailConfirm
348319 ctx .Data ["UserDisabledFeatures" ] = user_model .DisabledFeaturesWithLoginType (ctx .Doer )
0 commit comments