Skip to content

Conversation

@shanbady
Copy link
Contributor

@shanbady shanbady commented Jul 24, 2024

What are the relevant tickets?

Closes https://github.com/mitodl/hq/issues/4890

Description (What does it do?)

This Pr updates the subscription email template according to https://github.com/mitodl/hq/issues/4890 figma

How can this be tested?

  1. Checkout this branch
  2. Subscribe to all the providers/units mitx, mitpe, ocw etc
  3. We need to manually set the "created_on" date for a bunch of learning resources so that the daily email task picks them up. to do this, go into django shell and run the following:

import datetime
from learning_resources.models import LearningResource
from learning_resources_search.tasks import send_subscription_emails

new_date = datetime.datetime.now() - datetime.timedelta(hours=5)
for obj in LearningResource.objects.all()[:100]:
	obj.created_on = new_date
	obj.save()
	print(obj.resource_type)
  1. next we need to configure email settings so we can send emails locally. Grab settings for email from rc and set the following in settings.py - EMAIL_HOST, EMAIL_HOST_PASSWORD ,EMAIL_HOST_USER ,DEFAULT_FROM_EMAIL ,EMAIL_SUPPORT ,EMAIL_PORT ,EMAIL_USE_TLS
  2. restart celery to pick up settings changes docker compose restart celery
  3. get into a django shell and manually trigger the daily subscription task:
from learning_resources_search.tasks import send_subscription_emails
send_subscription_emails("channel_subscription_type")

Additional Context

The email you receive during testing will have a broken logo image which is expected this gets deployed to a live environment.
Screenshot 2024-08-02 at 11 19 09 AM
Screenshot 2024-08-02 at 11 19 40 AM
Screenshot 2024-08-02 at 11 19 50 AM

Additionally, the links to unsubscribe and manage preferences will route to a currently non-existent page which is also expected until #1331 lands

@shanbady shanbady added Work in Progress Needs Review An open Pull Request that is ready for review and removed Work in Progress labels Jul 24, 2024
@shanbady shanbady marked this pull request as ready for review July 24, 2024 15:18
@shanbady shanbady marked this pull request as draft July 26, 2024 16:00
@shanbady shanbady added Work in Progress and removed Needs Review An open Pull Request that is ready for review labels Jul 26, 2024
@shanbady shanbady marked this pull request as ready for review August 2, 2024 15:30
@shanbady shanbady added Needs Review An open Pull Request that is ready for review and removed Work in Progress labels Aug 2, 2024
@shanbady
Copy link
Contributor Author

shanbady commented Aug 2, 2024

This PR is ready for review as-is however once #1331 lands I will need to resolve some overlapping changes. We also need #1349 to land so I can account for unpublished channels when sending emails

@abeglova abeglova self-assigned this Aug 5, 2024
Copy link
Contributor

@abeglova abeglova left a comment

Choose a reason for hiding this comment

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

👍

@shanbady shanbady merged commit 64cdc75 into main Aug 5, 2024
@shanbady shanbady deleted the shanbady/subscription-email-template-updates branch August 5, 2024 20:30
mbertrand pushed a commit that referenced this pull request Aug 6, 2024
* adding resource type

* conditionalizing subject line

* limiting list of resources to 5

* adding images to email

* fixing f-string

* template style fixes

* fixing logo

* formatting changes and adding footer

* adding url context to email templates and some style changes

* adding test

* fixing button float and adding background

* cloning model method utilities

* inferring channel urls for groups

* initial changes to send individual emails

* fixing view more url and checking for null in resource.image

* fixing subject line

* fixing footer urls

* capping at 10 items

* fixing saved search label

* fixing saved search type

* fix spacing

* fixing tests

* adding short subject in template and some style fixes

* fixing method

* updating dashboard settings url to match upcoming changes in pr #1348
@odlbot odlbot mentioned this pull request Aug 6, 2024
16 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Needs Review An open Pull Request that is ready for review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants