aboutsummaryrefslogtreecommitdiff
path: root/app/views/utils.py
diff options
context:
space:
mode:
authorrubenwardy <rw@rubenwardy.com>2018-05-13 17:55:28 +0100
committerrubenwardy <rw@rubenwardy.com>2018-05-13 18:04:07 +0100
commit4fdafefcd5b0267e3b9958f3dcc6b05a6eeb0906 (patch)
treeaa9aa3b351302353e2ff8eaf943654c0da22a15d /app/views/utils.py
parentf3c433de06e19ae9a6e1706b4746d46e6a33d70c (diff)
downloadcheatdb-4fdafefcd5b0267e3b9958f3dcc6b05a6eeb0906.tar.xz
Add notifications
Fixes #28
Diffstat (limited to 'app/views/utils.py')
-rw-r--r--app/views/utils.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/app/views/utils.py b/app/views/utils.py
index f22e874..345d5c1 100644
--- a/app/views/utils.py
+++ b/app/views/utils.py
@@ -91,3 +91,14 @@ def rank_required(rank):
return decorated_function
return decorator
+
+def triggerNotif(owner, causer, title, url):
+ if owner.rank.atLeast(UserRank.NEW_MEMBER) and owner != causer:
+ Notification.query.filter_by(user=owner, url=url).delete()
+ notif = Notification(owner, causer, title, url)
+ db.session.add(notif)
+
+def clearNotifications(url):
+ if current_user.is_authenticated:
+ Notification.query.filter_by(user=current_user, url=url).delete()
+ db.session.commit()