Add missing fields to events
Fix Dialyzer issues
This commit is contained in:
parent
0871c3cdd9
commit
27c673e07a
13 changed files with 147 additions and 124 deletions
|
@ -229,11 +229,7 @@ defmodule ArchitexWeb.Client.RoomController do
|
|||
end
|
||||
end
|
||||
|
||||
# GET /_matrix/client/r0/rooms/!atYDsyowueiToUvuqY:localhost:4000/messages
|
||||
# Parameters: %{"dir" => "b", "from" => "", "limit" => "727", "path" => ["_matrix", "client", "r0", "rooms", "!atYDsyowueiToUvuqY:localhost:4000", "messages"]}
|
||||
def messages(%Conn{assigns: %{account: account}} = conn, %{"room_id" => room_id} = params) do
|
||||
# IO.inspect(Messages.changeset(%Messages{}, params))
|
||||
|
||||
with {:ok, request} <- Messages.parse(params) do
|
||||
room_query =
|
||||
account
|
||||
|
|
|
@ -6,13 +6,13 @@ defmodule ArchitexWeb.Client.Request.CreateRoom do
|
|||
alias Ecto.Changeset
|
||||
|
||||
@type t :: %__MODULE__{
|
||||
visibility: String.t(),
|
||||
room_alias_name: String.t(),
|
||||
name: String.t(),
|
||||
topic: String.t(),
|
||||
invite: list(String.t()),
|
||||
room_version: String.t(),
|
||||
preset: String.t()
|
||||
visibility: String.t() | nil,
|
||||
room_alias_name: String.t() | nil,
|
||||
name: String.t() | nil,
|
||||
topic: String.t() | nil,
|
||||
invite: list(String.t()) | nil,
|
||||
room_version: String.t() | nil,
|
||||
preset: String.t() | nil
|
||||
}
|
||||
|
||||
@primary_key false
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -8,7 +8,7 @@ defmodule ArchitexWeb.Federation.Transaction do
|
|||
@type t :: %__MODULE__{
|
||||
origin: String.t(),
|
||||
origin_server_ts: integer(),
|
||||
pdus: [Event.t()],
|
||||
pdus: [map()],
|
||||
edus: [edu()] | nil
|
||||
}
|
||||
|
||||
|
@ -29,7 +29,7 @@ defmodule ArchitexWeb.Federation.Transaction do
|
|||
%Transaction{
|
||||
origin: Architex.server_name(),
|
||||
origin_server_ts: System.os_time(:millisecond),
|
||||
pdus: Enum.map(pdu_events, &Architex.to_serializable_map/1),
|
||||
pdus: Enum.map(pdu_events, &Architex.Event.Formatters.as_pdu/1),
|
||||
edus: edus
|
||||
}
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue