Handle posts with only contentMap as post instead of interaction (#549)

pull/550/head
Christof Dorner 2023-03-23 19:27:32 +01:00 zatwierdzone przez GitHub
rodzic ea7d5f307c
commit e45195bb02
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
2 zmienionych plików z 24 dodań i 3 usunięć

Wyświetl plik

@ -362,9 +362,7 @@ def test_inbound_posts(
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-post")
assert post.content == "post version one"
assert post.published.day == 13
@ -430,6 +428,28 @@ 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
stator.run_single_cycle_sync()
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