mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-30 10:58:31 -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?
|
if @user.blank?
|
||||||
@not_found = true
|
@not_found = true
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def perform_unsubscribe
|
def perform_unsubscribe
|
||||||
|
@ -87,7 +88,7 @@ class EmailController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
if params["disable_mailing_list"]
|
if params["disable_mailing_list"]
|
||||||
user.user_option.update_columns(email_always: false)
|
user.user_option.update_columns(mailing_list_mode: false)
|
||||||
updated = true
|
updated = true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,7 @@
|
||||||
<% end %>
|
<% end %>
|
||||||
<% 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>
|
<p>
|
||||||
<label>
|
<label>
|
||||||
<%= check_box_tag 'disable_mailing_list' %>
|
<%= check_box_tag 'disable_mailing_list' %>
|
||||||
|
|
|
@ -50,14 +50,14 @@ describe EmailController do
|
||||||
user = Fabricate(:user)
|
user = Fabricate(:user)
|
||||||
key = UnsubscribeKey.create_key_for(user, "all")
|
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"
|
post :perform_unsubscribe, key: key, disable_mailing_list: "1"
|
||||||
expect(response.status).to eq(302)
|
expect(response.status).to eq(302)
|
||||||
|
|
||||||
user.user_option.reload
|
user.user_option.reload
|
||||||
|
|
||||||
expect(user.user_option.email_always).to eq(false)
|
expect(user.user_option.mailing_list_mode).to eq(false)
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'can disable digest' do
|
it 'can disable digest' do
|
||||||
|
@ -136,7 +136,7 @@ describe EmailController do
|
||||||
user = Fabricate(:user)
|
user = Fabricate(:user)
|
||||||
key = UnsubscribeKey.create_key_for(user, "digest")
|
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
|
get :unsubscribe, key: key
|
||||||
expect(response.body).to include(I18n.t("unsubscribe.mailing_list_mode"))
|
expect(response.body).to include(I18n.t("unsubscribe.mailing_list_mode"))
|
||||||
|
@ -146,7 +146,7 @@ describe EmailController do
|
||||||
get :unsubscribe, key: key
|
get :unsubscribe, key: key
|
||||||
expect(response.body).not_to include(I18n.t("unsubscribe.mailing_list_mode"))
|
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
|
SiteSetting.disable_mailing_list_mode = false
|
||||||
|
|
||||||
get :unsubscribe, key: key
|
get :unsubscribe, key: key
|
||||||
|
|
Loading…
Reference in a new issue