fix(user): update the known user when fetched from a display URL
A fetch from a display URL (e.g. https://host/@user) returns the actor with its canonical id. make_user_from_ap_id looked the user up by the fetch URL, did not find it and tried to insert a duplicate. Look the user up by the fetched id. Based on Akkoma 48b3a3579.
This commit is contained in:
parent
f1337d8159
commit
f22caeff53
3 changed files with 31 additions and 2 deletions
|
|
@ -2055,11 +2055,12 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
|
|||
def enqueue_pin_fetches(_), do: nil
|
||||
|
||||
def make_user_from_ap_id(ap_id, additional \\ []) do
|
||||
user = User.get_cached_by_ap_id(ap_id)
|
||||
|
||||
with {:ok, data} <- fetch_and_prepare_user_from_ap_id(ap_id, additional) do
|
||||
enqueue_pin_fetches(data)
|
||||
|
||||
# the fetched actor's id differs from ap_id when it was fetched from a display URL
|
||||
user = User.get_cached_by_ap_id(data.ap_id)
|
||||
|
||||
if user do
|
||||
user
|
||||
|> User.remote_user_changeset(data)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue