mirror of https://gitlab.com/bashrc2/epicyon
Less indentation
parent
2d0a53bd29
commit
edc5a8c463
15
utils.py
15
utils.py
|
@ -1895,7 +1895,8 @@ def get_nickname_from_actor(actor: str) -> str:
|
||||||
actor = actor[1:]
|
actor = actor[1:]
|
||||||
users_paths = get_user_paths()
|
users_paths = get_user_paths()
|
||||||
for possible_path in users_paths:
|
for possible_path in users_paths:
|
||||||
if possible_path in actor:
|
if possible_path not in actor:
|
||||||
|
continue
|
||||||
nick_str = actor.split(possible_path)[1].replace('@', '')
|
nick_str = actor.split(possible_path)[1].replace('@', '')
|
||||||
if '/' not in nick_str:
|
if '/' not in nick_str:
|
||||||
return nick_str
|
return nick_str
|
||||||
|
@ -1951,7 +1952,8 @@ def get_domain_from_actor(actor: str) -> (str, int):
|
||||||
prefixes = get_protocol_prefixes()
|
prefixes = get_protocol_prefixes()
|
||||||
users_paths = get_user_paths()
|
users_paths = get_user_paths()
|
||||||
for possible_path in users_paths:
|
for possible_path in users_paths:
|
||||||
if possible_path in actor:
|
if possible_path not in actor:
|
||||||
|
continue
|
||||||
domain = actor.split(possible_path)[0]
|
domain = actor.split(possible_path)[0]
|
||||||
for prefix in prefixes:
|
for prefix in prefixes:
|
||||||
domain = domain.replace(prefix, '')
|
domain = domain.replace(prefix, '')
|
||||||
|
@ -2480,7 +2482,8 @@ def _delete_post_remove_replies(base_dir: str, nickname: str, domain: str,
|
||||||
reply_file = locate_post(base_dir, nickname, domain, reply_id)
|
reply_file = locate_post(base_dir, nickname, domain, reply_id)
|
||||||
if not reply_file:
|
if not reply_file:
|
||||||
continue
|
continue
|
||||||
if os.path.isfile(reply_file):
|
if not os.path.isfile(reply_file):
|
||||||
|
continue
|
||||||
delete_post(base_dir, http_prefix,
|
delete_post(base_dir, http_prefix,
|
||||||
nickname, domain, reply_file, debug,
|
nickname, domain, reply_file, debug,
|
||||||
recent_posts_cache, manual)
|
recent_posts_cache, manual)
|
||||||
|
@ -3425,8 +3428,10 @@ def undo_likes_collection_entry(recent_posts_cache: {},
|
||||||
total_items = obj['likes']['totalItems']
|
total_items = obj['likes']['totalItems']
|
||||||
item_found = False
|
item_found = False
|
||||||
for like_item in obj['likes']['items']:
|
for like_item in obj['likes']['items']:
|
||||||
if like_item.get('actor'):
|
if not like_item.get('actor'):
|
||||||
if like_item['actor'] == actor:
|
continue
|
||||||
|
if like_item['actor'] != actor:
|
||||||
|
continue
|
||||||
if debug:
|
if debug:
|
||||||
print('DEBUG: like was removed for ' + actor)
|
print('DEBUG: like was removed for ' + actor)
|
||||||
obj['likes']['items'].remove(like_item)
|
obj['likes']['items'].remove(like_item)
|
||||||
|
|
Loading…
Reference in New Issue