diff --git a/app/controllers/account_controller.rb b/app/controllers/account_controller.rb index d1ac9c9c4..8bcb5f4d0 100644 --- a/app/controllers/account_controller.rb +++ b/app/controllers/account_controller.rb @@ -25,7 +25,7 @@ class AccountController < ApplicationController if @account.organization? 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, :email_on_proposal_notification, :newsletter) + params.require(:account).permit(:username, :public_activity, :email_on_comment, :email_on_comment_reply, :email_on_proposal_notification, :email_digest, :newsletter) end end diff --git a/app/views/account/show.html.erb b/app/views/account/show.html.erb index b3a84dede..2180ce5f9 100644 --- a/app/views/account/show.html.erb +++ b/app/views/account/show.html.erb @@ -78,6 +78,15 @@ <% end %> +
+ <%= f.label :email_digest do %> + <%= f.check_box :email_digest, title: t('account.show.email_digest_label'), label: false %> + + <%= t("account.show.email_digest_label") %> + + <% end %> +
+ <%= f.submit t("account.show.save_changes_submit"), class: "button" %> diff --git a/config/locales/en.yml b/config/locales/en.yml index c0a68815b..0051fef5c 100755 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -16,6 +16,7 @@ en: save_changes_submit: Save changes subscription_to_website_newsletter_label: Receive by email website relevant information email_on_proposal_notification_label: Receive by email notifications about proposals + email_digest_label: Receive a summary of proposal notifications title: My account user_permission_debates: Participate on debates user_permission_info: With your account you can... diff --git a/config/locales/es.yml b/config/locales/es.yml index 2354e4742..7898cbd65 100755 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -16,6 +16,7 @@ es: save_changes_submit: Guardar cambios subscription_to_website_newsletter_label: Recibir emails con información interesante sobre la web email_on_proposal_notification_label: Recibir emails con notificaciones sobre propuestas + email_digest_label: Recibir resumen de notificaciones sobre propuestas title: Mi cuenta user_permission_debates: Participar en debates user_permission_info: Con tu cuenta ya puedes... diff --git a/spec/features/account_spec.rb b/spec/features/account_spec.rb index f5ba747fb..f8ebf4e3a 100644 --- a/spec/features/account_spec.rb +++ b/spec/features/account_spec.rb @@ -36,6 +36,7 @@ feature 'Account' do check 'account_email_on_comment' check 'account_email_on_comment_reply' uncheck 'account_email_on_proposal_notification' + uncheck 'account_email_digest' click_button 'Save changes' expect(page).to have_content "Changes saved" @@ -45,7 +46,7 @@ feature 'Account' do expect(page).to have_selector("input[value='Larry Bird']") expect(find("#account_email_on_comment")).to be_checked expect(find("#account_email_on_comment_reply")).to be_checked - expect(find("#account_email_on_proposal_notification")).to_not be_checked + expect(find("#account_email_digest")).to_not be_checked end scenario 'Edit Organization' do diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index ca46ff68f..e9c05eeb3 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -89,6 +89,12 @@ describe User do expect(subject.email_on_proposal_notification).to eq(true) end end + + describe 'email_digest' do + it 'should be true by default' do + expect(subject.email_digest).to eq(true) + end + end end describe "administrator?" do