handle posts with only contentMap as post instead of interaction

pull/549/head
Christof Dorner 2023-03-23 09:48:02 +01:00
rodzic ea7d5f307c
commit 82a0c8f791
2 zmienionych plików z 26 dodań i 1 usunięć

Wyświetl plik

@ -430,6 +430,30 @@ def test_inbound_posts(
stator.run_single_cycle_sync()
assert not Post.objects.filter(object_uri="https://remote.test/test-post").exists()
# Create an inbound new post message with only contentMap
message = {
"id": "test",
"type": "Create",
"actor": remote_identity.actor_uri,
"object": {
"id": "https://remote.test/test-map-only",
"type": "Note",
"published": "2022-11-13T23:20:16Z",
"attributedTo": remote_identity.actor_uri,
"contentMap": {"und": "post with only content map"},
},
}
InboxMessage.objects.create(message=message)
# Run stator and ensure that made the post
print("prestat")
stator.run_single_cycle_sync()
print("poststat")
post = Post.objects.get(object_uri="https://remote.test/test-map-only")
assert post.content == "post with only content map"
assert post.published.day == 13
assert post.url == "https://remote.test/test-map-only"
@pytest.mark.django_db
def test_post_hashtag_to_ap(identity: Identity, config_system):

Wyświetl plik

@ -222,4 +222,5 @@ class InboxMessage(StatorModel):
@property
def message_object_has_content(self):
return "content" in self.message.get("object", {})
object = self.message.get("object", {})
return "content" in object or "contentMap" in object