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

feat: add email unsubscribe message #61

Merged

Conversation

MaferMazu
Copy link
Contributor

@MaferMazu MaferMazu commented Dec 16, 2024

Description

This PR adds a short message in the emails to allow users to unsubscribe to the newsletter in the recurringnudge_day3 and recurringnudge_day10.

Detailed changes:

  • Added a nudge_email_unsubscribe_message.html to store the message an reuse it in different templates.
  • Added a footer_extension in base_body.html, to be able to add elements in the footer of the emails using the email templates (e.g., recurringnudge_day3 and recurringnudge_day10)
  • Include the unsubscribe message in recurringnudge_day3 and recurringnudge_day10.
  • Added code in babel_mako.cfg to target ace_common Django template for translations.
  • Updated translations.

This is related to https://github.com/fccn/nau-technical/issues/279

How to test

  1. Have a Redwood development environment.
  2. Configure the theme
# Use this branch
git clone git@github.com:eduNEXT/nau-themes.git
cd nau-themes
git checkout mfmz/add-email-unsubscribe-message

# Copy the theme in build/openedx/themes/nau-basic
cp -r nau-themes/edx-platform/nau-basic "$(tutor config printroot)/env/build/openedx/themes/nau-basic"

# Set the nau-basic as the default theme
tutor dev do settheme nau-basic

# Enter in the LMS container and compile the theme:
npm run compile-sass -- --skip-default
  1. Create a new Schedule config for your site in {lms_domain}/admin/schedules/scheduleconfig/

    image

  2. Create a user and enroll it in a course.

  3. Send a message of recurring nudge using the following command in the LMS container:

python manage.py lms send_recurring_nudge {site} --date {enroll-date + 3 days}
# Example
python manage.py lms send_recurring_nudge local.edly.io:8000 --date 2024-12-19
  1. Check the emails in the LMS container:
cd /tmp/openedx/emails
ls
cat <the last email sent> #example: cat 20241216-230137-139785515122512.log

You can copy and paste the output into an email.html file to open it in your browser.

Test it in PT

Add the following configuration (for testing purposes, you can add it to your env/apps/openedx/config/lms.env.yml), then follow steps 5 and 6 from the previous instructions.

LANGUAGES: [
      ['pt-pt', 'Português'],  # Portuguese (Portugal)
      ['en', 'English']
]
LANGUAGE_CODE: "pt-pt"
COMPREHENSIVE_THEME_LOCALE_PATHS: ["/openedx/themes/nau-basic/conf/locale"]
LOCALE_PATHS: [ '/openedx/themes/nau-basic/conf/locale' ] + LOCALE_PATHS

Screenshot

Email en 3
image

Email pt 3
image

Email en 10
image

Email pt 10
image

Copy link
Member

@igobranco igobranco left a comment

Choose a reason for hiding this comment

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

Hi @MaferMazu we need to translate that message. Please replace the English text with a trans ...

@igobranco
Copy link
Member

@MaferMazu

Replace the portuguese translation:

"atualize as suas preferências de newsletter no seu"

With:

"atualize as suas preferências de newsletter nas"

It is better because of the gender of "Configurações de conta".

Meaning it should render like:

Se preferir não receber emails automáticos e manter apenas os essenciais, atualize as suas preferências de newsletter nas Configurações de conta

fix: update translations

refactor: improve the email unsubscribe message

fix: update translations
@MaferMazu
Copy link
Contributor Author

This is ready for a re-review @igobranco @BryanttV

Copy link

@BryanttV BryanttV left a comment

Choose a reason for hiding this comment

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

@MaferMazu, since we only affect specific templates could we update the PR description?

@MaferMazu MaferMazu requested a review from BryanttV December 24, 2024 20:12
@MaferMazu
Copy link
Contributor Author

I updated the PR description and applied your feedback @BryanttV; please let me know if you could test it and if it works as expected.

Copy link

@BryanttV BryanttV left a comment

Choose a reason for hiding this comment

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

Hi @MaferMazu, thanks for addressing my comments. I tested the changes and it works as expected!

Copy link

@BryanttV BryanttV left a comment

Choose a reason for hiding this comment

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

Hi @MaferMazu
I tested the changes in a remote environment and found that the link in the new message is incorrect. The base link should redirect to the lms and not to the homepage.

@MaferMazu
Copy link
Contributor Author

Thanks for that observation @BryanttV. I fixed it. I would like your re-review of this PR.

@MaferMazu MaferMazu requested a review from BryanttV January 2, 2025 16:57
Copy link
Member

@igobranco igobranco left a comment

Choose a reason for hiding this comment

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

LGTM ✔️

@igobranco igobranco merged commit e0bbd97 into fccn:nau/redwood.master Jan 3, 2025
3 checks passed
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