mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-11-26 11:31:08 +00:00
Set updated date on list when item is added
This commit is contained in:
parent
9b949d9845
commit
f7b0a282a7
2 changed files with 6 additions and 1 deletions
|
@ -1,6 +1,7 @@
|
|||
""" make a list of books!! """
|
||||
from django.apps import apps
|
||||
from django.db import models
|
||||
from django.utils import timezone
|
||||
|
||||
from bookwyrm import activitypub
|
||||
from bookwyrm.settings import DOMAIN
|
||||
|
@ -79,6 +80,10 @@ class ListItem(CollectionItemMixin, BookWyrmModel):
|
|||
""" create a notification too """
|
||||
created = not bool(self.id)
|
||||
super().save(*args, **kwargs)
|
||||
# tick the updated date on the parent list
|
||||
self.book_list.updated_date = timezone.now()
|
||||
self.book_list.save(broadcast=False)
|
||||
|
||||
list_owner = self.book_list.user
|
||||
# create a notification if somoene ELSE added to a local user's list
|
||||
if created and list_owner.local and list_owner != self.user:
|
||||
|
|
|
@ -32,7 +32,7 @@ class Lists(View):
|
|||
item_count=Count("listitem", filter=Q(listitem__approved=True))
|
||||
).filter(
|
||||
item_count__gt=0
|
||||
).distinct().all()
|
||||
).order_by("-updated_date").distinct().all()
|
||||
|
||||
lists = privacy_filter(
|
||||
request.user, lists, privacy_levels=["public", "followers"]
|
||||
|
|
Loading…
Reference in a new issue