forked from mirrors/bookwyrm
Catches straggler preview_image signal
This commit is contained in:
parent
59938e2d46
commit
60626eaca1
1 changed files with 10 additions and 6 deletions
|
@ -13,6 +13,7 @@ from model_utils.managers import InheritanceManager
|
||||||
|
|
||||||
from bookwyrm import activitypub
|
from bookwyrm import activitypub
|
||||||
from bookwyrm.preview_images import generate_edition_preview_image_task
|
from bookwyrm.preview_images import generate_edition_preview_image_task
|
||||||
|
from bookwyrm.settings import ENABLE_PREVIEW_IMAGES
|
||||||
from .activitypub_mixin import ActivitypubMixin, ActivityMixin
|
from .activitypub_mixin import ActivitypubMixin, ActivityMixin
|
||||||
from .activitypub_mixin import OrderedCollectionPageMixin
|
from .activitypub_mixin import OrderedCollectionPageMixin
|
||||||
from .base_model import BookWyrmModel
|
from .base_model import BookWyrmModel
|
||||||
|
@ -405,10 +406,13 @@ class Boost(ActivityMixin, Status):
|
||||||
# unique_together = ('user', 'boosted_status')
|
# unique_together = ('user', 'boosted_status')
|
||||||
|
|
||||||
|
|
||||||
@receiver(models.signals.post_save)
|
|
||||||
# pylint: disable=unused-argument
|
# pylint: disable=unused-argument
|
||||||
|
@receiver(models.signals.post_save)
|
||||||
def preview_image(instance, sender, *args, **kwargs):
|
def preview_image(instance, sender, *args, **kwargs):
|
||||||
if sender in (Review, ReviewRating):
|
"""Updates book previews if the rating has changed"""
|
||||||
|
if not ENABLE_PREVIEW_IMAGES or sender not in (Review, ReviewRating):
|
||||||
|
return
|
||||||
|
|
||||||
changed_fields = instance.field_tracker.changed()
|
changed_fields = instance.field_tracker.changed()
|
||||||
|
|
||||||
if len(changed_fields) > 0:
|
if len(changed_fields) > 0:
|
||||||
|
|
Loading…
Reference in a new issue