Merge pull request from bookwyrm-social/follow-request-recs

Remove follow suggestion on request
This commit is contained in:
Mouse Reeve 2021-10-04 13:14:32 -07:00 committed by GitHub
commit 2a97458878
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -148,6 +148,17 @@ def update_suggestions_on_follow(sender, instance, created, *args, **kwargs):
rerank_user_task.delay(instance.user_object.id, update_only=False)
@receiver(signals.post_save, sender=models.UserFollowRequest)
# pylint: disable=unused-argument
def update_suggestions_on_follow_request(sender, instance, created, *args, **kwargs):
"""remove a follow from the recs and update the ranks"""
if not created or not instance.user_object.discoverable:
return
if instance.user_subject.local:
remove_suggestion_task.delay(instance.user_subject.id, instance.user_object.id)
@receiver(signals.post_save, sender=models.UserBlocks)
# pylint: disable=unused-argument
def update_suggestions_on_block(sender, instance, *args, **kwargs):