mirror of
https://codeberg.org/rimu/pyfedi
synced 2025-01-23 19:36:56 -08:00
Avoid announcing activity sent to local users unless it is also in a local community
This commit is contained in:
parent
51fd56b1d3
commit
63a8ba3960
1 changed files with 6 additions and 3 deletions
|
@ -582,7 +582,7 @@ def process_inbox_request(request_json, activitypublog_id, ip_address):
|
|||
if can_create_post_reply(user, community):
|
||||
try:
|
||||
post = create_post_reply(activity_log, community, in_reply_to, request_json, user)
|
||||
if post and community.is_local():
|
||||
if post:
|
||||
announce_activity_to_followers(community, user, request_json)
|
||||
except TypeError as e:
|
||||
activity_log.exception_message = 'TypeError. See log file.'
|
||||
|
@ -984,7 +984,6 @@ def process_inbox_request(request_json, activitypublog_id, ip_address):
|
|||
if reply:
|
||||
if can_edit(request_json['actor'], reply):
|
||||
update_post_reply_from_activity(reply, request_json)
|
||||
if reply.community.is_local():
|
||||
announce_activity_to_followers(reply.community, reply.author, request_json)
|
||||
activity_log.result = 'success'
|
||||
else:
|
||||
|
@ -1191,6 +1190,10 @@ def process_delete_request(request_json, activitypublog_id, ip_address):
|
|||
|
||||
|
||||
def announce_activity_to_followers(community, creator, activity):
|
||||
# avoid announcing activity sent to local users unless it is also in a local community
|
||||
if not community.is_local():
|
||||
return
|
||||
|
||||
# remove context from what will be inner object
|
||||
del activity["@context"]
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue