Merge pull request #476 from mouse-reeve/fixes-federation

Fixes null value in status attachment array
This commit is contained in:
Mouse Reeve 2021-01-03 20:08:10 -08:00 committed by GitHub
commit b960d8a40f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -118,7 +118,7 @@ class Status(OrderedCollectionPageMixin, BookWyrmModel):
activity['attachment'] = [ activity['attachment'] = [
image_serializer(b.cover, b.alt_text) \ image_serializer(b.cover, b.alt_text) \
for b in self.mention_books.all()[:4] if b.cover] for b in self.mention_books.all()[:4] if b.cover]
if hasattr(self, 'book'): if hasattr(self, 'book') and self.book.cover:
activity['attachment'].append( activity['attachment'].append(
image_serializer(self.book.cover, self.book.alt_text) image_serializer(self.book.cover, self.book.alt_text)
) )