Skip to content

Commit 24b4df8

Browse files
authored
Merge pull request #159 from devinmatte/onesignal_notifications
Fixing Notifications and adding logging
2 parents e9f0284 + ec16f11 commit 24b4df8

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

packet/mail.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ def send_start_packet_mail(packet):
1616
template = 'mail/packet_start'
1717
msg.body = render_template(template + '.txt', packet=packet)
1818
msg.html = render_template(template + '.html', packet=packet)
19+
app.logger.info("Sending mail to " + recipients[0])
1920
mail.send(msg)
2021

2122

@@ -32,4 +33,5 @@ def send_report_mail(form_results, reporter):
3233
template = 'mail/report'
3334
msg.body = render_template(template + '.txt', person=person, report=report, reporter=reporter)
3435
msg.html = render_template(template + '.html', person=person, report=report, reporter=reporter)
36+
app.logger.info("Sending mail to " + recipients[0])
3537
mail.send(msg)

packet/notifications.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,8 @@
44
from packet.models import NotificationSubscription
55

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

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

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

0 commit comments

Comments
 (0)