-
Notifications
You must be signed in to change notification settings - Fork 0
Add script to send out email reminder to update club pages #32
Conversation
if not resp.ok: | ||
self.stdout.write(self.style.ERROR('{} has broken image {}'.format(club.id, club.image.url))) | ||
image_ok = False | ||
if club.image.url.startswith('http'): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: if a club has an image served over http and not https it is a security vulnerability and the browser will raise some complaints with the https cert for the website. Any way we could make them swap over to https?
Also, depending on how many images are originally defined but then down the line the URL no longer points to the asset, do we think it could be worth moving to storing images in like S3? Obv not something we'd tackle in this PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We actually should be fine with the http/https thing, since we already self-host all of their images on S3 already. The only case where the image URL is not hosted/controlled by us was during the Groups Online @ Penn import script.
The check in the code is more for local development environment vs production environment, in the local environment you can't properly do a requests.head
because the server isn't running in the management script.
@@ -0,0 +1,20 @@ | |||
{% extends 'emails/base.txt' %} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be great down the line to have a markdown to txt and to html engine. Not sure how hard that would be to set up with the email template but would be good to be more DRY
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, a simpler alternative solution would just be to strip the HTML tags from the HTML response and use that for the text response.
However, there are some slight differences, for example links in HTML can actually be links, but in the text version we tell the user to go to some URL.
I agree, somewhere down the line we could avoid a lot of duplication by combining the HTML and non-HTML templates.
./manage.py remind
command to send out an email to all active clubs reminding them to update their club pages.