@@ -158,19 +158,21 @@ async def on_GET(
158
158
event = await self .event_handler .get_event (requester .user , room_id , parent_id )
159
159
160
160
limit = parse_integer (request , "limit" , default = 5 )
161
- from_token = parse_string (request , "from" )
162
- to_token = parse_string (request , "to" )
161
+ from_token_str = parse_string (request , "from" )
162
+ to_token_str = parse_string (request , "to" )
163
163
164
164
if event .internal_metadata .is_redacted ():
165
165
# If the event is redacted, return an empty list of relations
166
166
pagination_chunk = PaginationChunk (chunk = [])
167
167
else :
168
168
# Return the relations
169
- if from_token :
170
- from_token = RelationPaginationToken .from_string (from_token )
169
+ from_token = None
170
+ if from_token_str :
171
+ from_token = RelationPaginationToken .from_string (from_token_str )
171
172
172
- if to_token :
173
- to_token = RelationPaginationToken .from_string (to_token )
173
+ to_token = None
174
+ if to_token_str :
175
+ to_token = RelationPaginationToken .from_string (to_token_str )
174
176
175
177
pagination_chunk = await self .store .get_relations_for_event (
176
178
event_id = parent_id ,
@@ -256,19 +258,21 @@ async def on_GET(
256
258
raise SynapseError (400 , "Relation type must be 'annotation'" )
257
259
258
260
limit = parse_integer (request , "limit" , default = 5 )
259
- from_token = parse_string (request , "from" )
260
- to_token = parse_string (request , "to" )
261
+ from_token_str = parse_string (request , "from" )
262
+ to_token_str = parse_string (request , "to" )
261
263
262
264
if event .internal_metadata .is_redacted ():
263
265
# If the event is redacted, return an empty list of relations
264
266
pagination_chunk = PaginationChunk (chunk = [])
265
267
else :
266
268
# Return the relations
267
- if from_token :
268
- from_token = AggregationPaginationToken .from_string (from_token )
269
+ from_token = None
270
+ if from_token_str :
271
+ from_token = AggregationPaginationToken .from_string (from_token_str )
269
272
270
- if to_token :
271
- to_token = AggregationPaginationToken .from_string (to_token )
273
+ to_token = None
274
+ if to_token_str :
275
+ to_token = AggregationPaginationToken .from_string (to_token_str )
272
276
273
277
pagination_chunk = await self .store .get_aggregation_groups_for_event (
274
278
event_id = parent_id ,
@@ -336,14 +340,16 @@ async def on_GET(self, request, room_id, parent_id, relation_type, event_type, k
336
340
raise SynapseError (400 , "Relation type must be 'annotation'" )
337
341
338
342
limit = parse_integer (request , "limit" , default = 5 )
339
- from_token = parse_string (request , "from" )
340
- to_token = parse_string (request , "to" )
343
+ from_token_str = parse_string (request , "from" )
344
+ to_token_str = parse_string (request , "to" )
341
345
342
- if from_token :
343
- from_token = RelationPaginationToken .from_string (from_token )
346
+ from_token = None
347
+ if from_token_str :
348
+ from_token = RelationPaginationToken .from_string (from_token_str )
344
349
345
- if to_token :
346
- to_token = RelationPaginationToken .from_string (to_token )
350
+ to_token = None
351
+ if to_token_str :
352
+ to_token = RelationPaginationToken .from_string (to_token_str )
347
353
348
354
result = await self .store .get_relations_for_event (
349
355
event_id = parent_id ,
0 commit comments