Keep any status that mentions a local user

This commit is contained in:
Mouse Reeve 2020-12-12 21:11:51 -08:00
parent ffc4cc2018
commit d65657882e

View file

@ -199,11 +199,22 @@ def handle_create(activity):
return return
if activity.type == 'Note': if activity.type == 'Note':
# discard notes that aren't replies to existing statuses # keep notes if they are replies to existing statuses
reply = models.Status.objects.filter( reply = models.Status.objects.filter(
remote_id=activity.inReplyTo remote_id=activity.inReplyTo
).first() ).first()
if not reply: if not reply:
discard = True
# keep notes if they mention local users
tags = [l['href'] for l in activity.tag if l['type'] == 'Mention']
for tag in tags:
if models.User.objects.filter(
remote_id=tag, local=True).exists():
# we found a mention of a known use boost
discard = False
break
if discard:
return return
status = activity.to_model(model) status = activity.to_model(model)