mirror of https://gitlab.com/bashrc2/epicyon
Tidying
parent
ac6695b9f3
commit
448b0e3120
2
inbox.py
2
inbox.py
|
@ -2686,7 +2686,7 @@ def _valid_post_content(base_dir: str, nickname: str, domain: str,
|
||||||
message_json['object']['tag'])
|
message_json['object']['tag'])
|
||||||
return False
|
return False
|
||||||
# check that the post is in a language suitable for this account
|
# check that the post is in a language suitable for this account
|
||||||
if not understood_post_language(base_dir, nickname, domain,
|
if not understood_post_language(base_dir, nickname,
|
||||||
message_json, system_language,
|
message_json, system_language,
|
||||||
http_prefix, domain_full,
|
http_prefix, domain_full,
|
||||||
person_cache):
|
person_cache):
|
||||||
|
|
|
@ -99,7 +99,7 @@ def set_actor_languages(actor_json: {}, languages_str: str) -> None:
|
||||||
actor_json['attachment'].append(new_languages)
|
actor_json['attachment'].append(new_languages)
|
||||||
|
|
||||||
|
|
||||||
def understood_post_language(base_dir: str, nickname: str, domain: str,
|
def understood_post_language(base_dir: str, nickname: str,
|
||||||
message_json: {}, system_language: str,
|
message_json: {}, system_language: str,
|
||||||
http_prefix: str, domain_full: str,
|
http_prefix: str, domain_full: str,
|
||||||
person_cache: {}) -> bool:
|
person_cache: {}) -> bool:
|
||||||
|
|
3
like.py
3
like.py
|
@ -385,8 +385,7 @@ def outbox_like(recent_posts_cache: {},
|
||||||
|
|
||||||
|
|
||||||
def outbox_undo_like(recent_posts_cache: {},
|
def outbox_undo_like(recent_posts_cache: {},
|
||||||
base_dir: str, http_prefix: str,
|
base_dir: str, nickname: str, domain: str,
|
||||||
nickname: str, domain: str, port: int,
|
|
||||||
message_json: {}, debug: bool) -> None:
|
message_json: {}, debug: bool) -> None:
|
||||||
""" When an undo like request is received by the outbox from c2s
|
""" When an undo like request is received by the outbox from c2s
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -580,8 +580,7 @@ def post_message_to_outbox(session, translate: {},
|
||||||
if debug:
|
if debug:
|
||||||
print('DEBUG: handle any undo like requests')
|
print('DEBUG: handle any undo like requests')
|
||||||
outbox_undo_like(recent_posts_cache,
|
outbox_undo_like(recent_posts_cache,
|
||||||
base_dir, http_prefix,
|
base_dir, post_to_nickname, domain,
|
||||||
post_to_nickname, domain, port,
|
|
||||||
message_json, debug)
|
message_json, debug)
|
||||||
|
|
||||||
if debug:
|
if debug:
|
||||||
|
|
2
posts.py
2
posts.py
|
@ -4998,7 +4998,7 @@ def download_announce(session, base_dir: str, http_prefix: str,
|
||||||
base_dir, nickname, domain, post_id,
|
base_dir, nickname, domain, post_id,
|
||||||
recent_posts_cache)
|
recent_posts_cache)
|
||||||
return None
|
return None
|
||||||
if not understood_post_language(base_dir, nickname, domain,
|
if not understood_post_language(base_dir, nickname,
|
||||||
announced_json, system_language,
|
announced_json, system_language,
|
||||||
http_prefix, domain_full,
|
http_prefix, domain_full,
|
||||||
person_cache):
|
person_cache):
|
||||||
|
|
16
question.py
16
question.py
|
@ -136,20 +136,20 @@ def question_update_votes(base_dir: str, nickname: str, domain: str,
|
||||||
return question_json, question_post_filename
|
return question_json, question_post_filename
|
||||||
|
|
||||||
|
|
||||||
def is_question(postObjectJson: {}) -> bool:
|
def is_question(post_object_json: {}) -> bool:
|
||||||
""" is the given post a question?
|
""" is the given post a question?
|
||||||
"""
|
"""
|
||||||
if postObjectJson['type'] != 'Create' and \
|
if post_object_json['type'] != 'Create' and \
|
||||||
postObjectJson['type'] != 'Update':
|
post_object_json['type'] != 'Update':
|
||||||
return False
|
return False
|
||||||
if not has_object_dict(postObjectJson):
|
if not has_object_dict(post_object_json):
|
||||||
return False
|
return False
|
||||||
if not postObjectJson['object'].get('type'):
|
if not post_object_json['object'].get('type'):
|
||||||
return False
|
return False
|
||||||
if postObjectJson['object']['type'] != 'Question':
|
if post_object_json['object']['type'] != 'Question':
|
||||||
return False
|
return False
|
||||||
if not postObjectJson['object'].get('oneOf'):
|
if not post_object_json['object'].get('oneOf'):
|
||||||
return False
|
return False
|
||||||
if not isinstance(postObjectJson['object']['oneOf'], list):
|
if not isinstance(post_object_json['object']['oneOf'], list):
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
|
@ -193,7 +193,7 @@ def run_post_schedule(base_dir: str, httpd, max_scheduled_posts: int):
|
||||||
def run_post_schedule_watchdog(project_version: str, httpd) -> None:
|
def run_post_schedule_watchdog(project_version: str, httpd) -> None:
|
||||||
"""This tries to keep the scheduled post thread running even if it dies
|
"""This tries to keep the scheduled post thread running even if it dies
|
||||||
"""
|
"""
|
||||||
print('THREAD: Starting scheduled post watchdog')
|
print('THREAD: Starting scheduled post watchdog ' + project_version)
|
||||||
post_schedule_original = \
|
post_schedule_original = \
|
||||||
httpd.thrPostSchedule.clone(run_post_schedule)
|
httpd.thrPostSchedule.clone(run_post_schedule)
|
||||||
httpd.thrPostSchedule.start()
|
httpd.thrPostSchedule.start()
|
||||||
|
|
Loading…
Reference in New Issue