Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Matrix
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Container Registry
Model registry
Operate
Environments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TeDomum
Matrix
Commits
c5969b34
Unverified
Commit
c5969b34
authored
2 years ago
by
Erik Johnston
Committed by
GitHub
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Don't error on unknown receipt types (#12670)
Fixes #12669
parent
77258b67
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
changelog.d/12670.feature
+1
-0
1 addition, 0 deletions
changelog.d/12670.feature
synapse/rest/client/read_marker.py
+15
-12
15 additions, 12 deletions
synapse/rest/client/read_marker.py
with
16 additions
and
12 deletions
changelog.d/12670.feature
0 → 100644
+
1
−
0
View file @
c5969b34
Implement [changes](https
:
//github.com/matrix-org/matrix-spec-proposals/pull/2285/commits/4a77139249c2e830aec3c7d6bd5501a514d1cc27) to [MSC2285 (hidden read receipts)](https
:
//github.com/matrix-org/matrix-spec-proposals/pull/2285).
Contributed
by
@SimonBrandner.
This diff is collapsed.
Click to expand it.
synapse/rest/client/read_marker.py
+
15
−
12
View file @
c5969b34
...
...
@@ -16,7 +16,6 @@ import logging
from
typing
import
TYPE_CHECKING
,
Tuple
from
synapse.api.constants
import
ReceiptTypes
from
synapse.api.errors
import
SynapseError
from
synapse.http.server
import
HttpServer
from
synapse.http.servlet
import
RestServlet
,
parse_json_object_from_request
from
synapse.http.site
import
SynapseRequest
...
...
@@ -50,17 +49,21 @@ class ReadMarkerRestServlet(RestServlet):
body
=
parse_json_object_from_request
(
request
)
valid_receipt_types
=
{
ReceiptTypes
.
READ
,
ReceiptTypes
.
FULLY_READ
}
if
self
.
config
.
experimental
.
msc2285_enabled
:
valid_receipt_types
.
add
(
ReceiptTypes
.
READ_PRIVATE
)
if
set
(
body
.
keys
())
>
valid_receipt_types
:
raise
SynapseError
(
400
,
"
Receipt type must be
'
m.read
'
,
'
org.matrix.msc2285.read.private
'
or
'
m.fully_read
'"
if
self
.
config
.
experimental
.
msc2285_enabled
else
"
Receipt type must be
'
m.read
'
or
'
m.fully_read
'"
,
)
valid_receipt_types
=
{
ReceiptTypes
.
READ
,
ReceiptTypes
.
FULLY_READ
,
ReceiptTypes
.
READ_PRIVATE
,
}
unrecognized_types
=
set
(
body
.
keys
())
-
valid_receipt_types
if
unrecognized_types
:
# It's fine if there are unrecognized receipt types, but let's log
# it to help debug clients that have typoed the receipt type.
#
# We specifically *don't* error here, as a) it stops us processing
# the valid receipts, and b) we need to be extensible on receipt
# types.
logger
.
info
(
"
Ignoring unrecognized receipt types: %s
"
,
unrecognized_types
)
read_event_id
=
body
.
get
(
ReceiptTypes
.
READ
,
None
)
if
read_event_id
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment