mirror of
https://github.com/jointakahe/takahe.git
synced 2024-11-25 08:41:00 +00:00
Handle posts with only contentMap as post instead of interaction (#549)
This commit is contained in:
parent
ea7d5f307c
commit
e45195bb02
2 changed files with 24 additions and 3 deletions
|
@ -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):
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue