fed/in: align question and note validator fixes
All checks were successful
ci/woodpecker/pr/test/2 Pipeline was successful
ci/woodpecker/pr/test/1 Pipeline was successful
ci/woodpecker/push/docs Pipeline was successful
ci/woodpecker/push/publish/4 Pipeline was successful
ci/woodpecker/push/publish/1 Pipeline was successful
ci/woodpecker/push/publish/2 Pipeline was successful

The question fixups were lacking several necessary interop
adjustments failing e.g. to parse a Question with a
single hashtag not wrapped into an array.
This commit is contained in:
Oneric 2026-05-31 00:00:00 +00:00
commit 678f6fdb78
4 changed files with 24 additions and 6 deletions

View file

@ -25,6 +25,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- fixed later search result pages again fetching remote content
- handle reports referring to a single plain id as their object;
affected e.g. JSON-LD compacted reports without status references from Iceshrimp.NET
- fixed several issues parsing remote Question objects
### Changed
- New installations (not existing instances) now default to the `simple` full-text-search config

View file

@ -179,7 +179,7 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidators.ArticleNotePageValidator do
defp fix_content_map_languages(object), do: object
defp fix(data) do
def fix(data) do
data
|> CommonFixes.fix_actor()
|> CommonFixes.fix_object_defaults()

View file

@ -6,10 +6,9 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidators.QuestionValidator do
use Ecto.Schema
alias Pleroma.EctoType.ActivityPub.ObjectValidators
alias Pleroma.Web.ActivityPub.ObjectValidators.CommonFixes
alias Pleroma.Web.ActivityPub.ObjectValidators.ArticleNotePageValidator
alias Pleroma.Web.ActivityPub.ObjectValidators.CommonValidations
alias Pleroma.Web.ActivityPub.ObjectValidators.QuestionOptionsValidator
alias Pleroma.Web.ActivityPub.Transmogrifier
import Ecto.Changeset
@ -62,9 +61,7 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidators.QuestionValidator do
defp fix(data) do
data
|> CommonFixes.fix_actor()
|> CommonFixes.fix_object_defaults()
|> Transmogrifier.fix_emoji()
|> ArticleNotePageValidator.fix()
|> fix_closed()
end

View file

@ -103,6 +103,26 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier.QuestionHandlingTest do
assert Enum.sort(object.data["oneOf"]) == Enum.sort(options)
end
test "GTS Question activity with a single, non-array tag" do
tag = %{
"href" => "https://gts.example/tags/caturday",
"name" => "#caturday",
"type" => "Hashtag"
}
data =
File.read!("test/fixtures/mastodon-question-activity.json")
|> Jason.decode!()
|> Kernel.put_in(["object", "tag"], tag)
{:ok, %Activity{local: false} = activity} = Transmogrifier.handle_incoming(data)
object = Object.normalize(activity, fetch: false)
[parsed_tag, tag_name] = Enum.sort(object.data["tag"])
assert tag_name == "caturday"
assert parsed_tag == %{tag | "name" => tag_name}
end
test "Mastodon Question activity with custom emojis" do
options = [
%{