aboutsummaryrefslogtreecommitdiff
path: root/app/views/utils.py
diff options
context:
space:
mode:
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()