summary refs log tree commit diff
path: root/synapse/storage
diff options
context:
space:
mode:
authorMatthew Hodgson <matthew@arasphere.net>2016-09-09 00:09:51 +0100
committerGitHub <noreply@github.com>2016-09-09 00:09:51 +0100
commitb8f84f99ff3c645dde6ab6c0498b272bfcc325fe (patch)
treef6622c08ca7a33bf47c35748d773c19f6d55445f /synapse/storage
parentMerge pull request #1080 from matrix-org/dbkr/fix_notifications_api_with_from (diff)
parentImplement `only=highlight` on `/notifications` (diff)
downloadsynapse-b8f84f99ff3c645dde6ab6c0498b272bfcc325fe.tar.xz
Merge pull request #1081 from matrix-org/dbkr/notifications_only_highlight
Implement `only=highlight` on `/notifications`
Diffstat (limited to 'synapse/storage')
-rw-r--r--synapse/storage/event_push_actions.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/synapse/storage/event_push_actions.py b/synapse/storage/event_push_actions.py
index 56dce4b616..10e9305f7b 100644
--- a/synapse/storage/event_push_actions.py
+++ b/synapse/storage/event_push_actions.py
@@ -338,7 +338,8 @@ class EventPushActionsStore(SQLBaseStore):
         defer.returnValue(notifs[:limit])
 
     @defer.inlineCallbacks
-    def get_push_actions_for_user(self, user_id, before=None, limit=50):
+    def get_push_actions_for_user(self, user_id, before=None, limit=50,
+                                  only_highlight=False):
         def f(txn):
             before_clause = ""
             if before:
@@ -346,6 +347,12 @@ class EventPushActionsStore(SQLBaseStore):
                 args = [user_id, before, limit]
             else:
                 args = [user_id, limit]
+
+            if only_highlight:
+                if len(before_clause) > 0:
+                    before_clause += " "
+                before_clause += "AND epa.highlight = 1"
+
             sql = (
                 "SELECT epa.event_id, epa.room_id,"
                 " epa.stream_ordering, epa.topological_ordering,"