Add also_known_as field to Pleroma.User

This commit is contained in:
Egor Kislitsyn 2019-10-25 19:14:18 +07:00
commit b777083f3f
No known key found for this signature in database
GPG key ID: 1B49CB15B71E7805
7 changed files with 61 additions and 7 deletions

View file

@ -105,6 +105,7 @@ defmodule Pleroma.User do
field(:discoverable, :boolean, default: false)
field(:invisible, :boolean, default: false)
field(:skip_thread_containment, :boolean, default: false)
field(:also_known_as, {:array, :string}, default: [])
field(:notification_settings, :map,
default: %{
@ -324,7 +325,8 @@ defmodule Pleroma.User do
:fields,
:following_count,
:discoverable,
:invisible
:invisible,
:also_known_as
]
)
|> validate_required([:name, :ap_id])
@ -373,7 +375,8 @@ defmodule Pleroma.User do
:fields,
:raw_fields,
:pleroma_settings_store,
:discoverable
:discoverable,
:also_known_as
]
)
|> unique_constraint(:nickname)
@ -413,7 +416,8 @@ defmodule Pleroma.User do
:hide_followers,
:discoverable,
:hide_followers_count,
:hide_follows_count
:hide_follows_count,
:also_known_as
]
)
|> unique_constraint(:nickname)

View file

@ -1117,7 +1117,8 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
name: data["name"],
follower_address: data["followers"],
following_address: data["following"],
bio: data["summary"]
bio: data["summary"],
also_known_as: Map.get(data, "alsoKnownAs", [])
}
# nickname can be nil because of virtual actors

View file

@ -616,7 +616,7 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do
update_data =
new_user_data
|> Map.take([:avatar, :banner, :bio, :name])
|> Map.take([:avatar, :banner, :bio, :name, :also_known_as])
|> Map.put(:fields, fields)
|> Map.put(:locked, locked)
|> Map.put(:invisible, invisible)