mirror of
https://git.anonymousland.org/anonymousland/synapse-product.git
synced 2024-12-17 15:14:20 -05:00
Incorporate review
This commit is contained in:
parent
e186c660b1
commit
fed493c5fd
@ -40,15 +40,13 @@ DEFAULT_HIGHLIGHT_ACTION = [
|
||||
|
||||
|
||||
@attr.s
|
||||
class EventPushSummary(object):
|
||||
class EventPushSummary:
|
||||
"""Summary of pending event push actions for a given user in a given room."""
|
||||
|
||||
user_id = attr.ib()
|
||||
room_id = attr.ib()
|
||||
unread_count = attr.ib()
|
||||
stream_ordering = attr.ib()
|
||||
old_user_id = attr.ib()
|
||||
notif_count = attr.ib()
|
||||
unread_count = attr.ib(type=int)
|
||||
stream_ordering = attr.ib(type=int)
|
||||
old_user_id = attr.ib(type=str)
|
||||
notif_count = attr.ib(type=int)
|
||||
|
||||
|
||||
def _serialize_action(actions, is_highlight):
|
||||
@ -886,8 +884,6 @@ class EventPushActionsStore(EventPushActionsWorkerStore):
|
||||
summaries = {} # type: Dict[Tuple[str, str], EventPushSummary]
|
||||
for row in txn:
|
||||
summaries[(row[0], row[1])] = EventPushSummary(
|
||||
user_id=row[0],
|
||||
room_id=row[1],
|
||||
unread_count=row[2],
|
||||
stream_ordering=row[3],
|
||||
old_user_id=row[4],
|
||||
@ -915,13 +911,13 @@ class EventPushActionsStore(EventPushActionsWorkerStore):
|
||||
table="event_push_summary",
|
||||
values=[
|
||||
{
|
||||
"user_id": summary.user_id,
|
||||
"room_id": summary.room_id,
|
||||
"user_id": user_id,
|
||||
"room_id": room_id,
|
||||
"notif_count": summary.notif_count,
|
||||
"unread_count": summary.unread_count,
|
||||
"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
|
||||
],
|
||||
)
|
||||
@ -937,10 +933,10 @@ class EventPushActionsStore(EventPushActionsWorkerStore):
|
||||
summary.notif_count,
|
||||
summary.unread_count,
|
||||
summary.stream_ordering,
|
||||
summary.user_id,
|
||||
summary.room_id,
|
||||
user_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
|
||||
),
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user