1
0
Fork 0

Use update_fields to limit remove_list_tasks

If we know what fields were updated, we can avoid running this task.
This also adds some mocks where they are needed for the list view.
This commit is contained in:
Mouse Reeve 2022-07-02 13:06:29 -07:00
parent aae02dff9a
commit 3ad0a5d073
7 changed files with 43 additions and 22 deletions

View file

@ -129,7 +129,7 @@ class List(OrderedCollectionMixin, BookWyrmModel):
"""on save, update embed_key and avoid clash with existing code"""
if not self.embed_key:
self.embed_key = uuid.uuid4()
return super().save(*args, **kwargs)
super().save(*args, **kwargs)
class ListItem(CollectionItemMixin, BookWyrmModel):
@ -156,7 +156,7 @@ class ListItem(CollectionItemMixin, BookWyrmModel):
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)
self.book_list.save(broadcast=False, update_fields=["updated_date"])
list_owner = self.book_list.user
model = apps.get_model("bookwyrm.Notification", require_ready=True)