mirror of
https://github.com/jointakahe/takahe.git
synced 2024-11-22 15:21:01 +00:00
set post attachment type correctly for videos (#553)
This commit is contained in:
parent
96bc64fd01
commit
216915ddb8
1 changed files with 6 additions and 1 deletions
|
@ -131,9 +131,14 @@ class PostAttachment(StatorModel):
|
||||||
### Mastodon Client API ###
|
### Mastodon Client API ###
|
||||||
|
|
||||||
def to_mastodon_json(self):
|
def to_mastodon_json(self):
|
||||||
|
type_ = "unknown"
|
||||||
|
if self.is_image():
|
||||||
|
type_ = "image"
|
||||||
|
elif self.is_video():
|
||||||
|
type_ = "video"
|
||||||
value = {
|
value = {
|
||||||
"id": self.pk,
|
"id": self.pk,
|
||||||
"type": "image" if self.is_image() else "unknown",
|
"type": type_,
|
||||||
"url": self.full_url().absolute,
|
"url": self.full_url().absolute,
|
||||||
"preview_url": self.thumbnail_url().absolute,
|
"preview_url": self.thumbnail_url().absolute,
|
||||||
"remote_url": None,
|
"remote_url": None,
|
||||||
|
|
Loading…
Reference in a new issue