diff options
author | Mark Felder <feld@FreeBSD.org> | 2019-07-15 17:10:27 -0500 |
---|---|---|
committer | Mark Felder <feld@FreeBSD.org> | 2019-07-15 17:10:27 -0500 |
commit | ffb4eb9779ddd28ecee84c06e8dc58f4a4daaa38 (patch) | |
tree | b397d1192c69a7d089c86d41b6e09e89954ea798 /lib/pleroma/web/oauth/authorization.ex | |
parent | e912f81c828cc7e1d2c0dff8daed3ad52f407a61 (diff) | |
parent | 03bcb40883dafa2886110e2b625c4cc5c21106f1 (diff) | |
download | pleroma-ffb4eb9779ddd28ecee84c06e8dc58f4a4daaa38.tar.gz |
Merge branch 'develop' into feature/matstodon-statuses-by-name
Diffstat (limited to 'lib/pleroma/web/oauth/authorization.ex')
-rw-r--r-- | lib/pleroma/web/oauth/authorization.ex | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/lib/pleroma/web/oauth/authorization.ex b/lib/pleroma/web/oauth/authorization.ex index 18973413e..d53e20d12 100644 --- a/lib/pleroma/web/oauth/authorization.ex +++ b/lib/pleroma/web/oauth/authorization.ex @@ -76,14 +76,16 @@ defmodule Pleroma.Web.OAuth.Authorization do def use_token(%Authorization{used: true}), do: {:error, "already used"} @spec delete_user_authorizations(User.t()) :: {integer(), any()} - def delete_user_authorizations(%User{id: user_id}) do - from( - a in Pleroma.Web.OAuth.Authorization, - where: a.user_id == ^user_id - ) + def delete_user_authorizations(%User{} = user) do + user + |> delete_by_user_query |> Repo.delete_all() end + def delete_by_user_query(%User{id: user_id}) do + from(a in __MODULE__, where: a.user_id == ^user_id) + end + @doc "gets auth for app by token" @spec get_by_token(App.t(), String.t()) :: {:ok, t()} | {:error, :not_found} def get_by_token(%App{id: app_id} = _app, token) do |