mirror of https://gitlab.com/bashrc2/epicyon
Alternative pattern for undo follow
parent
c8b31d56d2
commit
f3620ff2a0
17
inbox.py
17
inbox.py
|
@ -1042,6 +1042,8 @@ def _receive_undo_follow(base_dir: str, message_json: {},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
"""
|
"""
|
||||||
|
if not message_json['object'].get('object'):
|
||||||
|
return False
|
||||||
if not message_json['object'].get('actor'):
|
if not message_json['object'].get('actor'):
|
||||||
if debug:
|
if debug:
|
||||||
print('DEBUG: undo follow request has no actor within object')
|
print('DEBUG: undo follow request has no actor within object')
|
||||||
|
@ -1071,8 +1073,19 @@ def _receive_undo_follow(base_dir: str, message_json: {},
|
||||||
return False
|
return False
|
||||||
domain_follower_full = get_full_domain(domain_follower, port_follower)
|
domain_follower_full = get_full_domain(domain_follower, port_follower)
|
||||||
|
|
||||||
|
following_actor = None
|
||||||
|
if isinstance(message_json['object']['object'], str):
|
||||||
|
following_actor = message_json['object']['object']
|
||||||
|
elif isinstance(message_json['object']['object'], dict):
|
||||||
|
if message_json['object']['object'].get('id'):
|
||||||
|
if isinstance(message_json['object']['object']['id'], str):
|
||||||
|
following_actor = message_json['object']['object']['id']
|
||||||
|
if not following_actor:
|
||||||
|
print('WARN: undo follow without following actor')
|
||||||
|
return False
|
||||||
|
|
||||||
nickname_following = \
|
nickname_following = \
|
||||||
get_nickname_from_actor(message_json['object']['object'])
|
get_nickname_from_actor(following_actor)
|
||||||
if not nickname_following:
|
if not nickname_following:
|
||||||
print('WARN: undo follow request unable to find nickname in ' +
|
print('WARN: undo follow request unable to find nickname in ' +
|
||||||
message_json['object']['object'])
|
message_json['object']['object'])
|
||||||
|
@ -1125,8 +1138,6 @@ def _receive_undo(base_dir: str, message_json: {}, debug: bool,
|
||||||
return False
|
return False
|
||||||
if not has_object_string_type(message_json, debug):
|
if not has_object_string_type(message_json, debug):
|
||||||
return False
|
return False
|
||||||
if not has_object_string_object(message_json, debug):
|
|
||||||
return False
|
|
||||||
if message_json['object']['type'] == 'Follow' or \
|
if message_json['object']['type'] == 'Follow' or \
|
||||||
message_json['object']['type'] == 'Join':
|
message_json['object']['type'] == 'Join':
|
||||||
_receive_undo_follow(base_dir, message_json,
|
_receive_undo_follow(base_dir, message_json,
|
||||||
|
|
Loading…
Reference in New Issue