mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-06-09 06:42:40 -04:00
Additional constants for EDU types. (#12884)
Instead of hard-coding strings in many places.
This commit is contained in:
parent
d9f092285b
commit
c52abc1cfd
35 changed files with 146 additions and 96 deletions
|
@ -26,7 +26,7 @@ from typing import (
|
|||
cast,
|
||||
)
|
||||
|
||||
from synapse.api.constants import ReceiptTypes
|
||||
from synapse.api.constants import EduTypes, ReceiptTypes
|
||||
from synapse.replication.slave.storage._slaved_id_tracker import SlavedIdTracker
|
||||
from synapse.replication.tcp.streams import ReceiptsStream
|
||||
from synapse.storage._base import SQLBaseStore, db_to_json, make_in_list_sql_clause
|
||||
|
@ -363,7 +363,7 @@ class ReceiptsWorkerStore(SQLBaseStore):
|
|||
row["user_id"]
|
||||
] = db_to_json(row["data"])
|
||||
|
||||
return [{"type": "m.receipt", "room_id": room_id, "content": content}]
|
||||
return [{"type": EduTypes.RECEIPT, "room_id": room_id, "content": content}]
|
||||
|
||||
@cachedList(
|
||||
cached_method_name="_get_linearized_receipts_for_room",
|
||||
|
@ -411,7 +411,7 @@ class ReceiptsWorkerStore(SQLBaseStore):
|
|||
# receipts by room, event and type.
|
||||
room_event = results.setdefault(
|
||||
row["room_id"],
|
||||
{"type": "m.receipt", "room_id": row["room_id"], "content": {}},
|
||||
{"type": EduTypes.RECEIPT, "room_id": row["room_id"], "content": {}},
|
||||
)
|
||||
|
||||
# The content is of the form:
|
||||
|
@ -476,7 +476,7 @@ class ReceiptsWorkerStore(SQLBaseStore):
|
|||
# receipts by room, event and type.
|
||||
room_event = results.setdefault(
|
||||
row["room_id"],
|
||||
{"type": "m.receipt", "room_id": row["room_id"], "content": {}},
|
||||
{"type": EduTypes.RECEIPT, "room_id": row["room_id"], "content": {}},
|
||||
)
|
||||
|
||||
# The content is of the form:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue