main
Bob Mottram 2022-06-12 13:30:14 +01:00
parent acdca2cfae
commit 3a8f2fa5d3
6 changed files with 16 additions and 25 deletions

View File

@ -2165,7 +2165,7 @@ class PubServer(BaseHTTPRequestHandler):
print('EX: Unable to save token for ' +
login_nickname + ' ' + str(ex))
person_upgrade_actor(base_dir, None, login_handle,
person_upgrade_actor(base_dir, None,
base_dir + '/accounts/' +
login_handle + '.json')
@ -2408,8 +2408,7 @@ class PubServer(BaseHTTPRequestHandler):
locate_post(base_dir, nickname, domain,
moderation_text)
if post_filename:
if can_remove_post(base_dir,
nickname, domain, port,
if can_remove_post(base_dir, domain, port,
moderation_text):
delete_post(base_dir,
http_prefix,
@ -2425,8 +2424,7 @@ class PubServer(BaseHTTPRequestHandler):
locate_post(base_dir, 'news', domain,
moderation_text)
if post_filename:
if can_remove_post(base_dir,
'news', domain, port,
if can_remove_post(base_dir, domain, port,
moderation_text):
delete_post(base_dir,
http_prefix,

View File

@ -757,7 +757,7 @@ def create_news_inbox(base_dir: str, domain: str, port: int,
def person_upgrade_actor(base_dir: str, person_json: {},
handle: str, filename: str) -> None:
filename: str) -> None:
"""Alter the actor to add any new properties
"""
update_actor = False
@ -950,7 +950,7 @@ def person_lookup(domain: str, path: str, base_dir: str) -> {}:
return None
person_json = load_json(filename)
if not is_shared_inbox:
person_upgrade_actor(base_dir, person_json, handle, filename)
person_upgrade_actor(base_dir, person_json, filename)
# if not person_json:
# person_json={"user": "unknown"}
return person_json
@ -1163,7 +1163,7 @@ def suspend_account(base_dir: str, nickname: str, domain: str) -> None:
print('EX: unable to write ' + suspended_filename)
def can_remove_post(base_dir: str, nickname: str,
def can_remove_post(base_dir: str,
domain: str, port: int, post_id: str) -> bool:
"""Returns true if the given post can be removed
"""
@ -1683,8 +1683,8 @@ def get_actor_json(host_domain: str, handle: str, http: bool, gnunet: bool,
return None, None
def get_person_avatar_url(base_dir: str, person_url: str, person_cache: {},
allow_downloads: bool) -> str:
def get_person_avatar_url(base_dir: str, person_url: str,
person_cache: {}) -> str:
"""Returns the avatar url for the person
"""
person_json = \

View File

@ -149,8 +149,7 @@ def html_likers_of_post(base_dir: str, nickname: str,
if likers_list:
likers_list += ' '
liker_avatar_url = \
get_person_avatar_url(base_dir, liker_actor,
person_cache, False)
get_person_avatar_url(base_dir, liker_actor, person_cache)
if not liker_avatar_url:
liker_avatar_url = ''
else:

View File

@ -347,8 +347,7 @@ def _get_post_from_recent_cache(session,
# update avatar if needed
if not avatar_url:
avatar_url = \
get_person_avatar_url(base_dir, post_actor, person_cache,
allow_downloads)
get_person_avatar_url(base_dir, post_actor, person_cache)
_log_post_timing(enable_timing_log, post_start_time, '2.1')
@ -1145,8 +1144,7 @@ def _get_post_title_announce_html(base_dir: str,
# show avatar of person replied to
announce_actor = attributed_to
announce_avatar_url = \
get_person_avatar_url(base_dir, announce_actor,
person_cache, allow_downloads)
get_person_avatar_url(base_dir, announce_actor, person_cache)
_log_post_timing(enable_timing_log, post_start_time, '13.4')
@ -1353,8 +1351,7 @@ def _get_post_title_reply_html(base_dir: str,
# show avatar of person replied to
reply_avatar_url = \
get_person_avatar_url(base_dir, reply_actor, person_cache,
allow_downloads)
get_person_avatar_url(base_dir, reply_actor, person_cache)
_log_post_timing(enable_timing_log, post_start_time, '13.8')

View File

@ -202,8 +202,7 @@ def html_profile_after_search(recent_posts_cache: {}, max_recent_posts: int,
if profile_json['icon'].get('url'):
avatar_url = profile_json['icon']['url']
if not avatar_url:
avatar_url = get_person_avatar_url(base_dir, person_url,
person_cache, True)
avatar_url = get_person_avatar_url(base_dir, person_url, person_cache)
display_name = search_nickname
if profile_json.get('name'):
display_name = profile_json['name']
@ -2473,7 +2472,7 @@ def _individual_follow_as_html(signing_priv_key_pem: str,
get_full_domain(follow_url_domain, follow_url_port)
title_str = '@' + follow_url_nickname + '@' + follow_url_domain_full
avatar_url = \
get_person_avatar_url(base_dir, follow_url, person_cache, True)
get_person_avatar_url(base_dir, follow_url, person_cache)
if not avatar_url:
avatar_url = follow_url + '/avatar.png'

View File

@ -378,8 +378,7 @@ def update_avatar_image_cache(signing_priv_key_pem: str,
return None
store_person_in_cache(base_dir, actor, person_json, person_cache,
allow_downloads)
return get_person_avatar_url(base_dir, actor, person_cache,
allow_downloads)
return get_person_avatar_url(base_dir, actor, person_cache)
return None
return avatar_image_filename.replace(base_dir + '/cache', '')
@ -1429,8 +1428,7 @@ def get_avatar_image_url(session, base_dir: str, http_prefix: str,
# get the avatar image url for the post actor
if not avatar_url:
avatar_url = \
get_person_avatar_url(base_dir, post_actor, person_cache,
allow_downloads)
get_person_avatar_url(base_dir, post_actor, person_cache)
avatar_url = \
update_avatar_image_cache(signing_priv_key_pem,
session, base_dir, http_prefix,