ChatMessage: `attachment` Validation is too strict
Environment
ask @tusooa
- Installation type (OTP or From Source):
- Pleroma version (could be found in the "Version" tab of settings in Pleroma-FE): 2.6.0-0-g2c7e0b20
- Elixir version (
elixir -v
for from source installations, N/A for OTP): - Operating system:
- PostgreSQL version (
psql -V
):
Bug description
I'm implementing federation from Firefish Chat to Pleroma Chat . Then I realized I'd been stumbling on a trap for too long.
Pleroma strictly checks ChatMessage.attachment
, requiring that it either does not exist or is not empty. In fact, better compatibility would be achieved if empty arrays were allowed.
iex(pleroma@127.0.0.1)9> Pleroma.Web.ActivityPub.ObjectValidator.validate(c, local: false)
{:error,
#Ecto.Changeset<
action: :insert,
changes: %{
actor: "....(hidden)",
attachment: #Ecto.Changeset<
action: :insert,
changes: %{},
errors: [
type: {"can't be blank", [validation: :required]},
url: {"can't be blank", [validation: :required]}
],
data: #Pleroma.Web.ActivityPub.ObjectValidators.AttachmentValidator<>,
valid?: false
>,
content: "<p><span>ChatMessage test?</span></p>",
id: "....(hidden)",
published: "2023-12-25T17:33:42.742Z",
to: [""....(hidden)""],
type: "ChatMessage"
},
errors: [],
data: #Pleroma.Web.ActivityPub.ObjectValidators.ChatMessageValidator<>,
valid?: false
>}