1
0
Fork 0

Merge branch 'master' into works-editions

This commit is contained in:
Mouse Reeve 2020-03-30 15:30:06 -07:00
commit 5c4d078f92
12 changed files with 140 additions and 3 deletions

View file

@ -1,6 +1,6 @@
''' bring all the models into the app namespace '''
from .book import Connector, Book, Work, Edition, Author
from .shelf import Shelf, ShelfBook
from .status import Status, Review, Comment, Favorite, Tag, Notification
from .status import Status, Review, Comment, Favorite, Boost, Tag, Notification
from .user import User, UserFollows, UserFollowRequest, UserBlocks
from .user import FederatedServer

View file

@ -89,6 +89,21 @@ class Favorite(FedireadsModel):
unique_together = ('user', 'status')
class Boost(Status):
''' boost'ing a post '''
boosted_status = models.ForeignKey(
'Status',
on_delete=models.PROTECT,
related_name="boosters")
def save(self, *args, **kwargs):
self.status_type = 'Boost'
self.activity_type = 'Announce'
super().save(*args, **kwargs)
# This constraint can't work as it would cross tables.
# class Meta:
# unique_together = ('user', 'boosted_status')
class Tag(FedireadsModel):
''' freeform tags for books '''
user = models.ForeignKey('User', on_delete=models.PROTECT)
@ -107,7 +122,7 @@ class Tag(FedireadsModel):
NotificationType = models.TextChoices(
'NotificationType', 'FAVORITE REPLY TAG FOLLOW FOLLOW_REQUEST')
'NotificationType', 'FAVORITE REPLY TAG FOLLOW FOLLOW_REQUEST BOOST')
class Notification(FedireadsModel):
''' you've been tagged, liked, followed, etc '''