Revert "add _discoverable_ keyword into ActivityPub @context"
authorHakaba Hitoyo <hakabahitoyo@yahoo.co.jp>
Thu, 26 Sep 2019 02:57:41 +0000 (02:57 +0000)
committerkaniini <ariadne@dereferenced.org>
Thu, 26 Sep 2019 02:57:41 +0000 (02:57 +0000)
This reverts commit 3aef4bdf8f37efd1055a84c5fca12ec4559a17f5.

CHANGELOG.md
lib/pleroma/user/info.ex
lib/pleroma/web/activity_pub/activity_pub.ex
lib/pleroma/web/activity_pub/views/user_view.ex
lib/pleroma/web/mastodon_api/controllers/mastodon_api_controller.ex
lib/pleroma/web/mastodon_api/views/account_view.ex
priv/static/schemas/litepub-0.1.jsonld
test/web/mastodon_api/views/account_view_test.exs

index 2d6ddd5d6274d7a304bdf7d43cbe436401606b1e..a853a6913a0a4b5a8b3376f31573433f268b16bc 100644 (file)
@@ -109,6 +109,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
 - Admin API: Added moderation log
 - 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`)
+- ActivityPub: Add ActivityPub actor's `discoverable` parameter.
 
 ### Changed
 - Configuration: Filter.AnonymizeFilename added ability to retain file extension with custom text
index 99745f496d64bb728fbfd419210d65d2dbad0311..1d0f0c7f4365fee58544f1f34e3874be8ee23e54 100644 (file)
@@ -54,6 +54,7 @@ defmodule Pleroma.User.Info do
     field(:pleroma_settings_store, :map, default: %{})
     field(:fields, {:array, :map}, default: nil)
     field(:raw_fields, {:array, :map}, default: [])
+    field(:discoverable, :boolean, default: false)
 
     field(:notification_settings, :map,
       default: %{
@@ -277,7 +278,8 @@ defmodule Pleroma.User.Info do
       :hide_follows_count,
       :follower_count,
       :fields,
-      :following_count
+      :following_count,
+      :discoverable
     ])
     |> validate_fields(true)
   end
@@ -295,6 +297,7 @@ defmodule Pleroma.User.Info do
       :hide_follows,
       :fields,
       :hide_followers,
+      :discoverable,
       :hide_followers_count,
       :hide_follows_count
     ])
@@ -318,7 +321,8 @@ defmodule Pleroma.User.Info do
       :skip_thread_containment,
       :fields,
       :raw_fields,
-      :pleroma_settings_store
+      :pleroma_settings_store,
+      :discoverable
     ])
     |> validate_fields()
   end
index ff29efd43b67b3607d549c8b890aa322dbc0205e..8d0a57623747213e83cd09df9ac548d1a21855cc 100644 (file)
@@ -1001,6 +1001,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
 
     locked = data["manuallyApprovesFollowers"] || false
     data = Transmogrifier.maybe_fix_user_object(data)
+    discoverable = data["discoverable"] || false
 
     user_data = %{
       ap_id: data["id"],
@@ -1009,7 +1010,8 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
         source_data: data,
         banner: banner,
         fields: fields,
-        locked: locked
+        locked: locked,
+        discoverable: discoverable
       },
       avatar: avatar,
       name: data["name"],
index 4e37be5dbe0ad7a6036aed765830222b1bbb4c86..993307287a8df4a2b4614272c89b089fe58cf151 100644 (file)
@@ -106,7 +106,8 @@ defmodule Pleroma.Web.ActivityPub.UserView do
       },
       "endpoints" => endpoints,
       "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.banner_url/2, "image", user))
index bb81b061e7eb09179ac11d08eea0163386e212a8..239cfac9f82de8e5b9b21a3f21343f30deb60bd5 100644 (file)
@@ -153,7 +153,8 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
         :hide_follows,
         :hide_favorites,
         :show_role,
-        :skip_thread_containment
+        :skip_thread_containment,
+        :discoverable
       ]
       |> Enum.reduce(%{}, fn key, acc ->
         add_if_present(acc, params, to_string(key), key, fn value ->
index 195dd124b272644948998ffaaec77e7859b8c79c..a23aeea9b2b9ae23bdc27191d4a60912734678c8 100644 (file)
@@ -116,6 +116,8 @@ defmodule Pleroma.Web.MastodonAPI.AccountView do
     bio = HTML.filter_tags(user.bio, User.html_filter_policy(opts[:for]))
     relationship = render("relationship.json", %{user: opts[:for], target: user})
 
+    discoverable = user.info.discoverable
+
     %{
       id: to_string(user.id),
       username: username_from_nickname(user.nickname),
@@ -139,7 +141,9 @@ defmodule Pleroma.Web.MastodonAPI.AccountView do
         note: HTML.strip_tags((user.bio || "") |> String.replace("<br>", "\n")),
         sensitive: false,
         fields: raw_fields,
-        pleroma: %{}
+        pleroma: %{
+          discoverable: discoverable
+        }
       },
 
       # Pleroma extension
index 57ed05ebaf39315e41bb3b41d260dc161c073191..6e4bb29b156ed2f011d3707d7d946ad3e4bdaf17 100644 (file)
@@ -11,6 +11,7 @@
                 "@id": "ostatus:conversation",
                 "@type": "@id"
             },
+            "discoverable": "toot:discoverable",
             "manuallyApprovesFollowers": "as:manuallyApprovesFollowers",
             "ostatus": "http://ostatus.org#",
             "schema": "http://schema.org",
index 6206107f7af2efdac33191fd6348542e5539cc64..f2f334992c686babc77d97b26b3ba0e1281dde75 100644 (file)
@@ -67,7 +67,9 @@ defmodule Pleroma.Web.MastodonAPI.AccountViewTest do
       source: %{
         note: "valid html",
         sensitive: false,
-        pleroma: %{},
+        pleroma: %{
+          discoverable: false
+        },
         fields: []
       },
       pleroma: %{
@@ -137,7 +139,9 @@ defmodule Pleroma.Web.MastodonAPI.AccountViewTest do
       source: %{
         note: user.bio,
         sensitive: false,
-        pleroma: %{},
+        pleroma: %{
+          discoverable: false
+        },
         fields: []
       },
       pleroma: %{
@@ -310,7 +314,9 @@ defmodule Pleroma.Web.MastodonAPI.AccountViewTest do
       source: %{
         note: user.bio,
         sensitive: false,
-        pleroma: %{},
+        pleroma: %{
+          discoverable: false
+        },
         fields: []
       },
       pleroma: %{