Check that post was located

main
Bob Mottram 2024-10-27 10:29:14 +00:00
parent 30a3de6b02
commit 0b52bdfc5f
1 changed files with 16 additions and 15 deletions

View File

@ -1327,21 +1327,22 @@ def mute_post(base_dir: str, nickname: str, domain: str, port: int,
if also_update_post_id: if also_update_post_id:
post_filename = locate_post(base_dir, nickname, domain, post_filename = locate_post(base_dir, nickname, domain,
also_update_post_id) also_update_post_id)
if os.path.isfile(post_filename): if post_filename:
post_json_obj = load_json(post_filename) if os.path.isfile(post_filename):
cached_post_filename = \ post_json_obj = load_json(post_filename)
get_cached_post_filename(base_dir, nickname, domain, cached_post_filename = \
post_json_obj) get_cached_post_filename(base_dir, nickname, domain,
if cached_post_filename: post_json_obj)
if os.path.isfile(cached_post_filename): if cached_post_filename:
try: if os.path.isfile(cached_post_filename):
os.remove(cached_post_filename) try:
print('MUTE: cached referenced post removed ' + os.remove(cached_post_filename)
cached_post_filename) print('MUTE: cached referenced post removed ' +
except OSError: cached_post_filename)
print('EX: ' + except OSError:
'MUTE cached referenced post not removed ' + print('EX: ' +
cached_post_filename) 'MUTE cached referenced post not removed ' +
cached_post_filename)
if recent_posts_cache.get('json'): if recent_posts_cache.get('json'):
if recent_posts_cache['json'].get(also_update_post_id): if recent_posts_cache['json'].get(also_update_post_id):