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
|
use Ecto.Schema
|
||||||
|
|
||||||
alias Pleroma.EctoType.ActivityPub.ObjectValidators
|
alias Pleroma.EctoType.ActivityPub.ObjectValidators
|
||||||
|
alias Pleroma.Object.Fetcher
|
||||||
alias Pleroma.Web.ActivityPub.ObjectValidators.CommonFixes
|
alias Pleroma.Web.ActivityPub.ObjectValidators.CommonFixes
|
||||||
alias Pleroma.Web.ActivityPub.ObjectValidators.CommonValidations
|
alias Pleroma.Web.ActivityPub.ObjectValidators.CommonValidations
|
||||||
alias Pleroma.Web.ActivityPub.Transmogrifier
|
alias Pleroma.Web.ActivityPub.Transmogrifier
|
||||||
alias Pleroma.Object.Fetcher
|
|
||||||
|
|
||||||
import Ecto.Changeset
|
import Ecto.Changeset
|
||||||
|
|
||||||
|
|
|
@ -69,7 +69,12 @@ def changeset(struct, %{"type" => "Emoji"} = data) do
|
||||||
end
|
end
|
||||||
|
|
||||||
def changeset(struct, %{"type" => "Book"} = data) do
|
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
|
struct
|
||||||
|> cast(data, [:type, :name])
|
|> cast(data, [:type, :name])
|
||||||
|
@ -77,7 +82,14 @@ def changeset(struct, %{"type" => "Book"} = data) do
|
||||||
end
|
end
|
||||||
|
|
||||||
def changeset(struct, %{"type" => "Edition"} = data) do
|
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
|
struct
|
||||||
|> cast(data, [:type, :name])
|
|> cast(data, [:type, :name])
|
||||||
|
@ -85,7 +97,12 @@ def changeset(struct, %{"type" => "Edition"} = data) do
|
||||||
end
|
end
|
||||||
|
|
||||||
def changeset(struct, %{"type" => "Work"} = data) do
|
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
|
struct
|
||||||
|> cast(data, [:type, :name])
|
|> cast(data, [:type, :name])
|
||||||
|
|
Loading…
Reference in a new issue