Adds status type for app-generated statuses

This commit is contained in:
Mouse Reeve
2020-09-28 17:26:15 -07:00
parent 10d18cc633
commit 39931e2e69
6 changed files with 47 additions and 11 deletions

View File

@ -99,6 +99,21 @@ class Status(OrderedCollectionPageMixin, BookWyrmModel):
**kwargs
)
class GeneratedStatus(Status):
''' these are app-generated messages about user activity '''
@property
def ap_pure_content(self):
''' indicate the book in question for mastodon (or w/e) users '''
message = self.content
books = ', '.join(
'<a href="%s">"%s"</a>' % (self.book.local_id, self.book.title) \
for book in self.mention_books
)
return '%s %s' % (message, books)
activity_serializer = activitypub.GeneratedNote
pure_activity_serializer = activitypub.Note
class Comment(Status):
''' like a review but without a rating and transient '''