Verified Commit 35076e87 authored by Nicolas's avatar Nicolas

Remove unused variables

move modules attributes
parent a942636a
......@@ -2,9 +2,6 @@ defmodule PlasmaHS.RoomServer.Auth do
@moduledoc """
Event authentication functions
"""
@matrix_config Application.get_env(:plasma, :matrix)
@supported_room_versions @matrix_config[:supported_room_versions]
require PlasmaHS.EventTypes
require Logger
......@@ -22,6 +19,9 @@ defmodule PlasmaHS.RoomServer.Auth do
end
defmodule Module.concat(PlasmaHS.RoomServer.Auth, "5") do
@matrix_config Application.get_env(:plasma, :matrix)
@supported_room_versions @matrix_config[:supported_room_versions]
def auth_event(room_state, %{event_type: PlasmaHS.EventTypes.m_room_create} = event) do
with parents when parents == [] <- event.parent_events,
:ok <- room_domain_match_user_domain(room_state, event),
......@@ -33,14 +33,14 @@ defmodule PlasmaHS.RoomServer.Auth do
end
end
defp creator_event_content_creator_present(_state, %{content: event_content} = create_event) do
defp creator_event_content_creator_present(_state, %{content: event_content}) do
case Map.get(event_content, :creator) do
nil -> {:rejected, "content has no creator field"}
_ -> :ok
end
end
defp create_event_content_room_version_supported(_state, %{content: event_content} = create_event) do
defp create_event_content_room_version_supported(_state, %{content: event_content}) do
case Map.get(event_content, "room_version") do
nil -> :ok
room_version -> if Enum.member?(@supported_room_versions, room_version) do
......@@ -76,9 +76,7 @@ defmodule PlasmaHS.RoomServer.Auth do
apply(module, :auth_event, [room_state, event])
rescue
error -> Logger.warn("Error calling auth_event on module #{module}: #{inspect error}")
:error
{:ok, Map.merge(event, %{rejected: true, rejection_cause: "unsupported room version: '#{room_version}'"})}
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment