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

MNTOR-1800: unsubscribe from free monthly report #4988

Merged
merged 44 commits into from
Sep 5, 2024
Merged

MNTOR-1800: unsubscribe from free monthly report #4988

merged 44 commits into from
Sep 5, 2024

Conversation

mansaj
Copy link
Collaborator

@mansaj mansaj commented Aug 27, 2024

References:

Jira: MNTOR-3582

Description

  1. Util function for table subscriber_email_preferences
    The util funcs take care of the fetches and updates of email preferences. It gets the stored settings from 2 tables and consolidate them. Follow up work will be tracked in MNTOR-3557

  2. Util function to generate unsubscribe URL

  3. API endpoint to verify unsub url and unsub the user from monthly monitor reports

Screenshot (if applicable)

Not applicable.

How to test

  • get the output of console.info(generateUnsubscribeLink(session?.user.email || "")); on any page
  • visit that link
    • if the pref table is empty, a row will be created
    • if the pref table record already exists, it will check for the value of monthly_monitor_report_free value and change it to false if not

Checklist (Definition of Done)

  • Commits in this PR are minimal and have descriptive commit messages.
  • I've added or updated the relevant sections in readme and/or code comments
  • Product Owner accepted the User Story (demo of functionality completed) or waived the privilege.
  • All acceptance criteria are met.
  • Jira ticket has been updated (if needed) to match changes made during the development process.
  • Jira ticket has been updated (if needed) with suggestions for QA when this PR is deployed to stage.

@mansaj mansaj changed the title MNTOR-1800: MNTOR-1800: Part 2 - Util funcs for the email prefs table Aug 27, 2024
Copy link

@mansaj mansaj changed the title MNTOR-1800: Part 2 - Util funcs for the email prefs table MNTOR-1800: unsubscribe from free monthly report Aug 27, 2024
@mansaj mansaj requested a review from rhelmer August 27, 2024 22:26
@mansaj mansaj marked this pull request as ready for review August 27, 2024 22:27
@mansaj
Copy link
Collaborator Author

mansaj commented Aug 30, 2024

lgtm and wfm locally... I was going to say subscriber_email_preferences.primary_email should have a FK constraint on email_addresses or subscriber.primary_email, but I guess that we want to keep a record permanently of the email address that the user opted out of?

What happens if a user changes their primary email address, will they start getting these emails again?

Yea I thought about that too. I think it might be simpler to not have this dup field and just always do join... but it's going to be annoying since we need to request with email as a param often... and it's going to take a performance hit

We can also create a VIEW with these two tables.. that's probably what we should've done with subscribers and email_addresses also..

@mansaj
Copy link
Collaborator Author

mansaj commented Aug 30, 2024

@rhelmer got rid of primary_email in the new table to avoid syncing
9469811

@mansaj mansaj requested a review from rhelmer August 30, 2024 17:52
src/app/api/utils/email.tsx Outdated Show resolved Hide resolved
mansaj and others added 2 commits September 3, 2024 08:45
Since the user is not logged in, there is no extra information
given by passing in the email address, but it does add PII to our
request logs. Hence, just accepting the unsubscribe token might be
enough.
Base automatically changed from MNTOR-1800 to main September 5, 2024 15:45
@mansaj mansaj merged commit 6f6d021 into main Sep 5, 2024
15 checks passed
@mansaj mansaj deleted the MNTOR-1800-2 branch September 5, 2024 16:19
Copy link

github-actions bot commented Sep 5, 2024

Cleanup completed - database 'blurts-server-pr-4988' destroyed, cloud run service 'blurts-server-pr-4988' destroyed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants