diff options
author | S7evinK <2353100+S7evinK@users.noreply.github.com> | 2022-02-21 17:12:22 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-21 17:12:22 +0100 |
commit | cf525d1f619cc65df244c20ec0f220ace22ae2bd (patch) | |
tree | 40e72b7e7da95956892d45e1613ad7eae206d147 /syncapi/routing/routing.go | |
parent | 280e9b19a195e3ce19f0fa5bc0e94bb09e397a23 (diff) |
Implement `/context` (#2207)
* Add QueryEventsAfter
* Add /context
* Make all tests pass on sqlite
* Add queries to get the events for /context requests
* Move /context to the syncapi
* Revert "Add QueryEventsAfter"
This reverts commit 440a771d10632622e8c65d35fe90f0804bc98862.
* Simplify getting the required events
* Apply RoomEventFilter when getting events
* Add passing tests
* Remove logging
* Remove unused SQL statements
Update comments & add TODO
Diffstat (limited to 'syncapi/routing/routing.go')
-rw-r--r-- | syncapi/routing/routing.go | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/syncapi/routing/routing.go b/syncapi/routing/routing.go index 005a3355..be366ba1 100644 --- a/syncapi/routing/routing.go +++ b/syncapi/routing/routing.go @@ -77,4 +77,19 @@ func Setup( v3mux.Handle("/keys/changes", httputil.MakeAuthAPI("keys_changes", userAPI, func(req *http.Request, device *userapi.Device) util.JSONResponse { return srp.OnIncomingKeyChangeRequest(req, device) })).Methods(http.MethodGet, http.MethodOptions) + + v3mux.Handle("/rooms/{roomId}/context/{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 { + return util.ErrorResponse(err) + } + + return Context( + req, device, + rsAPI, syncDB, + vars["roomId"], vars["eventId"], + ) + }), + ).Methods(http.MethodGet, http.MethodOptions) } |