Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions packet/mail.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ def send_start_packet_mail(packet):
template = 'mail/packet_start'
msg.body = render_template(template + '.txt', packet=packet)
msg.html = render_template(template + '.html', packet=packet)
app.logger.info("Sending mail to " + recipients[0])
mail.send(msg)


Expand All @@ -32,4 +33,5 @@ def send_report_mail(form_results, reporter):
template = 'mail/report'
msg.body = render_template(template + '.txt', person=person, report=report, reporter=reporter)
msg.html = render_template(template + '.html', person=person, report=report, reporter=reporter)
app.logger.info("Sending mail to " + recipients[0])
mail.send(msg)
7 changes: 3 additions & 4 deletions packet/notifications.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@
from packet.models import NotificationSubscription

post_body = {
"content": {"en": "Default message"},
"contents": {"en": "Default message"},
"headings": {"en": "Default Title"},
"included_segments": ["Active Users", "Inactive Users"],
"chrome_web_icon": app.config["PROTOCOL"] + app.config["SERVER_NAME"] + "/static/android-chrome-512x512.png",
"chrome_web_badge": app.config["PROTOCOL"] + app.config["SERVER_NAME"] + "/static/android-chrome-512x512.png",
"url": app.config["PROTOCOL"] + app.config["SERVER_NAME"]
Expand All @@ -19,7 +18,7 @@ def packet_signed_notification(packet, signer):
tokens = list(map(lambda subscription: subscription.token, subscriptions))

notification = onesignal.Notification(post_body=post_body)
notification.post_body["content"]["en"] = signer + ' signed your packet! Congrats or I\'m Sorry'
notification.post_body["contents"]["en"] = signer + ' signed your packet! Congrats or I\'m Sorry'
notification.post_body["headings"]["en"] = 'New Packet Signature!'
notification.post_body["chrome_web_icon"] = 'https://profiles.csh.rit.edu/image/' + signer
notification.post_body["include_player_ids"] = tokens
Expand All @@ -35,7 +34,7 @@ def packet_100_percent_notification(packet):
tokens = list(map(lambda subscription: subscription.token, subscriptions))

notification = onesignal.Notification(post_body=post_body)
notification.post_body["content"]["en"] = packet.freshman.name + ' got 💯 on packet!'
notification.post_body["contents"]["en"] = packet.freshman.name + ' got 💯 on packet!'
notification.post_body["headings"]["en"] = 'New 100% on Packet!'
# TODO: Issue #156
notification.post_body["chrome_web_icon"] = 'https://profiles.csh.rit.edu/image/' + packet.freshman_username
Expand Down