mirror of
https://github.com/matrix-org/dendrite.git
synced 2026-01-16 10:33:11 -06:00
Tweaks to pagination
This commit is contained in:
parent
2a374fc272
commit
566bfae939
|
|
@ -45,6 +45,7 @@ func Setup(
|
|||
lazyLoadCache caching.LazyLoadCache,
|
||||
fts *fulltext.Search,
|
||||
) {
|
||||
v1mux := csMux.PathPrefix("/v1/").Subrouter()
|
||||
v3mux := csMux.PathPrefix("/{apiversion:(?:r0|v3)}/").Subrouter()
|
||||
|
||||
// TODO: Add AS support for all handlers below.
|
||||
|
|
@ -110,7 +111,7 @@ func Setup(
|
|||
}),
|
||||
).Methods(http.MethodGet, http.MethodOptions)
|
||||
|
||||
v3mux.Handle("/rooms/{roomId}/relations/{eventId}",
|
||||
v1mux.Handle("/rooms/{roomId}/relations/{eventId}",
|
||||
httputil.MakeAuthAPI(gomatrixserverlib.Join, userAPI, func(req *http.Request, device *userapi.Device) util.JSONResponse {
|
||||
vars, err := httputil.URLDecodeMapValues(mux.Vars(req))
|
||||
if err != nil {
|
||||
|
|
@ -124,7 +125,7 @@ func Setup(
|
|||
}),
|
||||
).Methods(http.MethodGet, http.MethodOptions)
|
||||
|
||||
v3mux.Handle("/rooms/{roomId}/relations/{eventId}/{relType}",
|
||||
v1mux.Handle("/rooms/{roomId}/relations/{eventId}/{relType}",
|
||||
httputil.MakeAuthAPI(gomatrixserverlib.Join, userAPI, func(req *http.Request, device *userapi.Device) util.JSONResponse {
|
||||
vars, err := httputil.URLDecodeMapValues(mux.Vars(req))
|
||||
if err != nil {
|
||||
|
|
@ -138,7 +139,7 @@ func Setup(
|
|||
}),
|
||||
).Methods(http.MethodGet, http.MethodOptions)
|
||||
|
||||
v3mux.Handle("/rooms/{roomId}/relations/{eventId}/{relType}/{eventType}",
|
||||
v1mux.Handle("/rooms/{roomId}/relations/{eventId}/{relType}/{eventType}",
|
||||
httputil.MakeAuthAPI(gomatrixserverlib.Join, userAPI, func(req *http.Request, device *userapi.Device) util.JSONResponse {
|
||||
vars, err := httputil.URLDecodeMapValues(mux.Vars(req))
|
||||
if err != nil {
|
||||
|
|
|
|||
|
|
@ -50,12 +50,12 @@ const deleteRelationSQL = "" +
|
|||
|
||||
const selectRelationsInRangeSQL = "" +
|
||||
"SELECT id, room_id, child_event_id, rel_type FROM syncapi_relations" +
|
||||
" WHERE room_id = $1 AND event_id = $2 AND id >= $3 AND id <= $4" +
|
||||
" WHERE room_id = $1 AND event_id = $2 AND id > $3 AND id <= $4" +
|
||||
" ORDER BY id DESC LIMIT $5"
|
||||
|
||||
const selectRelationsByTypeInRangeSQL = "" +
|
||||
"SELECT id, room_id, child_event_id, rel_type FROM syncapi_relations" +
|
||||
" WHERE room_id = $1 AND event_id = $2 AND rel_type = $3 AND id >= $4 AND id <= $5" +
|
||||
" WHERE room_id = $1 AND event_id = $2 AND rel_type = $3 AND id > $4 AND id <= $5" +
|
||||
" ORDER BY id DESC LIMIT $6"
|
||||
|
||||
const selectMaxRelationIDSQL = "" +
|
||||
|
|
|
|||
|
|
@ -636,7 +636,7 @@ func (d *DatabaseTransaction) RelationsFor(ctx context.Context, roomID, eventID,
|
|||
|
||||
// If there were no entries returned, there were no relations, so stop at this point.
|
||||
if len(entries) == 0 {
|
||||
return nil, "", "", nil
|
||||
return clientEvents, "", "", nil
|
||||
}
|
||||
|
||||
// Otherwise, let's try and work out what sensible prev_batch and next_batch values
|
||||
|
|
|
|||
|
|
@ -48,12 +48,12 @@ const deleteRelationSQL = "" +
|
|||
|
||||
const selectRelationsInRangeSQL = "" +
|
||||
"SELECT id, room_id, child_event_id, rel_type FROM syncapi_relations" +
|
||||
" WHERE room_id = $1 AND event_id = $2 AND id >= $3 AND id <= $4" +
|
||||
" WHERE room_id = $1 AND event_id = $2 AND id > $3 AND id <= $4" +
|
||||
" ORDER BY id DESC LIMIT $5"
|
||||
|
||||
const selectRelationsByTypeInRangeSQL = "" +
|
||||
"SELECT id, room_id, child_event_id, rel_type FROM syncapi_relations" +
|
||||
" WHERE room_id = $1 AND event_id = $2 AND rel_type = $3 AND id >= $4 AND id <= $5" +
|
||||
" WHERE room_id = $1 AND event_id = $2 AND rel_type = $3 AND id > $4 AND id <= $5" +
|
||||
" ORDER BY id DESC LIMIT $6"
|
||||
|
||||
const selectMaxRelationIDSQL = "" +
|
||||
|
|
|
|||
Loading…
Reference in a new issue