Verified Commit 820013c2 authored by Nicolas's avatar Nicolas

Codes refactoring + create RoomServer

parent 17f955c8
......@@ -8,13 +8,13 @@
use Mix.Config
# Configures the endpoint
config :plasma, PlasmaHS.Endpoint,
config :plasma, PlasmaWeb.Endpoint,
url: [host: "localhost"],
secret_key_base: "82piCs325d914i67U4IWFnQ3iJloRjVnkyD4tWKjft4PGgz0LPByD9l6j4QxxRDZ",
render_errors: [view: PlasmaHS.ErrorView, accepts: ~w(json)],
render_errors: [view: PlasmaWeb.ErrorView, accepts: ~w(json)],
pubsub: [name: Plasma.PubSub, adapter: Phoenix.PubSub.PG2]
config :plasma, PlasmaHS.Guardian,
config :plasma, PlasmaWeb.Guardian,
issuer: "plasma",
# "Secret key. You can use `mix guardian.gen.secret` to get one"
secret_key: "ms2LsBHcbO04Mjnr4SwkE7WeD6kcrwmyzF/xIRdUlImQTOlgffIguUuWor+KmBCm"
......@@ -35,15 +35,15 @@ config :phoenix, :json_library, Jason
# Use Jason for JSON parsing in Postgrex
config :postgrex, :json_library, Jason
config :plasma, PlasmaHS.Users.AccessTokenCache,
config :plasma, PlasmaWeb.Users.AccessTokenCache,
gc_interval: 86_400 # 24 hrs
config :plasma, PlasmaHS.Plugs.AuthSessionCache.Primary,
config :plasma, PlasmaWeb.Plugs.AuthSessionCache.Primary,
gc_interval: 86_400 # 24 hrs
# Distributed Cache
config :plasma, PlasmaHS.Plugs.AuthSessionCache,
local: PlasmaHS.Plugs.AuthSessionCache.Primary,
config :plasma, PlasmaWeb.Plugs.AuthSessionCache,
local: PlasmaWeb.Plugs.AuthSessionCache.Primary,
node_selector: Nebulex.Adapters.Dist
config :plasma, :matrix,
......
......@@ -6,7 +6,7 @@ use Mix.Config
# The watchers configuration can be used to run external
# watchers to your application. For example, we use it
# with webpack to recompile .js and .css sources.
config :plasma, PlasmaHS.Endpoint,
config :plasma, PlasmaWeb.Endpoint,
http: [port: 4000],
debug_errors: true,
code_reloader: true,
......
......@@ -45,7 +45,7 @@ defmodule PlasmaRepo.Channels.Identifier do
def new(type, localpart, domain \\ nil) do
domain =
case domain do
nil -> PlasmaHS.Application.domain()
nil -> PlasmaWeb.Application.domain()
_ -> domain
end
......
defmodule PlasmaHS.RoomServer.RoomState do
defstruct [:room_id, :mx_room_id, :create_event, :creator, :power_levels, :join_rule]
end
\ No newline at end of file
......@@ -4,6 +4,11 @@ defmodule PlasmaRepo.Events.EventType do
alias PlasmaRepo.Events.EventType
alias PlasmaRepo.Events.EventTypeCachableRepo
@type t :: %__MODULE__{
name: String.t(),
inserted_at: DateTime.t()
}
schema "event_types" do
field :name, :string
timestamps(updated_at: false)
......@@ -16,6 +21,7 @@ defmodule PlasmaRepo.Events.EventType do
|> unique_constraint(:name, message: "non_unique")
end
@spec get_or_create(String.t()) :: {:ok, EventType.t()} | {:error, term()}
def get_or_create(type_name) do
case get_by_name(type_name) do
nil ->
......
defmodule PlasmaRepo.MatrixRooms.CreateRoomRequest do
require Logger
use Ecto.Schema
embedded_schema do
field :visibility, :string
field :room_version, :string
field :creation_content, :map
field :power_level_content_override, :map
field :preset, :string
field :name, :string
field :topic, :string
embeds_many :initial_state, StateEvent do
field :type, :string
field :state_key, :string, default: ""
field :content, :string
end
end
def cast(request, params \\ %{}) do
request
|> Ecto.Changeset.cast(params, [
:visibility,
:room_version,
:creation_content,
:power_level_content_override,
:name,
:topic
])
|> Ecto.Changeset.cast_embed(:initial_state, with: &cast_state_event/2)
|> Ecto.Changeset.validate_inclusion(:visibility, ["public", "private"], message: "bad_type")
|> Ecto.Changeset.validate_inclusion(:preset, ["private_chat", "public_chat", "trusted_private_chat"], message: "bad_type")
end
defp cast_state_event(schema, params) do
schema
|> Ecto.Changeset.cast(params, [:type, :state_key, :content])
|> Ecto.Changeset.validate_required([:type, :state_key])
end
end
\ No newline at end of file
defmodule PlasmaRepo.Rooms.Room do
use PlasmaRepo.Schema
alias PlasmaRepo.Events.{Event, EventContent}
alias PlasmaRepo.Events.EventType
alias PlasmaRepo.Events.Identifier
alias PlasmaRepo.Repo
@type t :: %__MODULE__{
mx_room_id: String.t(),
is_public: boolean
}
schema "rooms" do
field :mx_room_id, :string
field :is_public, :boolean, default: false
timestamps()
end
def changeset(room, attrs \\ %{}) do
room
|> cast(attrs, [:mx_room_id, :visibility])
|> validate_required([:mx_room_id])
|> unique_constraint(:mx_room_id, message: "unique")
end
def create_changeset(room, attrs \\ %{}) do
room
|> changeset(attrs)
end
end
\ No newline at end of file
defmodule PlasmaRepo.Rooms do
alias PlasmaRepo.Rooms.Room
alias PlasmaRepo.Repo
def create_room(params) do
Room.create_changeset(%Room{}, params) |> Repo.insert
end
@doc """
Get a room from the repo
"""
@spec get_room(String.t) :: Room | nil
def get_room(room_id) do
Repo.get(Room, room_id)
end
end
\ No newline at end of file
......@@ -14,14 +14,14 @@ defmodule PlasmaRepo.Users.AccessTokens do
|> AccessToken.create_changeset(%{device_id: device.id, user_id: user.id})
|> Repo.insert,
access_token <- Repo.preload(access_token, [:device, :user]),
{:ok, token, _claims} <- PlasmaHS.Guardian.encode_and_sign(access_token) do
{:ok, token, _claims} <- PlasmaWeb.Guardian.encode_and_sign(access_token) do
PlasmaRepo.Users.AccessTokenCache.set(access_token.id, access_token, ttl: @cache_ttl)
{:ok, token}
end
end
def decode_token(encoded_token) do
with {:ok, access_token_id, _claims} when not is_nil(encoded_token) <- PlasmaHS.Guardian.resource_from_token(encoded_token),
with {:ok, access_token_id, _claims} when not is_nil(encoded_token) <- PlasmaWeb.Guardian.resource_from_token(encoded_token),
access_token when not is_nil(access_token_id) <- PlasmaRepo.Users.AccessTokenCache.get(access_token_id) || Repo.get(AccessToken, access_token_id) do
if access_token != nil do
PlasmaRepo.Users.AccessTokenCache.add(access_token.id, access_token, ttl: @cache_ttl)
......@@ -35,7 +35,7 @@ defmodule PlasmaRepo.Users.AccessTokens do
def get_encoded_token(access_token_id) do
case PlasmaRepo.Users.AccessTokenCache.get(access_token_id) || Repo.get(AccessToken, access_token_id) do
nil -> nil
access_token -> PlasmaHS.Guardian.encode_and_sign(access_token)
access_token -> PlasmaWeb.Guardian.encode_and_sign(access_token)
end
end
end
defmodule PlasmaHS do
defmodule PlasmaWeb do
@moduledoc """
The entrypoint for defining your web interface, such
as controllers, views, channels and so on.
......@@ -19,11 +19,11 @@ defmodule PlasmaHS do
def controller do
quote do
use Phoenix.Controller, namespace: PlasmaHS
use Phoenix.Controller, namespace: PlasmaWeb
import Plug.Conn
import PlasmaHS.Gettext
alias PlasmaHS.Router.Helpers, as: Routes
import PlasmaWeb.Gettext
alias PlasmaWeb.Router.Helpers, as: Routes
end
end
......@@ -31,14 +31,14 @@ defmodule PlasmaHS do
quote do
use Phoenix.View,
root: "lib/plasma_web/templates",
namespace: PlasmaHS
namespace: PlasmaWeb
# Import convenience functions from controllers
import Phoenix.Controller, only: [get_flash: 1, get_flash: 2, view_module: 1]
import PlasmaHS.ErrorHelpers
import PlasmaHS.Gettext
alias PlasmaHS.Router.Helpers, as: Routes
import PlasmaWeb.ErrorHelpers
import PlasmaWeb.Gettext
alias PlasmaWeb.Router.Helpers, as: Routes
end
end
......@@ -53,7 +53,7 @@ defmodule PlasmaHS do
def channel do
quote do
use Phoenix.Channel
import PlasmaHS.Gettext
import PlasmaWeb.Gettext
end
end
......
defmodule PlasmaHS.Application do
defmodule PlasmaWeb.Application do
# See https://hexdocs.pm/elixir/Application.html
# for more information on OTP Applications
@moduledoc false
......@@ -20,10 +20,10 @@ defmodule PlasmaHS.Application do
max_seconds: 1
]},
{Task.Supervisor, name: PlasmaRepo.TaskSupervisor},
PlasmaHS.Plugs.AuthSessionCache,
PlasmaHS.Plugs.AuthSessionCache.Primary,
PlasmaWeb.Plugs.AuthSessionCache,
PlasmaWeb.Plugs.AuthSessionCache.Primary,
# Start the endpoint when the application starts
PlasmaHS.Endpoint,
PlasmaWeb.Endpoint,
PlasmaRepo.Events.EventTypeCache,
PlasmaRepo.Users.AccessTokenCache,
# Start the Ecto repository
......@@ -32,7 +32,7 @@ defmodule PlasmaHS.Application do
# See https://hexdocs.pm/elixir/Supervisor.html
# for other strategies and supported options
opts = [strategy: :one_for_one, name: PlasmaHS.Supervisor]
opts = [strategy: :one_for_one, name: PlasmaWeb.Supervisor]
supervisor = Supervisor.start_link(children, opts)
supervisor
......@@ -41,7 +41,7 @@ defmodule PlasmaHS.Application do
# Tell Phoenix to update the endpoint configuration
# whenever the application is updated.
def config_change(changed, _new, removed) do
PlasmaHS.Endpoint.config_change(changed, removed)
PlasmaWeb.Endpoint.config_change(changed, removed)
:ok
end
......
defmodule PlasmaHS.UserSocket do
defmodule PlasmaWeb.UserSocket do
use Phoenix.Socket
## Channels
......
defmodule PlasmaHS.Controllers.MatrixApi.Client.R0.Account do
use PlasmaHS, :controller
use PlasmaHS.Controllers.MatrixApi.MatrixController
defmodule PlasmaWeb.Controllers.MatrixApi.Client.R0.Account do
use PlasmaWeb, :controller
use PlasmaWeb.Controllers.MatrixApi.MatrixController
require Logger
def whoami(conn, _params) do
......
defmodule PlasmaHS.Controllers.MatrixApi.Client.R0.CapabilitiesController do
use PlasmaHS, :controller
use PlasmaHS.Controllers.MatrixApi.MatrixController
defmodule PlasmaWeb.Controllers.MatrixApi.Client.R0.CapabilitiesController do
use PlasmaWeb, :controller
use PlasmaWeb.Controllers.MatrixApi.MatrixController
require Logger
def get_capabilities(conn, _params) do
......
defmodule PlasmaHS.Controllers.MatrixApi.Client.R0.Login do
use PlasmaHS, :controller
use PlasmaHS.Controllers.MatrixApi.MatrixController
defmodule PlasmaWeb.Controllers.MatrixApi.Client.R0.Login do
use PlasmaWeb, :controller
use PlasmaWeb.Controllers.MatrixApi.MatrixController
alias PlasmaRepo.Users.AccessTokens
require Logger
......@@ -49,9 +49,9 @@ defmodule PlasmaHS.Controllers.MatrixApi.Client.R0.Login do
end
password = Map.get(params, "password")
ua = PlasmaHS.Tools.get_ua(conn)
ua = PlasmaWeb.Tools.get_ua(conn)
initial_display_name = Map.get(params, "initial_display_name", "#{ua} on #{ua.os}/#{ua.device}")
device_id = Map.get(params, "device_id", PlasmaHS.Tools.generate_device_id(ua))
device_id = Map.get(params, "device_id", PlasmaWeb.Tools.generate_device_id(ua))
case PlasmaRepo.Users.get_user_check_password(to_string(user_id), password) do
{:ok, user} ->
......
defmodule PlasmaHS.Controllers.MatrixApi.Client.R0.PresenceController do
use PlasmaHS, :controller
use PlasmaHS.Controllers.MatrixApi.MatrixController
defmodule PlasmaWeb.Controllers.MatrixApi.Client.R0.PresenceController do
use PlasmaWeb, :controller
use PlasmaWeb.Controllers.MatrixApi.MatrixController
require Logger
def put_presence_status(conn, %{"userId" => userId, "presence" => presence}) do
......
defmodule PlasmaHS.Controllers.MatrixApi.Client.R0.PushRules do
use PlasmaHS, :controller
use PlasmaHS.Controllers.MatrixApi.MatrixController
defmodule PlasmaWeb.Controllers.MatrixApi.Client.R0.PushRules do
use PlasmaWeb, :controller
use PlasmaWeb.Controllers.MatrixApi.MatrixController
alias PlasmaRepo.Channels.Identifier
alias PlasmaRepo.Users
alias PlasmaRepo.Users.User
......
defmodule PlasmaHS.Controllers.MatrixApi.Client.R0.Pushers do
use PlasmaHS, :controller
use PlasmaHS.Controllers.MatrixApi.MatrixController
defmodule PlasmaWeb.Controllers.MatrixApi.Client.R0.Pushers do
use PlasmaWeb, :controller
use PlasmaWeb.Controllers.MatrixApi.MatrixController
alias PlasmaRepo.Channels.Identifier
require Logger
......
defmodule PlasmaHS.Controllers.MatrixApi.Client.R0.Register do
use PlasmaHS, :controller
use PlasmaHS.Controllers.MatrixApi.MatrixController
import PlasmaHS.Errors
defmodule PlasmaWeb.Controllers.MatrixApi.Client.R0.Register do
use PlasmaWeb, :controller
use PlasmaWeb.Controllers.MatrixApi.MatrixController
import PlasmaWeb.Errors
require Logger
alias PlasmaRepo.Users
alias PlasmaRepo.Users.AccessTokens
def register(conn, params) do
ua = PlasmaHS.Tools.get_ua(conn)
ua = PlasmaWeb.Tools.get_ua(conn)
default_params = %{
"inhibit_login" => false,
"kind" => "user",
"mx_device_id" => Map.get(params, "device_id") || PlasmaHS.Tools.generate_device_id(ua),
"mx_device_id" => Map.get(params, "device_id") || PlasmaWeb.Tools.generate_device_id(ua),
"initial_device_display_name" => "#{ua} on #{ua.os}/#{ua.device}"
}
......
defmodule PlasmaHS.Controllers.MatrixApi.Client.R0.Room do
use PlasmaHS, :controller
use PlasmaHS.Controllers.MatrixApi.MatrixController
defmodule PlasmaWeb.Controllers.MatrixApi.Client.R0.Room do
use PlasmaWeb, :controller
use PlasmaWeb.Controllers.MatrixApi.MatrixController
alias PlasmaRepo.MatrixRooms.CreateRoomRequest
import PlasmaHS.Errors
import PlasmaWeb.Errors
require Logger
def create_room(conn, params) do
......
defmodule PlasmaHS.Controllers.MatrixApi.Client.R0.SyncController do
use PlasmaHS, :controller
use PlasmaHS.Controllers.MatrixApi.MatrixController
defmodule PlasmaWeb.Controllers.MatrixApi.Client.R0.SyncController do
use PlasmaWeb, :controller
use PlasmaWeb.Controllers.MatrixApi.MatrixController
alias PlasmaRepo.Channels.Identifier
require Logger
......
defmodule PlasmaHS.Controllers.MatrixApi.Client.R0.UserController do
use PlasmaHS, :controller
use PlasmaHS.Controllers.MatrixApi.MatrixController
defmodule PlasmaWeb.Controllers.MatrixApi.Client.R0.UserController do
use PlasmaWeb, :controller
use PlasmaWeb.Controllers.MatrixApi.MatrixController
alias PlasmaRepo.Users
import PlasmaHS.Errors
import PlasmaWeb.Errors
require Logger
def post_filter(conn, %{"userId" => userId}) do
......
defmodule PlasmaHS.Controllers.MatrixApi.Client.Versions do
use PlasmaHS, :controller
defmodule PlasmaWeb.Controllers.MatrixApi.Client.Versions do
use PlasmaWeb, :controller
def get(conn, _params) do
json(conn, %{versions: ["r0.4.0", "r0.5.0", "r0.6.0"]})
......
defmodule PlasmaHS.Controllers.MatrixApi.MatrixController do
defmodule PlasmaWeb.Controllers.MatrixApi.MatrixController do
defmacro __using__(_) do
quote do
import PlasmaHS.Errors
import PlasmaWeb.Errors
# Get first error message from a changeset
defp first_error_message(changeset) do
{field, {error, _}} = changeset.errors |> List.first
......
defmodule PlasmaHS.Controllers.WellKnown do
use PlasmaHS, :controller
defmodule PlasmaWeb.Controllers.WellKnown do
use PlasmaWeb, :controller
@homeserver_base_url Application.get_env(:plasma, :homeserver_base_url)
@identity_server Application.get_env(:plasma, :identity_server)
......
defmodule PlasmaHS.Endpoint do
defmodule PlasmaWeb.Endpoint do
use Phoenix.Endpoint, otp_app: :plasma
socket "/socket", PlasmaHS.UserSocket,
socket "/socket", PlasmaWeb.UserSocket,
websocket: true,
longpoll: false
......@@ -40,5 +40,5 @@ defmodule PlasmaHS.Endpoint do
key: "_plasma_key",
signing_salt: "6G3VFPIV"
plug PlasmaHS.Router
plug PlasmaWeb.Router
end
defmodule PlasmaHS.Errors do
defmodule PlasmaWeb.Errors do
# Inspired by https://github.com/bismark/matrex/blob/master/lib/matrex_web/errors.ex
import Phoenix.Controller, only: [json: 2]
alias Plug.Conn
......
defmodule PlasmaHS.Gettext do
defmodule PlasmaWeb.Gettext do
@moduledoc """
A module providing Internationalization with a gettext-based API.
......
defmodule PlasmaHS.Guardian do
defmodule PlasmaWeb.Guardian do
use Guardian, otp_app: :plasma
def subject_for_token(access_token, _claims) do
......
defmodule PlasmaHS.Plugs.AuthSessionCache do
defmodule PlasmaWeb.Plugs.AuthSessionCache do
use Nebulex.Cache,
otp_app: :plasma,
adapter: Nebulex.Adapters.Dist
......
defmodule PlasmaHS.Plugs.ExtractAccessToken do
defmodule PlasmaWeb.Plugs.ExtractAccessToken do
alias Plug.Conn
@moduledoc """
......
defmodule PlasmaHS.Plugs.InteractiveAuthFlow do
defmodule PlasmaWeb.Plugs.InteractiveAuthFlow do
require Logger
alias Plug.Conn
alias PlasmaHS.Plugs.AuthSessionCache
alias PlasmaWeb.Plugs.AuthSessionCache
alias Plasma.Utils.Randomizer
import Phoenix.Controller, only: [json: 2]
......
defmodule PlasmaHS.Plugs.RequireAccessToken do
defmodule PlasmaWeb.Plugs.RequireAccessToken do
alias Plug.Conn
import PlasmaHS.Errors
import PlasmaWeb.Errors
@moduledoc """
RequireAccessToken checks if a token (previously extracted by ExtractAccessToken plug) is present in `conn` assigns.
......
defmodule PlasmaHS.Router do
use PlasmaHS, :router
defmodule PlasmaWeb.Router do
use PlasmaWeb, :router
pipeline :api do
plug :accepts, ["json"]
end
pipeline :auth do
plug PlasmaHS.Plugs.ExtractAccessToken
plug PlasmaHS.Plugs.RequireAccessToken
plug PlasmaWeb.Plugs.ExtractAccessToken
plug PlasmaWeb.Plugs.RequireAccessToken
end
pipeline :interactive_auth do
plug PlasmaHS.Plugs.InteractiveAuthFlow
plug PlasmaWeb.Plugs.InteractiveAuthFlow
end
scope "/.well-known", PlasmaHS.Controllers do
scope "/.well-known", PlasmaWeb.Controllers do
get "/matrix/client", WellKnown, :get
end
scope "/_matrix/client", PlasmaHS.Controllers.MatrixApi.Client do
scope "/_matrix/client", PlasmaWeb.Controllers.MatrixApi.Client do
pipe_through :api
get "/versions", Versions, :get
......@@ -31,7 +31,7 @@ defmodule PlasmaHS.Router do
end
end
scope "/_matrix/client", PlasmaHS.Controllers.MatrixApi.Client do
scope "/_matrix/client", PlasmaWeb.Controllers.MatrixApi.Client do
pipe_through [:api, :interactive_auth]
scope "/r0", R0 do
......@@ -39,7 +39,7 @@ defmodule PlasmaHS.Router do
end
end
scope "/_matrix/client", PlasmaHS.Controllers.MatrixApi.Client do
scope "/_matrix/client", PlasmaWeb.Controllers.MatrixApi.Client do
pipe_through [:api, :auth]
scope "/r0", R0 do
......
defmodule PlasmaHS.Tools do
defmodule PlasmaWeb.Tools do
# Returns a readable version of UA
def get_ua_repr(conn) do
ua = PlasmaHS.Tools.get_ua(conn)
ua = PlasmaWeb.Tools.get_ua(conn)
"#{ua} on #{ua.os}/#{ua.device}"
end
......
defmodule PlasmaHS.ErrorHelpers do
defmodule PlasmaWeb.ErrorHelpers do
@moduledoc """
Conveniences for translating and building error messages.
"""
......@@ -25,9 +25,9 @@ defmodule PlasmaHS.ErrorHelpers do
# should be written to the errors.po file. The :count option is
# set by Ecto and indicates we should also apply plural rules.
if count = opts[:count] do
Gettext.dngettext(PlasmaHS.Gettext, "errors", msg, msg, count, opts)
Gettext.dngettext(PlasmaWeb.Gettext, "errors", msg, msg, count, opts)
else
Gettext.dgettext(PlasmaHS.Gettext, "errors", msg, opts)
Gettext.dgettext(PlasmaWeb.Gettext, "errors", msg, opts)
end
end
end
defmodule PlasmaHS.ErrorView do
use PlasmaHS, :view
defmodule PlasmaWeb.ErrorView do
use PlasmaWeb, :view
# If you want to customize a particular status code
# for a certain format, you may uncomment below.
......
......@@ -19,7 +19,7 @@ defmodule Plasma.MixProject do
# Type `mix help compile.app` for more information.
def application do
[
mod: {PlasmaHS.Application, []},
mod: {PlasmaWeb.Application, []},
extra_applications: [:logger, :runtime_tools]
]
end
......
defmodule PlasmaHS.RoomServerTests do
use PlasmaRepo.DataCase
import PlasmaRepo.Factory
alias PlasmaHS.RoomServer
def clear_cache(_context) do
PlasmaRepo.Events.EventTypeCache.flush()
:ok
end
setup :clear_cache
test "start room server on existing room succeed" do
room = insert(:room)
res = RoomServer.start_room_server(room.id)
assert {:ok, _pid} = res
end
test "start room server on non-existing fails" do
res = RoomServer.start_room_server(Ecto.UUID.generate())
assert {:error, _pid} = res
end
end
\ No newline at end of file
......@@ -19,7 +19,7 @@ defmodule Plasma.Users.AccessTokensTest do
test "Decode access token contain original device and user id" do
device = insert(:device)
assert {:ok, token} = AccessTokens.encode_token(device, device.user)
assert {:ok, access_token_id, _claims} = PlasmaHS.Guardian.resource_from_token(token)
assert {:ok, access_token_id, _claims} = PlasmaWeb.Guardian.resource_from_token(token)
access_token = PlasmaRepo.Users.AccessTokenCache.get(access_token_id)
assert %AccessToken{} = access_token
assert device.id == access_token.device.id
......
......@@ -2,7 +2,7 @@ defmodule PlasmaWeb.Controllers.MatrixApi.Client.AccountTest do
use PlasmaWeb.ConnCase
def clear_cache(_context) do
PlasmaHS.Plugs.AuthSessionCache.flush()
PlasmaWeb.Plugs.AuthSessionCache.flush()
PlasmaRepo.Users.AccessTokenCache.flush()
PlasmaRepo.Events.EventTypeCache.flush()
:ok
......
......@@ -3,7 +3,7 @@ defmodule PlasmaWeb.Controllers.MatrixApi.Client.LoginTest do
import PlasmaRepo.Factory
def clear_cache(_context) do
PlasmaHS.Plugs.AuthSessionCache.flush()
PlasmaWeb.Plugs.AuthSessionCache.flush()
PlasmaRepo.Users.AccessTokenCache.flush()
PlasmaRepo.Events.EventTypeCache.flush()
:ok
......
......@@ -3,7 +3,7 @@ defmodule PlasmaWeb.Controllers.MatrixApi.Client.RegisterTest do
alias Plasma.Utils.Randomizer
def clear_cache(_context) do
PlasmaHS.Plugs.AuthSessionCache.flush()
PlasmaWeb.Plugs.AuthSessionCache.flush()
PlasmaRepo.Users.AccessTokenCache.flush()