mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-03 13:04:51 -04:00
Add a constant for receipt types (m.read). (#11531)
And expand some type hints in the receipts storage module.
This commit is contained in:
parent
7ecaa3b976
commit
d93362d87f
9 changed files with 87 additions and 45 deletions
|
@ -16,7 +16,7 @@ import logging
|
|||
import re
|
||||
from typing import TYPE_CHECKING, Tuple
|
||||
|
||||
from synapse.api.constants import ReadReceiptEventFields
|
||||
from synapse.api.constants import ReadReceiptEventFields, ReceiptTypes
|
||||
from synapse.api.errors import Codes, SynapseError
|
||||
from synapse.http import get_request_user_agent
|
||||
from synapse.http.server import HttpServer
|
||||
|
@ -53,7 +53,7 @@ class ReceiptRestServlet(RestServlet):
|
|||
) -> Tuple[int, JsonDict]:
|
||||
requester = await self.auth.get_user_by_req(request)
|
||||
|
||||
if receipt_type != "m.read":
|
||||
if receipt_type != ReceiptTypes.READ:
|
||||
raise SynapseError(400, "Receipt type must be 'm.read'")
|
||||
|
||||
# Do not allow older SchildiChat and Element Android clients (prior to Element/1.[012].x) to send an empty body.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue