mirror of
https://akkoma.dev/AkkomaGang/akkoma.git
synced 2024-12-22 17:27:18 +00:00
Merge remote-tracking branch 'upstream/bookwyrm-entities' into develop
This commit is contained in:
commit
34780cf182
|
@ -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
|
||||
|
||||
|
|
|
@ -69,7 +69,12 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidators.TagValidator 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 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidators.TagValidator 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 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidators.TagValidator 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])
|
||||
|
|
Loading…
Reference in a new issue