Basic AP user building.
This commit is contained in:
parent
c1d26751e6
commit
ae1ec858f4
4 changed files with 47 additions and 9 deletions
|
|
@ -80,9 +80,15 @@ defmodule Pleroma.User do
|
|||
|> validate_length(:name, max: 100)
|
||||
|> put_change(:local, false)
|
||||
if changes.valid? do
|
||||
followers = User.ap_followers(%User{nickname: changes.changes[:nickname]})
|
||||
changes
|
||||
|> put_change(:follower_address, followers)
|
||||
case changes.changes[:info]["source_data"] do
|
||||
%{"followers" => followers} ->
|
||||
changes
|
||||
|> put_change(:follower_address, followers)
|
||||
_ ->
|
||||
followers = User.ap_followers(%User{nickname: changes.changes[:nickname]})
|
||||
changes
|
||||
|> put_change(:follower_address, followers)
|
||||
end
|
||||
else
|
||||
changes
|
||||
end
|
||||
|
|
@ -386,4 +392,9 @@ defmodule Pleroma.User do
|
|||
_ -> :error
|
||||
end
|
||||
end
|
||||
|
||||
def insert_or_update_user(data) do
|
||||
cs = User.remote_user_creation(data)
|
||||
Repo.insert(cs, on_conflict: :replace_all, conflict_target: :nickname)
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue