mirror of
https://akkoma.dev/AkkomaGang/akkoma.git
synced 2024-11-10 02:05:12 +00:00
Allow for varying name fields
This commit is contained in:
parent
5c48fe1138
commit
2cc6b1e1bd
|
@ -69,7 +69,12 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidators.TagValidator 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 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidators.TagValidator 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 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidators.TagValidator 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