Commit a3fa9404 authored by HERBERT Ryan's avatar HERBERT Ryan

controllers/ added message read tracking to avoid displaying...

controllers/ added message read tracking to avoid displaying message users have already seen
parent db6b6fa1
......@@ -23,6 +23,15 @@ def index():
def info():
query = db.notification[request.vars['id']]
if auth.user:
rows = db((
if len(rows) == 0:
return dict(query=query)
......@@ -89,6 +98,7 @@ def edit():
# process submitted edit form
def edit_form():
#TODO delete parameters associated (would enable reusing messages)
if (not auth.is_admin()):
res = {"message": ACCESS_DENIED}
......@@ -143,16 +153,30 @@ def delete():
def get_active_notifications():
today =
log.error('auth: ' + str(auth))
user_id = if auth.user else None
if (request.vars['type'] is not None):
query = db(
((db.notification.expiration >= today)
| (db.notification.expiration == None))
& (db.notification.message_type == request.vars['type'])
db.notification.ALL, db.user_preference.val,
else :
query = db(
(db.notification.expiration >= today) | (db.notification.expiration == None)
db.notification.ALL, db.user_preference.val,
query = query.find(lambda row: row.user_preference.val is None)
#TODO sanitize this response
return query.as_json()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment