mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-27 09:36:19 -05:00
Correct mailing list mode unsubscribe
This commit is contained in:
parent
aee7489a5a
commit
dd1a184955
3 changed files with 7 additions and 6 deletions
|
@ -43,6 +43,7 @@ class EmailController < ApplicationController
|
|||
if @user.blank?
|
||||
@not_found = true
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
def perform_unsubscribe
|
||||
|
@ -87,7 +88,7 @@ class EmailController < ApplicationController
|
|||
end
|
||||
|
||||
if params["disable_mailing_list"]
|
||||
user.user_option.update_columns(email_always: false)
|
||||
user.user_option.update_columns(mailing_list_mode: false)
|
||||
updated = true
|
||||
end
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<% if @user.user_option.email_always && !SiteSetting.disable_mailing_list_mode %>
|
||||
<% if @user.user_option.mailing_list_mode && !SiteSetting.disable_mailing_list_mode %>
|
||||
<p>
|
||||
<label>
|
||||
<%= check_box_tag 'disable_mailing_list' %>
|
||||
|
|
|
@ -50,14 +50,14 @@ describe EmailController do
|
|||
user = Fabricate(:user)
|
||||
key = UnsubscribeKey.create_key_for(user, "all")
|
||||
|
||||
user.user_option.update_columns(email_always: true)
|
||||
user.user_option.update_columns(mailing_list_mode: true)
|
||||
|
||||
post :perform_unsubscribe, key: key, disable_mailing_list: "1"
|
||||
expect(response.status).to eq(302)
|
||||
|
||||
user.user_option.reload
|
||||
|
||||
expect(user.user_option.email_always).to eq(false)
|
||||
expect(user.user_option.mailing_list_mode).to eq(false)
|
||||
end
|
||||
|
||||
it 'can disable digest' do
|
||||
|
@ -136,7 +136,7 @@ describe EmailController do
|
|||
user = Fabricate(:user)
|
||||
key = UnsubscribeKey.create_key_for(user, "digest")
|
||||
|
||||
user.user_option.update_columns(email_always: true)
|
||||
user.user_option.update_columns(mailing_list_mode: true)
|
||||
|
||||
get :unsubscribe, key: key
|
||||
expect(response.body).to include(I18n.t("unsubscribe.mailing_list_mode"))
|
||||
|
@ -146,7 +146,7 @@ describe EmailController do
|
|||
get :unsubscribe, key: key
|
||||
expect(response.body).not_to include(I18n.t("unsubscribe.mailing_list_mode"))
|
||||
|
||||
user.user_option.update_columns(email_always: false)
|
||||
user.user_option.update_columns(mailing_list_mode: false)
|
||||
SiteSetting.disable_mailing_list_mode = false
|
||||
|
||||
get :unsubscribe, key: key
|
||||
|
|
Loading…
Reference in a new issue