MatrixController: Always give information on all rooms

Otherwise element (iOS) will start thinking all DM chats are rooms
This commit is contained in:
lain 2020-08-22 23:40:16 +02:00
parent 1ddb55a6d2
commit d0e965cd97
2 changed files with 3 additions and 7 deletions

View File

@ -292,16 +292,12 @@ def sync(%{assigns: %{user: user}} = conn, params) 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

View File

@ -118,7 +118,7 @@ test "given a `since` option, it only returns chat messages after that point", %
|> 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"