Fixes unblock signal

This commit is contained in:
Mouse Reeve 2021-10-03 11:46:26 -07:00
parent 668f71f96c
commit 0798ba028f
2 changed files with 10 additions and 3 deletions

View file

@ -331,8 +331,15 @@ def remove_statuses_on_block(sender, instance, *args, **kwargs):
@receiver(signals.post_delete, sender=models.UserBlocks) @receiver(signals.post_delete, sender=models.UserBlocks)
# pylint: disable=unused-argument # pylint: disable=unused-argument
def add_statuses_on_unblock(sender, instance, *args, **kwargs): def add_statuses_on_unblock(sender, instance, *args, **kwargs):
"""remove statuses from all feeds on block""" """add statuses back to all feeds on unblock"""
public_streams = [v for (k, v) in streams.items() if k != "home"] # make sure there isn't a block in the other direction
if models.UserBlocks.objects.filter(
user_subject=instance.user_object,
user_object=instance.user_subject,
).exists():
return
public_streams = [k for (k, v) in streams.items() if k != "home"]
# add statuses back to streams with statuses from anyone # add statuses back to streams with statuses from anyone
if instance.user_subject.local: if instance.user_subject.local:

View file

@ -14,7 +14,7 @@ class Block(View):
"""blocking users""" """blocking users"""
def get(self, request): def get(self, request):
"""list of blocked users?""" """list of blocked users"""
return TemplateResponse(request, "preferences/blocks.html") return TemplateResponse(request, "preferences/blocks.html")
def post(self, request, user_id): def post(self, request, user_id):