fix api for item/post

This commit is contained in:
mein Name 2025-02-08 15:20:52 -05:00 committed by Henri Dickson
parent fd99e2bc4d
commit a1387fef9e
2 changed files with 6 additions and 6 deletions

View file

@ -30,8 +30,8 @@ class Account(Schema):
note: str
avatar: str
avatar_static: str
header: str | None = Field(...)
header_static: str | None = Field(...)
header: str
header_static: str
locked: bool
fields: list[AccountField]
emojis: list[CustomEmoji]

View file

@ -789,23 +789,23 @@ class Identity(models.Model):
else:
return f"/proxy/identity_icon/{self.pk}/"
def local_image_url(self) -> RelativeAbsoluteUrl | None:
def local_image_url(self) -> str | None:
"""
Returns a background image for us, returning None if there isn't one
"""
if self.image:
return AutoAbsoluteUrl(self.image.url)
return AutoAbsoluteUrl(self.image.url).absolute
elif self.image_uri:
return ProxyAbsoluteUrl(
f"/proxy/identity_image/{self.pk}/",
remote_url=self.image_uri,
)
).absolute
return None
def to_mastodon_json(self, source=False):
missing = StaticAbsoluteUrl("img/missing.png").absolute
header_image = self.local_image_url() or missing
icon_image = self.local_icon_url()
icon_image = self.local_icon_url() or missing
metadata_value_text = (
" ".join([m["value"] for m in self.metadata]) if self.metadata else ""
)