mirror of
https://git.pleroma.social/pleroma/pleroma.git
synced 2026-02-15 17:16:57 +00:00
Support indexable for use by Mastodon search
Signed-off-by: nicole mikołajczyk <git@mkljczk.pl>
This commit is contained in:
parent
a7a3978a20
commit
441cd77966
11 changed files with 39 additions and 7 deletions
1
changelog.d/mastodon-indexable.add
Normal file
1
changelog.d/mastodon-indexable.add
Normal file
|
|
@ -0,0 +1 @@
|
|||
Support `indexable` for use by Mastodon search
|
||||
|
|
@ -162,6 +162,7 @@ defmodule Pleroma.User do
|
|||
field(:birthday, :date)
|
||||
field(:show_birthday, :boolean, default: false)
|
||||
field(:language, :string)
|
||||
field(:indexable, :boolean, default: true)
|
||||
|
||||
embeds_one(
|
||||
:notification_settings,
|
||||
|
|
@ -534,7 +535,8 @@ defmodule Pleroma.User do
|
|||
:accepts_chat_messages,
|
||||
:pinned_objects,
|
||||
:birthday,
|
||||
:show_birthday
|
||||
:show_birthday,
|
||||
:indexable
|
||||
]
|
||||
)
|
||||
|> cast(params, [:name], empty_values: [])
|
||||
|
|
@ -597,7 +599,8 @@ defmodule Pleroma.User do
|
|||
:accepts_chat_messages,
|
||||
:disclose_client,
|
||||
:birthday,
|
||||
:show_birthday
|
||||
:show_birthday,
|
||||
:indexable
|
||||
]
|
||||
)
|
||||
|> validate_min_age()
|
||||
|
|
|
|||
|
|
@ -1692,7 +1692,8 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
|
|||
birthday: birthday,
|
||||
show_birthday: show_birthday,
|
||||
pinned_objects: pinned_objects,
|
||||
nickname: nickname
|
||||
nickname: nickname,
|
||||
indexable: Map.get(data, "indexable", true)
|
||||
}
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -59,7 +59,8 @@ defmodule Pleroma.Web.ActivityPub.UserView do
|
|||
"publicKeyPem" => public_key
|
||||
},
|
||||
"endpoints" => endpoints,
|
||||
"invisible" => User.invisible?(user)
|
||||
"invisible" => User.invisible?(user),
|
||||
"indexable" => user.indexable
|
||||
}
|
||||
|> Map.merge(Utils.make_json_ld_header())
|
||||
end
|
||||
|
|
@ -129,7 +130,8 @@ defmodule Pleroma.Web.ActivityPub.UserView do
|
|||
"alsoKnownAs" => user.also_known_as,
|
||||
"vcard:bday" => birthday,
|
||||
"webfinger" => "acct:#{User.full_nickname(user)}",
|
||||
"published" => Pleroma.Web.CommonAPI.Utils.to_masto_date(user.inserted_at)
|
||||
"published" => Pleroma.Web.CommonAPI.Utils.to_masto_date(user.inserted_at),
|
||||
"indexable" => user.indexable
|
||||
}
|
||||
|> Map.merge(
|
||||
maybe_make_image(
|
||||
|
|
|
|||
|
|
@ -861,6 +861,11 @@ defmodule Pleroma.Web.ApiSpec.AccountOperation do
|
|||
type: :string,
|
||||
nullable: true,
|
||||
description: "Header image description."
|
||||
},
|
||||
indexable: %Schema{
|
||||
allOf: [BooleanLike],
|
||||
nullable: true,
|
||||
description: "Whether public posts should be searchable to anyone (used by software like Mastodon)."
|
||||
}
|
||||
},
|
||||
example: %{
|
||||
|
|
@ -883,7 +888,8 @@ defmodule Pleroma.Web.ApiSpec.AccountOperation do
|
|||
discoverable: false,
|
||||
actor_type: "Person",
|
||||
show_birthday: false,
|
||||
birthday: "2001-02-12"
|
||||
birthday: "2001-02-12",
|
||||
indexable: true
|
||||
}
|
||||
}
|
||||
end
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ defmodule Pleroma.Web.ApiSpec.Schemas.Account do
|
|||
statuses_count: %Schema{type: :integer},
|
||||
url: %Schema{type: :string, format: :uri},
|
||||
username: %Schema{type: :string},
|
||||
indexable: %Schema{type: :boolean},
|
||||
pleroma: %Schema{
|
||||
type: :object,
|
||||
properties: %{
|
||||
|
|
|
|||
|
|
@ -202,7 +202,8 @@ defmodule Pleroma.Web.MastodonAPI.AccountController do
|
|||
:allow_following_move,
|
||||
:also_known_as,
|
||||
:accepts_chat_messages,
|
||||
:show_birthday
|
||||
:show_birthday,
|
||||
:indexable
|
||||
]
|
||||
|> Enum.reduce(%{}, fn key, acc ->
|
||||
Maps.put_if_present(acc, key, params[key], &{:ok, Params.truthy_param?(&1)})
|
||||
|
|
|
|||
|
|
@ -308,6 +308,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountView do
|
|||
}
|
||||
},
|
||||
last_status_at: last_status_at,
|
||||
indexable: user.indexable,
|
||||
|
||||
# Pleroma extensions
|
||||
# Note: it's insecure to output :email but fully-qualified nickname may serve as safe stub
|
||||
|
|
|
|||
|
|
@ -0,0 +1,13 @@
|
|||
# Pleroma: A lightweight social networking server
|
||||
# Copyright © 2017-2026 Pleroma Authors <https://pleroma.social/>
|
||||
# SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
defmodule Pleroma.Repo.Migrations.AddIndexableToUsers do
|
||||
use Ecto.Migration
|
||||
|
||||
def change do
|
||||
alter table(:users) do
|
||||
add(:indexable, :boolean, default: true, null: false)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -13,6 +13,7 @@
|
|||
"@type": "@id"
|
||||
},
|
||||
"discoverable": "toot:discoverable",
|
||||
"indexable": "toot:indexable",
|
||||
"manuallyApprovesFollowers": "as:manuallyApprovesFollowers",
|
||||
"capabilities": "litepub:capabilities",
|
||||
"ostatus": "http://ostatus.org#",
|
||||
|
|
|
|||
|
|
@ -78,6 +78,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountViewTest do
|
|||
},
|
||||
fqn: "shp@shitposter.club",
|
||||
last_status_at: user.last_status_at |> NaiveDateTime.to_date() |> Date.to_iso8601(),
|
||||
indexable: true,
|
||||
pleroma: %{
|
||||
ap_id: user.ap_id,
|
||||
also_known_as: ["https://shitposter.zone/users/shp"],
|
||||
|
|
@ -343,6 +344,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountViewTest do
|
|||
},
|
||||
fqn: "shp@shitposter.club",
|
||||
last_status_at: nil,
|
||||
indexable: true,
|
||||
pleroma: %{
|
||||
ap_id: user.ap_id,
|
||||
also_known_as: [],
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue