summary refs log tree commit diff
path: root/synapse
diff options
context:
space:
mode:
authorDavid Baker <dave@matrix.org>2016-06-22 17:47:18 +0100
committerDavid Baker <dave@matrix.org>2016-06-22 17:47:18 +0100
commit3a4120e49a15f27368a231b32245e32a4ccadb06 (patch)
tree5c2f6ae51a925ee69534dd6ebf9c653f884169bc /synapse
parentMerge pull request #843 from mweinelt/ldap3-rewrite (diff)
downloadsynapse-3a4120e49a15f27368a231b32245e32a4ccadb06.tar.xz
Put most recent 20 messages in notif
Fixes https://github.com/vector-im/vector-web/issues/1648
Diffstat (limited to '')
-rw-r--r--synapse/storage/event_push_actions.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/synapse/storage/event_push_actions.py b/synapse/storage/event_push_actions.py
index 940e11d7a2..5aaaf4b19d 100644
--- a/synapse/storage/event_push_actions.py
+++ b/synapse/storage/event_push_actions.py
@@ -152,7 +152,7 @@ class EventPushActionsStore(SQLBaseStore):
             if max_stream_ordering is not None:
                 sql += " AND ep.stream_ordering <= ?"
                 args.append(max_stream_ordering)
-            sql += " ORDER BY ep.stream_ordering ASC LIMIT ?"
+            sql += " ORDER BY ep.stream_ordering DESC LIMIT ?"
             args.append(limit)
             txn.execute(sql, args)
             return txn.fetchall()
@@ -176,7 +176,8 @@ class EventPushActionsStore(SQLBaseStore):
             if max_stream_ordering is not None:
                 sql += " AND ep.stream_ordering <= ?"
                 args.append(max_stream_ordering)
-            sql += " ORDER BY ep.stream_ordering ASC"
+            sql += " ORDER BY ep.stream_ordering DESC LIMIT ?"
+            args.append(limit)
             txn.execute(sql, args)
             return txn.fetchall()
         no_read_receipt = yield self.runInteraction(
@@ -191,7 +192,7 @@ class EventPushActionsStore(SQLBaseStore):
                 "actions": json.loads(row[3]),
                 "received_ts": row[4],
             } for row in after_read_receipt + no_read_receipt
-        ])
+        ][0:limit])
 
     @defer.inlineCallbacks
     def get_time_of_last_push_action_before(self, stream_ordering):