main
Bob Mottram 2022-06-14 11:51:40 +01:00
parent ac6695b9f3
commit 448b0e3120
7 changed files with 14 additions and 16 deletions

View File

@ -2686,7 +2686,7 @@ def _valid_post_content(base_dir: str, nickname: str, domain: str,
message_json['object']['tag'])
return False
# 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,
http_prefix, domain_full,
person_cache):

View File

@ -99,7 +99,7 @@ def set_actor_languages(actor_json: {}, languages_str: str) -> None:
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,
http_prefix: str, domain_full: str,
person_cache: {}) -> bool:

View File

@ -385,8 +385,7 @@ def outbox_like(recent_posts_cache: {},
def outbox_undo_like(recent_posts_cache: {},
base_dir: str, http_prefix: str,
nickname: str, domain: str, port: int,
base_dir: str, nickname: str, domain: str,
message_json: {}, debug: bool) -> None:
""" When an undo like request is received by the outbox from c2s
"""

View File

@ -580,8 +580,7 @@ def post_message_to_outbox(session, translate: {},
if debug:
print('DEBUG: handle any undo like requests')
outbox_undo_like(recent_posts_cache,
base_dir, http_prefix,
post_to_nickname, domain, port,
base_dir, post_to_nickname, domain,
message_json, debug)
if debug:

View File

@ -4998,7 +4998,7 @@ def download_announce(session, base_dir: str, http_prefix: str,
base_dir, nickname, domain, post_id,
recent_posts_cache)
return None
if not understood_post_language(base_dir, nickname, domain,
if not understood_post_language(base_dir, nickname,
announced_json, system_language,
http_prefix, domain_full,
person_cache):

View File

@ -136,20 +136,20 @@ def question_update_votes(base_dir: str, nickname: str, domain: str,
return question_json, question_post_filename
def is_question(postObjectJson: {}) -> bool:
def is_question(post_object_json: {}) -> bool:
""" is the given post a question?
"""
if postObjectJson['type'] != 'Create' and \
postObjectJson['type'] != 'Update':
if post_object_json['type'] != 'Create' and \
post_object_json['type'] != 'Update':
return False
if not has_object_dict(postObjectJson):
if not has_object_dict(post_object_json):
return False
if not postObjectJson['object'].get('type'):
if not post_object_json['object'].get('type'):
return False
if postObjectJson['object']['type'] != 'Question':
if post_object_json['object']['type'] != 'Question':
return False
if not postObjectJson['object'].get('oneOf'):
if not post_object_json['object'].get('oneOf'):
return False
if not isinstance(postObjectJson['object']['oneOf'], list):
if not isinstance(post_object_json['object']['oneOf'], list):
return False
return True

View File

@ -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:
"""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 = \
httpd.thrPostSchedule.clone(run_post_schedule)
httpd.thrPostSchedule.start()