Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include link to unsubscribe in email notifications #4301

Merged
merged 12 commits into from
Jan 21, 2022
Merged

Conversation

taitus
Copy link
Member

@taitus taitus commented Dec 29, 2020

Objectives

Allow users to unsubscribe from email notifications through an "Unsubscribe" link in the footer of the email without the need to log in.
This link will take them to a unsubscribe page where they can manage the notifications they want to receive.

Visual Changes

Captura de pantalla 2021-02-02 a las 11 02 17

@javierm javierm added this to Reviewing in Consul Democracy via automation Dec 29, 2020
@javierm javierm moved this from Reviewing to Doing in Consul Democracy Dec 29, 2020
@taitus taitus force-pushed the unsubscribe branch 3 times, most recently from 71aacc6 to 7d9689f Compare February 2, 2021 09:58
@taitus taitus marked this pull request as ready for review February 2, 2021 10:02
@taitus taitus moved this from Doing to Reviewing in Consul Democracy Feb 2, 2021
@javierm javierm removed the post-1.3 label Apr 23, 2021
spec/models/user_spec.rb Outdated Show resolved Hide resolved
Copy link
Member

@javierm javierm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@taitus Here's an initial review. Let me know what you think! 😉

app/controllers/unsubscribes_controller.rb Outdated Show resolved Hide resolved
app/controllers/unsubscribes_controller.rb Outdated Show resolved Hide resolved
config/routes/unsubscribe.rb Outdated Show resolved Hide resolved
lib/tasks/users.rake Outdated Show resolved Hide resolved
db/schema.rb Outdated Show resolved Hide resolved
app/models/user.rb Outdated Show resolved Hide resolved
app/views/mailer/comment.html.erb Outdated Show resolved Hide resolved
@taitus taitus force-pushed the unsubscribe branch 3 times, most recently from 287d758 to aceb842 Compare January 19, 2022 14:04
@taitus taitus moved this from Doing to Reviewing in Consul Democracy Jan 21, 2022
@taitus taitus requested a review from javierm January 21, 2022 09:47
Copy link
Member

@javierm javierm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably my final review here; just found a couple of typos and a possible cause of flaky tests. I'm gonna miss this pull request 😄.

spec/models/user_spec.rb Outdated Show resolved Hide resolved
spec/models/user_spec.rb Outdated Show resolved Hide resolved
spec/system/subscriptions_spec.rb Outdated Show resolved Hide resolved
spec/mailers/mailer_spec.rb Outdated Show resolved Hide resolved
spec/mailers/mailer_spec.rb Outdated Show resolved Hide resolved
Consul Democracy automation moved this from Reviewing to Doing Jan 21, 2022
Note that we only update a user with a new token if the user has not
yet been assigned one.
The user can access this page without being logged in.
We identify the user through the "subscriptions_token" parameter and
show a list of the notifications that can be enable/disable.

We will return a 404 error in case someone accesses the page with a
non-existent token.

We also control the case that some anonymous user tries to access the
page without any token, by returning the CanCan::AccessDenied exception.
@taitus taitus moved this from Doing to Reviewing in Consul Democracy Jan 21, 2022
@taitus taitus requested a review from javierm January 21, 2022 17:59
You can update the same "notifications" section that we allow you to
update in "my account".

This "subscriptions" section differs from the "my account" section
because we do not need to be logged in to update the status of the
notifications.
We modified the link that previously redirected us to the "My content"
page to redirect us to the new page for managing subscriptions.

We also adapted the existing generic text by adding a description of
the related notification.
We modified the link that previously redirected us to the "My content"
page to redirect us to the new page for managing subscriptions.
We modified the link that previously redirected us to the "My content"
page to redirect us to the new page for managing subscriptions.
I think the "slashes" can be removed.
The specs work fine without the "slashes".
We modified the link that previously redirected us to the "My content"
page to redirect us to the new page for managing subscriptions.

We also adapted the existing generic text by adding a description of
the related notification.
We add new method set_user_locale to render the page
with the user's preferred locale.

Note that we add a condition 'if params[:locale].blank?'
to recover the user's preferred locale. This is necessary
because it may be the case that the user does not have an
associated locale, and when execute '@user.locale' when
this value is 'nil', by default returns the default locale.
As we do not want this to happen and we want the locale we
receive as parameter to prevail in this case.
Currently the translation:
"Notify me by email when someone comments on my proposals or debates"
It only refers to proposals and debates, but actually it also refers to budget
investments, topics and polls.
Consul Democracy automation moved this from Reviewing to Testing Jan 21, 2022
@javierm javierm merged commit 3e89a1d into master Jan 21, 2022
Consul Democracy automation moved this from Testing to Release 1.5.0 Jan 21, 2022
@javierm javierm deleted the unsubscribe branch January 21, 2022 19:43
@javierm javierm added the UX label Jan 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants