Mention and notify users when creating a status

This commit is contained in:
Mouse Reeve
2020-11-01 10:13:51 -08:00
parent 4684a83e6f
commit 0cf1838276
6 changed files with 83 additions and 12 deletions

View File

@ -59,6 +59,7 @@ class Status(OrderedCollectionPageMixin, BookWyrmModel):
@property
def ap_tag(self):
''' references to books and/or users '''
tags = []
for book in self.mention_books.all():
tags.append(activitypub.Link(
@ -66,6 +67,11 @@ class Status(OrderedCollectionPageMixin, BookWyrmModel):
name=book.title,
type='Book'
))
for user in self.mention_users.all():
tags.append(activitypub.Mention(
href=user.remote_id,
name=user.username,
))
return tags
shared_mappings = [
@ -270,7 +276,7 @@ class ReadThrough(BookWyrmModel):
NotificationType = models.TextChoices(
'NotificationType',
'FAVORITE REPLY TAG FOLLOW FOLLOW_REQUEST BOOST IMPORT')
'FAVORITE REPLY MENTION TAG FOLLOW FOLLOW_REQUEST BOOST IMPORT')
class Notification(BookWyrmModel):
''' you've been tagged, liked, followed, etc '''