aboutsummaryrefslogtreecommitdiff
path: root/lib/pleroma/web/matrix_controller.ex
diff options
context:
space:
mode:
Diffstat (limited to 'lib/pleroma/web/matrix_controller.ex')
-rw-r--r--lib/pleroma/web/matrix_controller.ex13
1 files changed, 12 insertions, 1 deletions
diff --git a/lib/pleroma/web/matrix_controller.ex b/lib/pleroma/web/matrix_controller.ex
index 11cb57142..d02d5859b 100644
--- a/lib/pleroma/web/matrix_controller.ex
+++ b/lib/pleroma/web/matrix_controller.ex
@@ -276,8 +276,19 @@ defmodule Pleroma.Web.MatrixController do
Map.merge(acc, room)
end)
+ most_recent_cmr_id =
+ Enum.reduce(chats, nil, fn {_k, chat}, acc ->
+ id = List.first(chat.timeline.events).event_id
+
+ if !acc || (acc && acc < id) do
+ id
+ else
+ acc
+ end
+ end)
+
data = %{
- next_batch: "next",
+ next_batch: most_recent_cmr_id,
rooms: %{
join: chats,
invite: %{},