mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-12-23 16:40:36 +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"):
|
if hasattr(activity, "name"):
|
||||||
activity.name = self.pure_name
|
activity.name = self.pure_name
|
||||||
activity.type = self.pure_type
|
activity.type = self.pure_type
|
||||||
books = [getattr(self, "book", None)] + list(self.mention_books.all())
|
book = getattr(self, "book", None)
|
||||||
if len(books) == 1 and books[0].preview_image:
|
books = [book] if book else []
|
||||||
|
books += list(self.mention_books.all())
|
||||||
|
if len(books) == 1 and getattr(books[0], "preview_image", None):
|
||||||
covers = [
|
covers = [
|
||||||
activitypub.Document(
|
activitypub.Document(
|
||||||
url=fields.get_absolute_url(books[0].preview_image),
|
url=fields.get_absolute_url(books[0].preview_image),
|
||||||
|
|
Loading…
Reference in a new issue