forked from mirrors/bookwyrm
Keep any status that mentions a local user
This commit is contained in:
parent
ffc4cc2018
commit
d65657882e
1 changed files with 13 additions and 2 deletions
|
@ -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)
|
||||||
|
|
Loading…
Reference in a new issue