Web.MastodonAPI.MastodonSocket: Put access_token at function-level

This commit is contained in:
Haelwenn (lanodan) Monnier 2018-11-24 06:43:03 +01:00
parent 5346fabf14
commit d388a99143
No known key found for this signature in database
GPG Key ID: D5B7A8E43C997DEE

View File

@ -11,9 +11,8 @@ defmodule Pleroma.Web.MastodonAPI.MastodonSocket do
timeout: :infinity timeout: :infinity
) )
def connect(params, socket) do def connect(%{"access_token" => token} = params, socket) do
with token when not is_nil(token) <- params["access_token"], with %Token{user_id: user_id} <- Repo.get_by(Token, token: token),
%Token{user_id: user_id} <- Repo.get_by(Token, token: token),
%User{} = user <- Repo.get(User, user_id), %User{} = user <- Repo.get(User, user_id),
stream stream
when stream in [ when stream in [