mirror of
https://codeberg.org/rimu/pyfedi
synced 2025-02-03 00:31:25 -08:00
MBin sends Create activities even for remote communities #290
Lemmy uses Announce -> Create for communities hosted on their instance and only uses Create when posting to a community on our instance. Mbin uses Create all the time.
This commit is contained in:
parent
654c4fe42e
commit
058cef2871
1 changed files with 11 additions and 12 deletions
|
@ -514,21 +514,20 @@ def process_inbox_request(request_json, activitypublog_id, ip_address):
|
||||||
community_ap_id = ''
|
community_ap_id = ''
|
||||||
locations = ['audience', 'cc', 'to']
|
locations = ['audience', 'cc', 'to']
|
||||||
if 'object' in request_json:
|
if 'object' in request_json:
|
||||||
rjs = [ request_json, request_json['object'] ]
|
rjs = [request_json, request_json['object']]
|
||||||
else:
|
else:
|
||||||
rjs = [ request_json ]
|
rjs = [request_json]
|
||||||
local_community_prefix = f"https://{current_app.config['SERVER_NAME']}/c/"
|
|
||||||
followers_suffix = '/followers'
|
followers_suffix = '/followers'
|
||||||
for rj in rjs:
|
for rj in rjs:
|
||||||
for loc in locations:
|
for location in locations:
|
||||||
if loc in rj:
|
if location in rj:
|
||||||
id = rj[loc]
|
potential_id = rj[location]
|
||||||
if isinstance(id, str):
|
if isinstance(potential_id, str):
|
||||||
if id.startswith(local_community_prefix) and not id.endswith(followers_suffix):
|
if not potential_id.startswith('https://www.w3.org') and not potential_id.endswith(followers_suffix):
|
||||||
community_ap_id = id
|
community_ap_id = potential_id
|
||||||
if isinstance(id, list):
|
if isinstance(potential_id, list):
|
||||||
for c in id:
|
for c in potential_id:
|
||||||
if c.startswith(local_community_prefix) and not c.endswith(followers_suffix):
|
if not c.startswith('https://www.w3.org') and not c.endswith(followers_suffix):
|
||||||
community_ap_id = c
|
community_ap_id = c
|
||||||
break
|
break
|
||||||
if community_ap_id:
|
if community_ap_id:
|
||||||
|
|
Loading…
Add table
Reference in a new issue