aboutsummaryrefslogtreecommitdiff
path: root/clientapi/routing/routing.go
diff options
context:
space:
mode:
authorLoïck Bonniot <git@lesterpig.com>2020-10-09 10:15:35 +0200
committerGitHub <noreply@github.com>2020-10-09 09:15:35 +0100
commitf3e8ae01efb0abd0904509ddaa2ae85017ca4aa5 (patch)
treef69009e4664e1ac9d50bfaf707236f2a3d63249d /clientapi/routing/routing.go
parent009401ad4df2e8f5c0c2f08b8c73f807e99b2c13 (diff)
Implement fully read markers (#1475)
See #653 Signed-off-by: Loïck Bonniot <git@lesterpig.com> Co-authored-by: Kegsay <kegan@matrix.org>
Diffstat (limited to 'clientapi/routing/routing.go')
-rw-r--r--clientapi/routing/routing.go9
1 files changed, 6 insertions, 3 deletions
diff --git a/clientapi/routing/routing.go b/clientapi/routing/routing.go
index 8606f69c..b547efb4 100644
--- a/clientapi/routing/routing.go
+++ b/clientapi/routing/routing.go
@@ -695,12 +695,15 @@ func Setup(
).Methods(http.MethodGet, http.MethodOptions)
r0mux.Handle("/rooms/{roomID}/read_markers",
- httputil.MakeExternalAPI("rooms_read_markers", func(req *http.Request) util.JSONResponse {
+ httputil.MakeAuthAPI("rooms_read_markers", userAPI, func(req *http.Request, device *userapi.Device) util.JSONResponse {
if r := rateLimits.rateLimit(req); r != nil {
return *r
}
- // TODO: return the read_markers.
- return util.JSONResponse{Code: http.StatusOK, JSON: struct{}{}}
+ vars, err := httputil.URLDecodeMapValues(mux.Vars(req))
+ if err != nil {
+ return util.ErrorResponse(err)
+ }
+ return SaveReadMarker(req, userAPI, rsAPI, syncProducer, device, vars["roomID"])
}),
).Methods(http.MethodPost, http.MethodOptions)