Prevent OAuth App flow from creating duplicate entries
This commit is contained in:
parent
62856ab18f
commit
5a1144208d
3 changed files with 49 additions and 3 deletions
|
|
@ -33,11 +33,9 @@ defmodule Pleroma.Web.MastodonAPI.AppController do
|
|||
app_attrs =
|
||||
params
|
||||
|> Map.take([:client_name, :redirect_uris, :website])
|
||||
|> Map.put(:scopes, scopes)
|
||||
|> Maps.put_if_present(:user_id, user_id)
|
||||
|
||||
with cs <- App.register_changeset(%App{}, app_attrs),
|
||||
{:ok, app} <- Repo.insert(cs) do
|
||||
with {:ok, app} <- App.get_or_make(app_attrs, scopes) do
|
||||
render(conn, "show.json", app: app)
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue