diff options
author | lain <lain@soykaf.club> | 2020-08-22 23:40:16 +0200 |
---|---|---|
committer | lain <lain@soykaf.club> | 2020-08-22 23:40:16 +0200 |
commit | d0e965cd9756a05131ebffa78a79be6731b335e7 (patch) | |
tree | 769a4a6fa475b0557358721bfcda81a3c1c1b2d3 | |
parent | 1ddb55a6d23cb01c2ed4940782fcacd86a56e23f (diff) | |
download | pleroma-d0e965cd9756a05131ebffa78a79be6731b335e7.tar.gz |
MatrixController: Always give information on all rooms
Otherwise element (iOS) will start thinking all DM chats are rooms
-rw-r--r-- | lib/pleroma/web/matrix_controller.ex | 8 | ||||
-rw-r--r-- | test/web/matrix_controller_test.exs | 2 |
2 files changed, 3 insertions, 7 deletions
diff --git a/lib/pleroma/web/matrix_controller.ex b/lib/pleroma/web/matrix_controller.ex index cb2e6df73..a767c7cdb 100644 --- a/lib/pleroma/web/matrix_controller.ex +++ b/lib/pleroma/web/matrix_controller.ex @@ -292,16 +292,12 @@ defmodule Pleroma.Web.MatrixController do } } - if length(messages) > 0 do - Map.merge(acc, room) - else - acc - end + Map.merge(acc, room) end) most_recent_cmr_id = Enum.reduce(chats, nil, fn {_k, chat}, acc -> - id = List.last(chat.timeline.events).event_id + id = List.last(chat.timeline.events)[:event_id] if !acc || (acc && acc < id) do id diff --git a/test/web/matrix_controller_test.exs b/test/web/matrix_controller_test.exs index ec24855e0..0a74ea9f4 100644 --- a/test/web/matrix_controller_test.exs +++ b/test/web/matrix_controller_test.exs @@ -118,7 +118,7 @@ defmodule Pleroma.Web.MatrixControllerTest do |> get("_matrix/client/r0/sync?since=#{cmr_two.id}") |> json_response(200) - refute joined_rooms[chat_two.id] + assert joined_rooms[chat_two.id] assert chat_room = joined_rooms[chat.id] assert [message] = chat_room["timeline"]["events"] assert message["content"]["body"] == "morning weebs" |