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
)
def connect(params, socket) do
with token when not is_nil(token) <- params["access_token"],
%Token{user_id: user_id} <- Repo.get_by(Token, token: token),
def connect(%{"access_token" => token} = params, socket) do
with %Token{user_id: user_id} <- Repo.get_by(Token, token: token),
%User{} = user <- Repo.get(User, user_id),
stream
when stream in [