Skip to content

Commit b8fec67

Browse files
mauromsljoemull
authored andcommitted
#4491: Fix post_clear signal
1 parent 1f95339 commit b8fec67

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/submission/models.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3363,18 +3363,23 @@ def backwards_compat_authors(
33633363
was removed. This signal is a backwards compatibility measure to ensure
33643364
FrozenAuthor records are being updated correctly.
33653365
"""
3366-
accounts = core_models.Account.objects.filter(pk__in=pk_set)
33673366
if action == "post_add":
33683367
subq = models.Subquery(
33693368
ArticleAuthorOrder.objects.filter(
33703369
article=instance, author__id=models.OuterRef("id")
33713370
).values_list("order")
33723371
)
3372+
accounts = core_models.Account.objects.filter(pk__in=pk_set)
33733373
accounts = accounts.annotate(order=subq).order_by("order")
33743374
for account in accounts:
33753375
account.snapshot_as_author(instance)
3376-
if action in ["post_remove", "post_clear"]:
3376+
3377+
if action == "post_remove":
3378+
accounts = core_models.Account.objects.filter(pk__in=pk_set)
33773379
instance.frozen_authors().filter(author__in=pk_set).delete()
33783380

3381+
if action == "post_clear":
3382+
instance.frozen_authors().delete()
3383+
33793384

33803385
m2m_changed.connect(backwards_compat_authors, sender=Article.authors.through)

0 commit comments

Comments
 (0)