Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
synapse
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Monitor
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Maunium
synapse
Commits
95f3fcda
Commit
95f3fcda
authored
5 years ago
by
Erik Johnston
Browse files
Options
Downloads
Patches
Plain Diff
Check that event is visible in new APIs
parent
b5c62c6b
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
synapse/rest/client/v2_alpha/relations.py
+15
-2
15 additions, 2 deletions
synapse/rest/client/v2_alpha/relations.py
tests/rest/client/v2_alpha/test_relations.py
+1
-1
1 addition, 1 deletion
tests/rest/client/v2_alpha/test_relations.py
with
16 additions
and
3 deletions
synapse/rest/client/v2_alpha/relations.py
+
15
−
2
View file @
95f3fcda
...
...
@@ -131,6 +131,7 @@ class RelationPaginationServlet(RestServlet):
self
.
store
=
hs
.
get_datastore
()
self
.
clock
=
hs
.
get_clock
()
self
.
_event_serializer
=
hs
.
get_event_client_serializer
()
self
.
event_handler
=
hs
.
get_event_handler
()
@defer.inlineCallbacks
def
on_GET
(
self
,
request
,
room_id
,
parent_id
,
relation_type
=
None
,
event_type
=
None
):
...
...
@@ -140,6 +141,10 @@ class RelationPaginationServlet(RestServlet):
room_id
,
requester
.
user
.
to_string
()
)
# This checks that a) the event exists and b) the user is allowed to
# view it.
yield
self
.
event_handler
.
get_event
(
requester
.
user
,
room_id
,
parent_id
)
limit
=
parse_integer
(
request
,
"
limit
"
,
default
=
5
)
from_token
=
parse_string
(
request
,
"
from
"
)
to_token
=
parse_string
(
request
,
"
to
"
)
...
...
@@ -195,6 +200,7 @@ class RelationAggregationPaginationServlet(RestServlet):
super
(
RelationAggregationPaginationServlet
,
self
).
__init__
()
self
.
auth
=
hs
.
get_auth
()
self
.
store
=
hs
.
get_datastore
()
self
.
event_handler
=
hs
.
get_event_handler
()
@defer.inlineCallbacks
def
on_GET
(
self
,
request
,
room_id
,
parent_id
,
relation_type
=
None
,
event_type
=
None
):
...
...
@@ -204,6 +210,10 @@ class RelationAggregationPaginationServlet(RestServlet):
room_id
,
requester
.
user
.
to_string
()
)
# This checks that a) the event exists and b) the user is allowed to
# view it.
yield
self
.
event_handler
.
get_event
(
requester
.
user
,
room_id
,
parent_id
)
if
relation_type
not
in
(
RelationTypes
.
ANNOTATION
,
None
):
raise
SynapseError
(
400
,
"
Relation type must be
'
annotation
'"
)
...
...
@@ -258,6 +268,7 @@ class RelationAggregationGroupPaginationServlet(RestServlet):
self
.
store
=
hs
.
get_datastore
()
self
.
clock
=
hs
.
get_clock
()
self
.
_event_serializer
=
hs
.
get_event_client_serializer
()
self
.
event_handler
=
hs
.
get_event_handler
()
@defer.inlineCallbacks
def
on_GET
(
self
,
request
,
room_id
,
parent_id
,
relation_type
,
event_type
,
key
):
...
...
@@ -267,6 +278,10 @@ class RelationAggregationGroupPaginationServlet(RestServlet):
room_id
,
requester
.
user
.
to_string
()
)
# This checks that a) the event exists and b) the user is allowed to
# view it.
yield
self
.
event_handler
.
get_event
(
requester
.
user
,
room_id
,
parent_id
)
if
relation_type
!=
RelationTypes
.
ANNOTATION
:
raise
SynapseError
(
400
,
"
Relation type must be
'
annotation
'"
)
...
...
@@ -296,8 +311,6 @@ class RelationAggregationGroupPaginationServlet(RestServlet):
defer
.
returnValue
((
200
,
return_value
))
defer
.
returnValue
((
200
,
return_value
))
def
register_servlets
(
hs
,
http_server
):
RelationSendServlet
(
hs
).
register
(
http_server
)
...
...
This diff is collapsed.
Click to expand it.
tests/rest/client/v2_alpha/test_relations.py
+
1
−
1
View file @
95f3fcda
...
...
@@ -296,7 +296,7 @@ class RelationsTestCase(unittest.HomeserverTestCase):
request
,
channel
=
self
.
make_request
(
"
GET
"
,
"
/_matrix/client/unstable/rooms/%s/aggregations/m.replace
s/%s
?limit=1
"
"
/_matrix/client/unstable/rooms/%s/aggregations/
%s/
m.replace?limit=1
"
%
(
self
.
room
,
self
.
parent_id
),
)
self
.
render
(
request
)
...
...
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