diff options
| author | Ivan Tashkinov <ivantashkinov@gmail.com> | 2019-12-19 17:23:27 +0300 | 
|---|---|---|
| committer | Ivan Tashkinov <ivantashkinov@gmail.com> | 2019-12-19 17:23:27 +0300 | 
| commit | 455e072d27f28c39050b2dc24b346a8f2ef30f90 (patch) | |
| tree | 37906a1131bf70777316e24af19382f053f8c0c1 /lib | |
| parent | 7973cbdb9fa9120306cb5a265a477eeccd315ee6 (diff) | |
| download | pleroma-455e072d27f28c39050b2dc24b346a8f2ef30f90.tar.gz pleroma-455e072d27f28c39050b2dc24b346a8f2ef30f90.zip | |
[#2068] Introduced proper OAuth tokens usage to controller tests.
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/pleroma/web/masto_fe_controller.ex | 25 | 
1 files changed, 14 insertions, 11 deletions
| diff --git a/lib/pleroma/web/masto_fe_controller.ex b/lib/pleroma/web/masto_fe_controller.ex index ca261ad6e..9f7e4943c 100644 --- a/lib/pleroma/web/masto_fe_controller.ex +++ b/lib/pleroma/web/masto_fe_controller.ex @@ -20,18 +20,21 @@ defmodule Pleroma.Web.MastoFEController do    plug(Pleroma.Plugs.EnsurePublicOrAuthenticatedPlug when action != :index)    @doc "GET /web/*path" -  def index(%{assigns: %{user: user}} = conn, _params) do -    token = get_session(conn, :oauth_token) +  def index(%{assigns: %{user: user, token: token}} = conn, _params) +      when not is_nil(user) and not is_nil(token) do +    conn +    |> put_layout(false) +    |> render("index.html", +      token: token.token, +      user: user, +      custom_emojis: Pleroma.Emoji.get_all() +    ) +  end -    if user && token do -      conn -      |> put_layout(false) -      |> render("index.html", token: token, user: user, custom_emojis: Pleroma.Emoji.get_all()) -    else -      conn -      |> put_session(:return_to, conn.request_path) -      |> redirect(to: "/web/login") -    end +  def index(conn, _params) do +    conn +    |> put_session(:return_to, conn.request_path) +    |> redirect(to: "/web/login")    end    @doc "GET /web/manifest.json" | 
