mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-12-23 00:26:33 +00:00
Merge pull request #1614 from bookwyrm-social/outbox-error
Safer call to get preview image or books
This commit is contained in:
commit
2968145627
1 changed files with 4 additions and 2 deletions
|
@ -189,8 +189,10 @@ class Status(OrderedCollectionPageMixin, BookWyrmModel):
|
|||
if hasattr(activity, "name"):
|
||||
activity.name = self.pure_name
|
||||
activity.type = self.pure_type
|
||||
books = [getattr(self, "book", None)] + list(self.mention_books.all())
|
||||
if len(books) == 1 and books[0].preview_image:
|
||||
book = getattr(self, "book", None)
|
||||
books = [book] if book else []
|
||||
books += list(self.mention_books.all())
|
||||
if len(books) == 1 and getattr(books[0], "preview_image", None):
|
||||
covers = [
|
||||
activitypub.Document(
|
||||
url=fields.get_absolute_url(books[0].preview_image),
|
||||
|
|
Loading…
Reference in a new issue