mirror of
https://github.com/element-hq/synapse.git
synced 2024-11-24 02:25:45 +03:00
Incorporate review
This commit is contained in:
parent
e186c660b1
commit
fed493c5fd
1 changed files with 11 additions and 15 deletions
|
@ -40,15 +40,13 @@ DEFAULT_HIGHLIGHT_ACTION = [
|
||||||
|
|
||||||
|
|
||||||
@attr.s
|
@attr.s
|
||||||
class EventPushSummary(object):
|
class EventPushSummary:
|
||||||
"""Summary of pending event push actions for a given user in a given room."""
|
"""Summary of pending event push actions for a given user in a given room."""
|
||||||
|
|
||||||
user_id = attr.ib()
|
unread_count = attr.ib(type=int)
|
||||||
room_id = attr.ib()
|
stream_ordering = attr.ib(type=int)
|
||||||
unread_count = attr.ib()
|
old_user_id = attr.ib(type=str)
|
||||||
stream_ordering = attr.ib()
|
notif_count = attr.ib(type=int)
|
||||||
old_user_id = attr.ib()
|
|
||||||
notif_count = attr.ib()
|
|
||||||
|
|
||||||
|
|
||||||
def _serialize_action(actions, is_highlight):
|
def _serialize_action(actions, is_highlight):
|
||||||
|
@ -886,8 +884,6 @@ class EventPushActionsStore(EventPushActionsWorkerStore):
|
||||||
summaries = {} # type: Dict[Tuple[str, str], EventPushSummary]
|
summaries = {} # type: Dict[Tuple[str, str], EventPushSummary]
|
||||||
for row in txn:
|
for row in txn:
|
||||||
summaries[(row[0], row[1])] = EventPushSummary(
|
summaries[(row[0], row[1])] = EventPushSummary(
|
||||||
user_id=row[0],
|
|
||||||
room_id=row[1],
|
|
||||||
unread_count=row[2],
|
unread_count=row[2],
|
||||||
stream_ordering=row[3],
|
stream_ordering=row[3],
|
||||||
old_user_id=row[4],
|
old_user_id=row[4],
|
||||||
|
@ -915,13 +911,13 @@ class EventPushActionsStore(EventPushActionsWorkerStore):
|
||||||
table="event_push_summary",
|
table="event_push_summary",
|
||||||
values=[
|
values=[
|
||||||
{
|
{
|
||||||
"user_id": summary.user_id,
|
"user_id": user_id,
|
||||||
"room_id": summary.room_id,
|
"room_id": room_id,
|
||||||
"notif_count": summary.notif_count,
|
"notif_count": summary.notif_count,
|
||||||
"unread_count": summary.unread_count,
|
"unread_count": summary.unread_count,
|
||||||
"stream_ordering": summary.stream_ordering,
|
"stream_ordering": summary.stream_ordering,
|
||||||
}
|
}
|
||||||
for summary in summaries.values()
|
for ((user_id, room_id), summary) in summaries.items()
|
||||||
if summary.old_user_id is None
|
if summary.old_user_id is None
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
@ -937,10 +933,10 @@ class EventPushActionsStore(EventPushActionsWorkerStore):
|
||||||
summary.notif_count,
|
summary.notif_count,
|
||||||
summary.unread_count,
|
summary.unread_count,
|
||||||
summary.stream_ordering,
|
summary.stream_ordering,
|
||||||
summary.user_id,
|
user_id,
|
||||||
summary.room_id,
|
room_id,
|
||||||
)
|
)
|
||||||
for summary in summaries.values()
|
for ((user_id, room_id), summary) in summaries.items()
|
||||||
if summary.old_user_id is not None
|
if summary.old_user_id is not None
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in a new issue