From 216915ddb8d1dc88363ced775f6e154c8f7978a1 Mon Sep 17 00:00:00 2001 From: Christof Dorner Date: Sun, 2 Apr 2023 00:07:38 +0000 Subject: [PATCH] set post attachment type correctly for videos (#553) --- activities/models/post_attachment.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/activities/models/post_attachment.py b/activities/models/post_attachment.py index 0b723ca..d7c5474 100644 --- a/activities/models/post_attachment.py +++ b/activities/models/post_attachment.py @@ -131,9 +131,14 @@ class PostAttachment(StatorModel): ### Mastodon Client API ### def to_mastodon_json(self): + type_ = "unknown" + if self.is_image(): + type_ = "image" + elif self.is_video(): + type_ = "video" value = { "id": self.pk, - "type": "image" if self.is_image() else "unknown", + "type": type_, "url": self.full_url().absolute, "preview_url": self.thumbnail_url().absolute, "remote_url": None,