Commit 8a7f0224 by E. Kolpakov Committed by Jonathan Piacenti

Fixed email notifications enable/disable

parent 40be656e
...@@ -261,10 +261,7 @@ if Backbone? ...@@ -261,10 +261,7 @@ if Backbone?
url: url url: url
type: "GET" type: "GET"
success: (response, textStatus) => success: (response, textStatus) =>
if response.status $('input.email-setting').prop('checked', response.status)
$('input.email-setting').attr('checked','checked')
else
$('input.email-setting').removeAttr('checked')
#select all threads #select all threads
isBrowseMenuVisible: => isBrowseMenuVisible: =>
...@@ -516,17 +513,11 @@ if Backbone? ...@@ -516,17 +513,11 @@ if Backbone?
@retrieveFirstPage() @retrieveFirstPage()
updateEmailNotifications: () => updateEmailNotifications: () =>
if $('input.email-setting').attr('checked') checkbox = $('input.email-setting')
DiscussionUtil.safeAjax checked = checkbox.prop('checked')
url: DiscussionUtil.urlFor("enable_notifications") url_name = if checked then "enable_notifications" else "disable_notifications"
type: "POST" DiscussionUtil.safeAjax
error: () => url: DiscussionUtil.urlFor(url_name)
$('input.email-setting').removeAttr('checked') type: "POST"
else error: () =>
DiscussionUtil.safeAjax checkbox.prop('checked', !checked)
url: DiscussionUtil.urlFor("disable_notifications")
type: "POST"
error: () =>
$('input.email-setting').attr('checked','checked')
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment