Merge branch 'manage_email_notifications'
This commit is contained in:
@@ -23,9 +23,9 @@ class AccountController < ApplicationController
|
||||
|
||||
def account_params
|
||||
if @account.organization?
|
||||
params.require(:account).permit(:phone_number, :email_on_comment, :email_on_comment_reply, organization_attributes: [:name, :responsible_name])
|
||||
params.require(:account).permit(:phone_number, :email_on_comment, :email_on_comment_reply, :newsletter, organization_attributes: [:name, :responsible_name])
|
||||
else
|
||||
params.require(:account).permit(:username, :public_activity, :email_on_comment, :email_on_comment_reply)
|
||||
params.require(:account).permit(:username, :public_activity, :email_on_comment, :email_on_comment_reply, :newsletter)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -54,6 +54,13 @@
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<%= f.label :email_newsletter_subscribed do %>
|
||||
<%= f.check_box :newsletter, label: false %>
|
||||
<span class="checkbox"><%= t("account.show.subscription_to_website_newsletter_label") %></span>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<%= f.submit t("account.show.save_changes_submit"), class: "button radius" %>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -15,4 +15,8 @@
|
||||
<p style="border-left: 2px solid #DEE0E3;font-family: 'Open Sans','Helvetica Neue',arial,sans-serif;font-size: 14px;font-style: italic;font-weight: normal;line-height: 24px;margin-left: 20px;padding: 10px;">
|
||||
<%= text_with_links @comment.body %>
|
||||
</p>
|
||||
|
||||
<p style="font-family: 'Open Sans','Helvetica Neue',arial,sans-serif;font-size: 12px;font-weight: normal;line-height: 20px;">
|
||||
<%= t("mailers.config.manage_email_subscriptions") %> <%= link_to t("account.show.title"), account_url, style: "color: #2895F1; text-decoration:none;" %>
|
||||
</p>
|
||||
</td>
|
||||
|
||||
@@ -15,4 +15,8 @@
|
||||
<p style="border-left: 2px solid #DEE0E3;font-family: 'Open Sans','Helvetica Neue',arial,sans-serif;font-size: 14px;font-style: italic;font-weight: normal;line-height: 24px;margin-left: 20px;padding: 10px;">
|
||||
<%= text_with_links @reply.body %>
|
||||
</p>
|
||||
|
||||
<p style="font-family: 'Open Sans','Helvetica Neue',arial,sans-serif;font-size: 12px;font-weight: normal;line-height: 20px;">
|
||||
<%= t("mailers.config.manage_email_subscriptions") %> <%= link_to t("account.show.title"), account_url, style: "color: #2895F1; text-decoration:none;" %>
|
||||
</p>
|
||||
</td>
|
||||
|
||||
@@ -291,6 +291,7 @@ en:
|
||||
public_activity_label: "Keep my list of activities public"
|
||||
email_on_comment_label: "Notify me by email when someone comments on my proposals or debates"
|
||||
email_on_comment_reply_label: "Notify me by email when someone replies to my comments"
|
||||
subscription_to_website_newsletter_label: "Receive by email website relevant information"
|
||||
erase_account_link: "Erase my account"
|
||||
personal: "Personal details"
|
||||
username_label: "Username"
|
||||
|
||||
@@ -291,6 +291,7 @@ es:
|
||||
public_activity_label: "Mostrar públicamente mi lista de actividades"
|
||||
email_on_comment_label: "Recibir un email cuando alguien comenta en mis propuestas o debates"
|
||||
email_on_comment_reply_label: "Recibir un email cuando alguien contesta a mis comentarios"
|
||||
subscription_to_website_newsletter_label: "Recibir emails con información interesante sobre la web"
|
||||
erase_account_link: "Darme de baja"
|
||||
personal: "Datos personales"
|
||||
username_label: "Nombre de usuario"
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
en:
|
||||
mailers:
|
||||
config:
|
||||
manage_email_subscriptions: "To stop receiving these emails change your settings in"
|
||||
comment:
|
||||
subject: "Someone has commented on your %{commentable}"
|
||||
hi: "Hi"
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
es:
|
||||
mailers:
|
||||
config:
|
||||
manage_email_subscriptions: "Puedes dejar de recibir estos emails cambiando tu configuración en"
|
||||
comment:
|
||||
subject: "Alguien ha comentado en tu %{commentable}"
|
||||
hi: "Hola"
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
class AddNewsletterSubscriptionToUsers < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :users, :newsletter, :boolean, default: false
|
||||
end
|
||||
end
|
||||
@@ -11,7 +11,7 @@
|
||||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 20151111202657) do
|
||||
ActiveRecord::Schema.define(version: 20151215165824) do
|
||||
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "plpgsql"
|
||||
@@ -309,6 +309,7 @@ ActiveRecord::Schema.define(version: 20151111202657) do
|
||||
t.string "erase_reason"
|
||||
t.datetime "erased_at"
|
||||
t.boolean "public_activity", default: true
|
||||
t.boolean "newsletter", default: false
|
||||
end
|
||||
|
||||
add_index "users", ["confirmation_token"], name: "index_users_on_confirmation_token", unique: true, using: :btree
|
||||
|
||||
@@ -63,6 +63,8 @@ feature 'Emails' do
|
||||
expect(email).to have_subject('Someone has commented on your debate')
|
||||
expect(email).to deliver_to(debate.author)
|
||||
expect(email).to have_body_text(debate_path(debate))
|
||||
expect(email).to have_body_text(I18n.t("mailers.config.manage_email_subscriptions"))
|
||||
expect(email).to have_body_text(account_path)
|
||||
end
|
||||
|
||||
scenario 'Do not send email about own debate comments', :js do
|
||||
@@ -91,6 +93,8 @@ feature 'Emails' do
|
||||
expect(email).to have_subject('Someone has responded to your comment')
|
||||
expect(email).to deliver_to(user)
|
||||
expect(email).to have_body_text(debate_path(Comment.first.commentable))
|
||||
expect(email).to have_body_text(I18n.t("mailers.config.manage_email_subscriptions"))
|
||||
expect(email).to have_body_text(account_path)
|
||||
end
|
||||
|
||||
scenario "Do not send email about own replies to own comments", :js do
|
||||
|
||||
@@ -77,6 +77,12 @@ describe User do
|
||||
expect(subject.email_on_comment_reply).to eq(false)
|
||||
end
|
||||
end
|
||||
|
||||
describe 'subscription_to_website_newsletter' do
|
||||
it 'should be false by default' do
|
||||
expect(subject.newsletter).to eq(false)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe 'OmniAuth' do
|
||||
|
||||
Reference in New Issue
Block a user