forked from AkkomaGang/akkoma
Merge branch 'activitypub/add-discoverable-parameter-in-activitypub-actor' into 'develop'
Activitypub/Add `discoverable` parameter in ActivityPub actor See merge request pleroma/pleroma!1641
This commit is contained in:
commit
59ae9255fb
8 changed files with 29 additions and 9 deletions
|
@ -109,6 +109,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
||||||
- Admin API: Added moderation log
|
- Admin API: Added moderation log
|
||||||
- Web response cache (currently, enabled for ActivityPub)
|
- Web response cache (currently, enabled for ActivityPub)
|
||||||
- Mastodon API: Added an endpoint to get multiple statuses by IDs (`GET /api/v1/statuses/?ids[]=1&ids[]=2`)
|
- Mastodon API: Added an endpoint to get multiple statuses by IDs (`GET /api/v1/statuses/?ids[]=1&ids[]=2`)
|
||||||
|
- ActivityPub: Add ActivityPub actor's `discoverable` parameter.
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
- Configuration: Filter.AnonymizeFilename added ability to retain file extension with custom text
|
- Configuration: Filter.AnonymizeFilename added ability to retain file extension with custom text
|
||||||
|
|
|
@ -54,6 +54,7 @@ defmodule Pleroma.User.Info do
|
||||||
field(:pleroma_settings_store, :map, default: %{})
|
field(:pleroma_settings_store, :map, default: %{})
|
||||||
field(:fields, {:array, :map}, default: nil)
|
field(:fields, {:array, :map}, default: nil)
|
||||||
field(:raw_fields, {:array, :map}, default: [])
|
field(:raw_fields, {:array, :map}, default: [])
|
||||||
|
field(:discoverable, :boolean, default: false)
|
||||||
|
|
||||||
field(:notification_settings, :map,
|
field(:notification_settings, :map,
|
||||||
default: %{
|
default: %{
|
||||||
|
@ -277,7 +278,8 @@ def remote_user_creation(info, params) do
|
||||||
:hide_follows_count,
|
:hide_follows_count,
|
||||||
:follower_count,
|
:follower_count,
|
||||||
:fields,
|
:fields,
|
||||||
:following_count
|
:following_count,
|
||||||
|
:discoverable
|
||||||
])
|
])
|
||||||
|> validate_fields(true)
|
|> validate_fields(true)
|
||||||
end
|
end
|
||||||
|
@ -295,6 +297,7 @@ def user_upgrade(info, params, remote? \\ false) do
|
||||||
:hide_follows,
|
:hide_follows,
|
||||||
:fields,
|
:fields,
|
||||||
:hide_followers,
|
:hide_followers,
|
||||||
|
:discoverable,
|
||||||
:hide_followers_count,
|
:hide_followers_count,
|
||||||
:hide_follows_count
|
:hide_follows_count
|
||||||
])
|
])
|
||||||
|
@ -318,7 +321,8 @@ def profile_update(info, params) do
|
||||||
:skip_thread_containment,
|
:skip_thread_containment,
|
||||||
:fields,
|
:fields,
|
||||||
:raw_fields,
|
:raw_fields,
|
||||||
:pleroma_settings_store
|
:pleroma_settings_store,
|
||||||
|
:discoverable
|
||||||
])
|
])
|
||||||
|> validate_fields()
|
|> validate_fields()
|
||||||
end
|
end
|
||||||
|
|
|
@ -1001,6 +1001,7 @@ defp object_to_user_data(data) do
|
||||||
|
|
||||||
locked = data["manuallyApprovesFollowers"] || false
|
locked = data["manuallyApprovesFollowers"] || false
|
||||||
data = Transmogrifier.maybe_fix_user_object(data)
|
data = Transmogrifier.maybe_fix_user_object(data)
|
||||||
|
discoverable = data["discoverable"] || false
|
||||||
|
|
||||||
user_data = %{
|
user_data = %{
|
||||||
ap_id: data["id"],
|
ap_id: data["id"],
|
||||||
|
@ -1009,7 +1010,8 @@ defp object_to_user_data(data) do
|
||||||
source_data: data,
|
source_data: data,
|
||||||
banner: banner,
|
banner: banner,
|
||||||
fields: fields,
|
fields: fields,
|
||||||
locked: locked
|
locked: locked,
|
||||||
|
discoverable: discoverable
|
||||||
},
|
},
|
||||||
avatar: avatar,
|
avatar: avatar,
|
||||||
name: data["name"],
|
name: data["name"],
|
||||||
|
|
|
@ -106,7 +106,8 @@ def render("user.json", %{user: user}) do
|
||||||
},
|
},
|
||||||
"endpoints" => endpoints,
|
"endpoints" => endpoints,
|
||||||
"attachment" => fields,
|
"attachment" => fields,
|
||||||
"tag" => (user.info.source_data["tag"] || []) ++ emoji_tags
|
"tag" => (user.info.source_data["tag"] || []) ++ emoji_tags,
|
||||||
|
"discoverable" => user.info.discoverable
|
||||||
}
|
}
|
||||||
|> Map.merge(maybe_make_image(&User.avatar_url/2, "icon", user))
|
|> Map.merge(maybe_make_image(&User.avatar_url/2, "icon", user))
|
||||||
|> Map.merge(maybe_make_image(&User.banner_url/2, "image", user))
|
|> Map.merge(maybe_make_image(&User.banner_url/2, "image", user))
|
||||||
|
|
|
@ -153,7 +153,8 @@ def update_credentials(%{assigns: %{user: user}} = conn, params) do
|
||||||
:hide_follows,
|
:hide_follows,
|
||||||
:hide_favorites,
|
:hide_favorites,
|
||||||
:show_role,
|
:show_role,
|
||||||
:skip_thread_containment
|
:skip_thread_containment,
|
||||||
|
:discoverable
|
||||||
]
|
]
|
||||||
|> Enum.reduce(%{}, fn key, acc ->
|
|> Enum.reduce(%{}, fn key, acc ->
|
||||||
add_if_present(acc, params, to_string(key), key, fn value ->
|
add_if_present(acc, params, to_string(key), key, fn value ->
|
||||||
|
|
|
@ -116,6 +116,8 @@ defp do_render("account.json", %{user: user} = opts) do
|
||||||
bio = HTML.filter_tags(user.bio, User.html_filter_policy(opts[:for]))
|
bio = HTML.filter_tags(user.bio, User.html_filter_policy(opts[:for]))
|
||||||
relationship = render("relationship.json", %{user: opts[:for], target: user})
|
relationship = render("relationship.json", %{user: opts[:for], target: user})
|
||||||
|
|
||||||
|
discoverable = user.info.discoverable
|
||||||
|
|
||||||
%{
|
%{
|
||||||
id: to_string(user.id),
|
id: to_string(user.id),
|
||||||
username: username_from_nickname(user.nickname),
|
username: username_from_nickname(user.nickname),
|
||||||
|
@ -139,7 +141,9 @@ defp do_render("account.json", %{user: user} = opts) do
|
||||||
note: HTML.strip_tags((user.bio || "") |> String.replace("<br>", "\n")),
|
note: HTML.strip_tags((user.bio || "") |> String.replace("<br>", "\n")),
|
||||||
sensitive: false,
|
sensitive: false,
|
||||||
fields: raw_fields,
|
fields: raw_fields,
|
||||||
pleroma: %{}
|
pleroma: %{
|
||||||
|
discoverable: discoverable
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
# Pleroma extension
|
# Pleroma extension
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
"@id": "ostatus:conversation",
|
"@id": "ostatus:conversation",
|
||||||
"@type": "@id"
|
"@type": "@id"
|
||||||
},
|
},
|
||||||
|
"discoverable": "toot:discoverable",
|
||||||
"manuallyApprovesFollowers": "as:manuallyApprovesFollowers",
|
"manuallyApprovesFollowers": "as:manuallyApprovesFollowers",
|
||||||
"ostatus": "http://ostatus.org#",
|
"ostatus": "http://ostatus.org#",
|
||||||
"schema": "http://schema.org",
|
"schema": "http://schema.org",
|
||||||
|
|
|
@ -67,7 +67,9 @@ test "Represent a user account" do
|
||||||
source: %{
|
source: %{
|
||||||
note: "valid html",
|
note: "valid html",
|
||||||
sensitive: false,
|
sensitive: false,
|
||||||
pleroma: %{},
|
pleroma: %{
|
||||||
|
discoverable: false
|
||||||
|
},
|
||||||
fields: []
|
fields: []
|
||||||
},
|
},
|
||||||
pleroma: %{
|
pleroma: %{
|
||||||
|
@ -137,7 +139,9 @@ test "Represent a Service(bot) account" do
|
||||||
source: %{
|
source: %{
|
||||||
note: user.bio,
|
note: user.bio,
|
||||||
sensitive: false,
|
sensitive: false,
|
||||||
pleroma: %{},
|
pleroma: %{
|
||||||
|
discoverable: false
|
||||||
|
},
|
||||||
fields: []
|
fields: []
|
||||||
},
|
},
|
||||||
pleroma: %{
|
pleroma: %{
|
||||||
|
@ -310,7 +314,9 @@ test "represent an embedded relationship" do
|
||||||
source: %{
|
source: %{
|
||||||
note: user.bio,
|
note: user.bio,
|
||||||
sensitive: false,
|
sensitive: false,
|
||||||
pleroma: %{},
|
pleroma: %{
|
||||||
|
discoverable: false
|
||||||
|
},
|
||||||
fields: []
|
fields: []
|
||||||
},
|
},
|
||||||
pleroma: %{
|
pleroma: %{
|
||||||
|
|
Loading…
Reference in a new issue