merge-requests/30/head
Bob Mottram 2024-07-15 20:01:13 +01:00
parent f3e0bdbc5f
commit d6cb1dbd46
2 changed files with 21 additions and 18 deletions

View File

@ -198,7 +198,8 @@ def manual_approve_follow_request(session, session_onion, session_i2p,
req_prefix = http_prefix + '://' + req_domain req_prefix = http_prefix + '://' + req_domain
paths = get_user_paths() paths = get_user_paths()
for user_path in paths: for user_path in paths:
if req_prefix + user_path + req_nick in approve_follows_str: if req_prefix + user_path + req_nick not in approve_follows_str:
continue
exists = True exists = True
approve_handle_full = req_prefix + user_path + req_nick approve_handle_full = req_prefix + user_path + req_nick
if group_account: if group_account:

26
maps.py
View File

@ -71,25 +71,27 @@ def get_location_from_post(post_json_object: {}) -> str:
# location representation used by pixelfed # location representation used by pixelfed
locn_exists = False locn_exists = False
locn2 = None
if post_obj.get('location'): if post_obj.get('location'):
if isinstance(post_obj['location'], dict): locn2 = post_obj['location']
if post_obj['location'].get('longitude') and \ if isinstance(locn2, dict):
post_obj['location'].get('latitude'): if locn2.get('longitude') and \
if isinstance(post_obj['location']['longitude'], str) and \ locn2.get('latitude'):
isinstance(post_obj['location']['latitude'], str): if isinstance(locn2['longitude'], str) and \
if is_float(post_obj['location']['longitude']) and \ isinstance(locn2['latitude'], str):
is_float(post_obj['location']['latitude']): if is_float(locn2['longitude']) and \
is_float(locn2['latitude']):
locn_exists = True locn_exists = True
if not locn_exists: if not locn_exists:
if post_obj['location'].get('name'): if locn2.get('name'):
if isinstance(post_obj['location']['name'], str): if isinstance(locn2['name'], str):
locn = post_obj['location']['name'] locn = locn2['name']
if locn_exists: if locn_exists:
osm_domain = 'osm.org' osm_domain = 'osm.org'
zoom = 17 zoom = 17
locn = _geocoords_to_osm_link(osm_domain, zoom, locn = _geocoords_to_osm_link(osm_domain, zoom,
post_obj['location']['latitude'], locn2['latitude'],
post_obj['location']['longitude']) locn2['longitude'])
return locn return locn