diff options
author | lain <lain@soykaf.club> | 2020-08-22 22:27:22 +0200 |
---|---|---|
committer | lain <lain@soykaf.club> | 2020-08-22 22:27:22 +0200 |
commit | 967856c784892fd1c7c88aee608931c29fcc5fff (patch) | |
tree | ba19458c83726b250f0f32e01ef00275237bd8f2 /lib | |
parent | d49fdb315f4ea1a03e22063b14ba804104b8527b (diff) | |
download | pleroma-967856c784892fd1c7c88aee608931c29fcc5fff.tar.gz |
MatrixController: Actually set the read marker.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/pleroma/web/matrix_controller.ex | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/pleroma/web/matrix_controller.ex b/lib/pleroma/web/matrix_controller.ex index 00f27924d..23c776ca6 100644 --- a/lib/pleroma/web/matrix_controller.ex +++ b/lib/pleroma/web/matrix_controller.ex @@ -428,7 +428,14 @@ defmodule Pleroma.Web.MatrixController do end # Just pretend it worked - def set_read_marker(conn, _) do + def set_read_marker(%{assigns: %{user: %{id: user_id}}} = conn, %{ + "m.fully_read" => read_up_to, + "room_id" => chat_id + }) do + with %Chat{user_id: ^user_id} = chat <- Chat.get_by_id(chat_id) do + MessageReference.set_all_seen_for_chat(chat, read_up_to) + end + conn |> json(%{}) end |