mirror of
https://akkoma.dev/AkkomaGang/akkoma.git
synced 2024-12-18 07:48:19 +00:00
parent
f5a315f04c
commit
e49b583147
|
@ -23,6 +23,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
||||||
- Follow/Block/Mute imports now spin off into *n* tasks to avoid the oban timeout
|
- Follow/Block/Mute imports now spin off into *n* tasks to avoid the oban timeout
|
||||||
- Transient activities recieved from remote servers are no longer persisted in the database
|
- Transient activities recieved from remote servers are no longer persisted in the database
|
||||||
- Overhauled static-fe view for logged-out users
|
- Overhauled static-fe view for logged-out users
|
||||||
|
- `published` is now a mandatory field in Note objects
|
||||||
|
|
||||||
## Removed
|
## Removed
|
||||||
- FollowBotPolicy
|
- FollowBotPolicy
|
||||||
|
|
|
@ -60,7 +60,8 @@ defmodule Mix.Tasks.Pleroma.Search.Meilisearch do
|
||||||
where:
|
where:
|
||||||
fragment("data->>'type' = 'Note'") and
|
fragment("data->>'type' = 'Note'") and
|
||||||
(fragment("data->'to' \\? ?", ^Pleroma.Constants.as_public()) or
|
(fragment("data->'to' \\? ?", ^Pleroma.Constants.as_public()) or
|
||||||
fragment("data->'cc' \\? ?", ^Pleroma.Constants.as_public())),
|
fragment("data->'cc' \\? ?", ^Pleroma.Constants.as_public())) and
|
||||||
|
fragment("data->>'published' IS NOT NULL"),
|
||||||
order_by: [desc: fragment("data->'published'")]
|
order_by: [desc: fragment("data->'published'")]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -172,7 +172,7 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidators.ArticleNotePageValidator do
|
||||||
defp validate_data(data_cng) do
|
defp validate_data(data_cng) do
|
||||||
data_cng
|
data_cng
|
||||||
|> validate_inclusion(:type, ["Article", "Note", "Page"])
|
|> validate_inclusion(:type, ["Article", "Note", "Page"])
|
||||||
|> validate_required([:id, :actor, :attributedTo, :type, :context])
|
|> validate_required([:id, :actor, :attributedTo, :type, :context, :published])
|
||||||
|> CommonValidations.validate_any_presence([:cc, :to])
|
|> CommonValidations.validate_any_presence([:cc, :to])
|
||||||
|> CommonValidations.validate_fields_match([:actor, :attributedTo])
|
|> CommonValidations.validate_fields_match([:actor, :attributedTo])
|
||||||
|> CommonValidations.validate_actor_presence()
|
|> CommonValidations.validate_actor_presence()
|
||||||
|
|
44
test/fixtures/mastodon/note-without-published.json
vendored
Normal file
44
test/fixtures/mastodon/note-without-published.json
vendored
Normal file
|
@ -0,0 +1,44 @@
|
||||||
|
{
|
||||||
|
"@context" : [
|
||||||
|
"https://www.w3.org/ns/activitystreams",
|
||||||
|
"https://w3id.org/security/v1",
|
||||||
|
{
|
||||||
|
"Emoji" : "toot:Emoji",
|
||||||
|
"Hashtag" : "as:Hashtag",
|
||||||
|
"atomUri" : "ostatus:atomUri",
|
||||||
|
"conversation" : "ostatus:conversation",
|
||||||
|
"inReplyToAtomUri" : "ostatus:inReplyToAtomUri",
|
||||||
|
"manuallyApprovesFollowers" : "as:manuallyApprovesFollowers",
|
||||||
|
"movedTo" : "as:movedTo",
|
||||||
|
"ostatus" : "http://ostatus.org#",
|
||||||
|
"sensitive" : "as:sensitive",
|
||||||
|
"toot" : "http://joinmastodon.org/ns#"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"atomUri" : "http://mastodon.example.org/users/admin/statuses/99541947525187367",
|
||||||
|
"attachment" : [
|
||||||
|
{
|
||||||
|
"mediaType" : "image/jpeg",
|
||||||
|
"name" : null,
|
||||||
|
"type" : "Document",
|
||||||
|
"url" : "http://mastodon.example.org/system/media_attachments/files/000/000/002/original/334ce029e7bfb920.jpg"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"attributedTo" : "http://mastodon.example.org/users/admin",
|
||||||
|
"cc" : [
|
||||||
|
"http://mastodon.example.org/users/admin/followers"
|
||||||
|
],
|
||||||
|
"content" : "<p>yeah.</p>",
|
||||||
|
"conversation" : "tag:mastodon.example.org,2018-02-17:objectId=59:objectType=Conversation",
|
||||||
|
"id" : "http://mastodon.example.org/users/admin/statuses/99541947525187367",
|
||||||
|
"inReplyTo" : null,
|
||||||
|
"inReplyToAtomUri" : null,
|
||||||
|
"sensitive" : false,
|
||||||
|
"summary" : null,
|
||||||
|
"tag" : [],
|
||||||
|
"to" : [
|
||||||
|
"https://www.w3.org/ns/activitystreams#Public"
|
||||||
|
],
|
||||||
|
"type" : "Note",
|
||||||
|
"url" : "http://mastodon.example.org/@admin/99541947525187367"
|
||||||
|
}
|
|
@ -28,6 +28,7 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidators.ArticleNotePageValidatorTest
|
||||||
"to" => [user.follower_address],
|
"to" => [user.follower_address],
|
||||||
"cc" => [],
|
"cc" => [],
|
||||||
"content" => "Hellow this is content.",
|
"content" => "Hellow this is content.",
|
||||||
|
"published" => "2021-01-01T00:00:00Z",
|
||||||
"context" => "xxx",
|
"context" => "xxx",
|
||||||
"summary" => "a post"
|
"summary" => "a post"
|
||||||
}
|
}
|
||||||
|
@ -65,6 +66,12 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidators.ArticleNotePageValidatorTest
|
||||||
ArticleNotePageValidator.cast_and_validate(note)
|
ArticleNotePageValidator.cast_and_validate(note)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
test "a note without a published field should not validate", _ do
|
||||||
|
insert(:user, %{ap_id: "http://mastodon.example.org/users/admin"})
|
||||||
|
note = Jason.decode!(File.read!("test/fixtures/mastodon/note-without-published.json"))
|
||||||
|
%{valid?: false} = ArticleNotePageValidator.cast_and_validate(note)
|
||||||
|
end
|
||||||
|
|
||||||
test "a note with an attachment should work", _ do
|
test "a note with an attachment should work", _ do
|
||||||
insert(:user, %{ap_id: "https://owncast.localhost.localdomain/federation/user/streamer"})
|
insert(:user, %{ap_id: "https://owncast.localhost.localdomain/federation/user/streamer"})
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue