Add missing fields to events

Fix Dialyzer issues
This commit is contained in:
Pim Kunis 2021-09-05 16:39:52 +02:00
parent 0871c3cdd9
commit 27c673e07a
13 changed files with 147 additions and 124 deletions

View file

@ -90,16 +90,23 @@ defmodule ArchitexWeb.Federation.EventController do
case RoomServer.get_room_server(room) do
{:ok, pid} ->
if RoomServer.server_in_room?(pid, origin) do
{state_events, auth_chain} =
# {state_events, auth_chain} =
data =
case state_or_state_ids do
:state -> RoomServer.get_state_at_event(pid, event)
:state_ids -> RoomServer.get_state_ids_at_event(pid, event)
end
:state ->
{state_events, auth_chain} = RoomServer.get_state_at_event(pid, event)
data = %{
auth_chain: auth_chain,
pdus: state_events
}
%{
auth_chain: Enum.map(auth_chain, &Architex.Event.Formatters.as_pdu/1),
pdus: Enum.map(state_events, &Architex.Event.Formatters.as_pdu/1)
}
:state_ids ->
{state_event_ids, auth_chain_ids} =
RoomServer.get_state_ids_at_event(pid, event)
%{auth_chain: auth_chain_ids, pdus: state_event_ids}
end
conn
|> put_status(200)