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,12 +199,23 @@ 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:
|
||||||
return
|
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
|
||||||
|
|
||||||
status = activity.to_model(model)
|
status = activity.to_model(model)
|
||||||
# create a notification if this is a reply
|
# create a notification if this is a reply
|
||||||
|
|
Loading…
Reference in a new issue