diff --git a/lib/pleroma/web/activity_pub/object_validators/article_note_page_validator.ex b/lib/pleroma/web/activity_pub/object_validators/article_note_page_validator.ex index 6beeca225..016929da0 100644 --- a/lib/pleroma/web/activity_pub/object_validators/article_note_page_validator.ex +++ b/lib/pleroma/web/activity_pub/object_validators/article_note_page_validator.ex @@ -6,10 +6,10 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidators.ArticleNotePageValidator do use Ecto.Schema alias Pleroma.EctoType.ActivityPub.ObjectValidators + alias Pleroma.Object.Fetcher alias Pleroma.Web.ActivityPub.ObjectValidators.CommonFixes alias Pleroma.Web.ActivityPub.ObjectValidators.CommonValidations alias Pleroma.Web.ActivityPub.Transmogrifier - alias Pleroma.Object.Fetcher import Ecto.Changeset diff --git a/lib/pleroma/web/activity_pub/object_validators/tag_validator.ex b/lib/pleroma/web/activity_pub/object_validators/tag_validator.ex index 00d0194af..dd1bc53ed 100644 --- a/lib/pleroma/web/activity_pub/object_validators/tag_validator.ex +++ b/lib/pleroma/web/activity_pub/object_validators/tag_validator.ex @@ -69,7 +69,12 @@ def changeset(struct, %{"type" => "Emoji"} = data) do end def changeset(struct, %{"type" => "Book"} = data) do - data = Map.put(data, "name", data["title"]) + data = + if Map.has_key?(data, "title") do + Map.put(data, "name", data["title"]) + else + data + end struct |> cast(data, [:type, :name]) @@ -77,7 +82,14 @@ def changeset(struct, %{"type" => "Book"} = data) do end def changeset(struct, %{"type" => "Edition"} = data) do - data = Map.put(data, "name", data["title"]) + # Sometimes it's title, sometimes name + # Don't ask me. + data = + if Map.has_key?(data, "title") do + Map.put(data, "name", data["title"]) + else + data + end struct |> cast(data, [:type, :name]) @@ -85,7 +97,12 @@ def changeset(struct, %{"type" => "Edition"} = data) do end def changeset(struct, %{"type" => "Work"} = data) do - data = Map.put(data, "name", data["title"]) + data = + if Map.has_key?(data, "title") do + Map.put(data, "name", data["title"]) + else + data + end struct |> cast(data, [:type, :name])