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:
rimu 2024-08-10 18:42:49 +12:00
parent 654c4fe42e
commit 058cef2871

View file

@ -517,18 +517,17 @@ def process_inbox_request(request_json, activitypublog_id, ip_address):
rjs = [request_json, request_json['object']]
else:
rjs = [request_json]
local_community_prefix = f"https://{current_app.config['SERVER_NAME']}/c/"
followers_suffix = '/followers'
for rj in rjs:
for loc in locations:
if loc in rj:
id = rj[loc]
if isinstance(id, str):
if id.startswith(local_community_prefix) and not id.endswith(followers_suffix):
community_ap_id = id
if isinstance(id, list):
for c in id:
if c.startswith(local_community_prefix) and not c.endswith(followers_suffix):
for location in locations:
if location in rj:
potential_id = rj[location]
if isinstance(potential_id, str):
if not potential_id.startswith('https://www.w3.org') and not potential_id.endswith(followers_suffix):
community_ap_id = potential_id
if isinstance(potential_id, list):
for c in potential_id:
if not c.startswith('https://www.w3.org') and not c.endswith(followers_suffix):
community_ap_id = c
break
if community_ap_id: