From 733ae3a17eb3e63fa76311f65f826ee26c18de62 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Tue, 31 May 2022 17:51:56 +0100 Subject: [PATCH] Tidying --- daemon.py | 11 +++++------ desktop_client.py | 9 +++------ epicyon.py | 4 +--- inbox.py | 3 +-- newsdaemon.py | 3 +-- posts.py | 19 ++++++++----------- tests.py | 16 ++++------------ 7 files changed, 23 insertions(+), 42 deletions(-) diff --git a/daemon.py b/daemon.py index 2560cfd3d..f6f404482 100644 --- a/daemon.py +++ b/daemon.py @@ -19158,7 +19158,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.domain, self.server.port, self.server.http_prefix, mentions_str + fields['message'], - followers_only, save_to_file, + save_to_file, client_to_server, comments_enabled, filename, attachment_media_type, fields['imageDescription'], @@ -19219,7 +19219,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.port, self.server.http_prefix, mentions_message, - followers_only, save_to_file, + save_to_file, client_to_server, comments_enabled, filename, attachment_media_type, @@ -19290,7 +19290,6 @@ class PubServer(BaseHTTPRequestHandler): self.server.http_prefix, mentions_str + fields['message'], - followers_only, save_to_file, client_to_server, comments_enabled, @@ -19360,7 +19359,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.port, self.server.http_prefix, mentions_message, - followers_only, save_to_file, + save_to_file, client_to_server, comments_enabled, filename, attachment_media_type, @@ -19414,7 +19413,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.domain, self.server.port, self.server.http_prefix, mentions_str + fields['message'], - True, False, False, True, + False, False, True, filename, attachment_media_type, fields['imageDescription'], city, @@ -19461,7 +19460,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.port, self.server.http_prefix, fields['message'], q_options, - False, False, False, + False, False, comments_enabled, filename, attachment_media_type, fields['imageDescription'], diff --git a/desktop_client.py b/desktop_client.py index fbd7c4bf5..bb1eb7924 100644 --- a/desktop_client.py +++ b/desktop_client.py @@ -461,7 +461,6 @@ def _desktop_reply_to_post(session, post_id: str, _say_command(say_str, say_str, screenreader, system_language, espeak) return cc_url = None - followers_only = False attach = None media_type = None attached_image_description = None @@ -479,7 +478,7 @@ def _desktop_reply_to_post(session, post_id: str, base_dir, session, nickname, password, domain, port, to_nickname, to_domain, to_port, cc_url, - http_prefix, reply_message, followers_only, + http_prefix, reply_message, comments_enabled, attach, media_type, attached_image_description, city, cached_webfingers, person_cache, is_article, @@ -534,7 +533,6 @@ def _desktop_new_post(session, _say_command(say_str, say_str, screenreader, system_language, espeak) return cc_url = None - followers_only = False attach = None media_type = None attached_image_description = None @@ -553,7 +551,7 @@ def _desktop_new_post(session, base_dir, session, nickname, password, domain, port, None, '#Public', port, cc_url, - http_prefix, new_message, followers_only, + http_prefix, new_message, comments_enabled, attach, media_type, attached_image_description, city, cached_webfingers, person_cache, is_article, @@ -1229,7 +1227,6 @@ def _desktop_new_dm_base(session, to_handle: str, _say_command(new_message, new_message, screenreader, system_language, espeak) cc_url = None - followers_only = False attach = None media_type = None attached_image_description = None @@ -1288,7 +1285,7 @@ def _desktop_new_dm_base(session, to_handle: str, base_dir, session, nickname, password, domain, port, to_nickname, to_domain, to_port, cc_url, - http_prefix, new_message, followers_only, + http_prefix, new_message, comments_enabled, attach, media_type, attached_image_description, city, cached_webfingers, person_cache, is_article, diff --git a/epicyon.py b/epicyon.py index 686dcf646..2c0aa0ada 100644 --- a/epicyon.py +++ b/epicyon.py @@ -1519,7 +1519,6 @@ def _command_options() -> None: cc_url = None send_message = argb.message - followers_only = argb.followersonly # client_to_server = argb.client attached_image_description = argb.imageDescription city = 'London, England' @@ -1533,7 +1532,6 @@ def _command_options() -> None: if attach: media_type = get_attachment_media_type(attach) reply_to = argb.replyto - followers_only = False is_article = False if not domain: domain = get_config_param(base_dir, 'domain') @@ -1549,7 +1547,7 @@ def _command_options() -> None: base_dir, session, argb.nickname, argb.password, domain, port, to_nickname, to_domain, to_port, cc_url, - http_prefix, send_message, followers_only, + http_prefix, send_message, argb.commentsEnabled, attach, media_type, attached_image_description, city, cached_webfingers, person_cache, is_article, diff --git a/inbox.py b/inbox.py index 203f171bf..8df1f3623 100644 --- a/inbox.py +++ b/inbox.py @@ -3260,7 +3260,6 @@ def _bounce_dm(senderPostId: str, session, http_prefix: str, # create the bounce DM subject = None content = translate['DM bounce'] - followers_only = False save_to_file = False client_to_server = False comments_enabled = False @@ -3279,7 +3278,7 @@ def _bounce_dm(senderPostId: str, session, http_prefix: str, low_bandwidth = False post_json_object = \ create_direct_message_post(base_dir, nickname, domain, port, - http_prefix, content, followers_only, + http_prefix, content, save_to_file, client_to_server, comments_enabled, attach_image_filename, media_type, diff --git a/newsdaemon.py b/newsdaemon.py index 0faf24a00..4c739925b 100644 --- a/newsdaemon.py +++ b/newsdaemon.py @@ -631,7 +631,6 @@ def _convert_rss_to_activitypub(base_dir: str, http_prefix: str, # if len(item) > 8: # podcast_properties = item[8] - followers_only = False # NOTE: the id when the post is created will not be # consistent (it's based on the current time, not the # published time), so we change that later @@ -645,7 +644,7 @@ def _convert_rss_to_activitypub(base_dir: str, http_prefix: str, blog = create_news_post(base_dir, domain, port, http_prefix, rss_description, - followers_only, save_to_file, + save_to_file, attach_image_filename, media_type, image_description, city, rss_title, system_language, diff --git a/posts.py b/posts.py index 30c5cf39a..c0b2100c4 100644 --- a/posts.py +++ b/posts.py @@ -1946,7 +1946,7 @@ def create_blog_post(base_dir: str, def create_news_post(base_dir: str, domain: str, port: int, http_prefix: str, - content: str, followers_only: bool, save_to_file: bool, + content: str, save_to_file: bool, attach_image_filename: str, media_type: str, image_description: str, city: str, subject: str, system_language: str, @@ -1982,7 +1982,7 @@ def create_question_post(base_dir: str, nickname: str, domain: str, port: int, http_prefix: str, content: str, q_options: [], - followers_only: bool, save_to_file: bool, + save_to_file: bool, client_to_server: bool, comments_enabled: bool, attach_image_filename: str, media_type: str, image_description: str, city: str, @@ -2032,8 +2032,7 @@ def create_question_post(base_dir: str, def create_unlisted_post(base_dir: str, nickname: str, domain: str, port: int, http_prefix: str, - content: str, followers_only: bool, - save_to_file: bool, + content: str, save_to_file: bool, client_to_server: bool, comments_enabled: bool, attach_image_filename: str, media_type: str, image_description: str, city: str, @@ -2067,8 +2066,7 @@ def create_unlisted_post(base_dir: str, def create_followers_only_post(base_dir: str, nickname: str, domain: str, port: int, - http_prefix: str, - content: str, followers_only: bool, + http_prefix: str, content: str, save_to_file: bool, client_to_server: bool, comments_enabled: bool, attach_image_filename: str, media_type: str, @@ -2139,8 +2137,7 @@ def get_mentioned_people(base_dir: str, http_prefix: str, def create_direct_message_post(base_dir: str, nickname: str, domain: str, port: int, - http_prefix: str, - content: str, followers_only: bool, + http_prefix: str, content: str, save_to_file: bool, client_to_server: bool, comments_enabled: bool, attach_image_filename: str, media_type: str, @@ -2197,7 +2194,7 @@ def create_direct_message_post(base_dir: str, def create_report_post(base_dir: str, nickname: str, domain: str, port: int, http_prefix: str, - content: str, followers_only: bool, save_to_file: bool, + content: str, save_to_file: bool, client_to_server: bool, comments_enabled: bool, attach_image_filename: str, media_type: str, image_description: str, city: str, @@ -2394,7 +2391,7 @@ def thread_send_post(session, post_json_str: str, federation_list: [], def send_post(signing_priv_key_pem: str, project_version: str, session, base_dir: str, nickname: str, domain: str, port: int, to_nickname: str, to_domain: str, to_port: int, cc_str: str, - http_prefix: str, content: str, followers_only: bool, + http_prefix: str, content: str, save_to_file: bool, client_to_server: bool, comments_enabled: bool, attach_image_filename: str, media_type: str, @@ -2559,7 +2556,7 @@ def send_post_via_server(signing_priv_key_pem: str, project_version: str, from_domain: str, from_port: int, to_nickname: str, to_domain: str, to_port: int, cc_str: str, - http_prefix: str, content: str, followers_only: bool, + http_prefix: str, content: str, comments_enabled: bool, attach_image_filename: str, media_type: str, image_description: str, city: str, diff --git a/tests.py b/tests.py index db310d5e3..f69d1333b 100644 --- a/tests.py +++ b/tests.py @@ -1267,7 +1267,6 @@ def test_post_message_between_servers(base_dir: str) -> None: in_reply_to_atom_uri = None subject = None alice_post_log = [] - followers_only = False save_to_file = True client_to_server = False cc_url = None @@ -1296,7 +1295,6 @@ def test_post_message_between_servers(base_dir: str) -> None: 'bob', bob_domain, bob_port, cc_url, http_prefix, 'Why is a mouse when it spins? ' + 'यह एक परीक्षण है #sillyquestion', - followers_only, save_to_file, client_to_server, True, attached_image_filename, media_type, attached_image_description, city, federation_list, @@ -1605,7 +1603,6 @@ def test_follow_between_servers(base_dir: str) -> None: in_reply_to_atom_uri = None subject = None alice_post_log = [] - followers_only = False save_to_file = True client_to_server = False cc_url = None @@ -1667,7 +1664,7 @@ def test_follow_between_servers(base_dir: str) -> None: send_post(signing_priv_key_pem, __version__, session_alice, alice_dir, 'alice', alice_domain, alice_port, 'bob', bob_domain, bob_port, cc_url, - http_prefix, 'Alice message', followers_only, save_to_file, + http_prefix, 'Alice message', save_to_file, client_to_server, True, None, None, None, city, federation_list, alice_send_threads, alice_post_log, alice_cached_webfingers, @@ -1828,7 +1825,6 @@ def test_shared_items_federation(base_dir: str) -> None: in_reply_to_atom_uri = None subject = None alice_post_log = [] - followers_only = False save_to_file = True client_to_server = False cc_url = None @@ -2031,7 +2027,7 @@ def test_shared_items_federation(base_dir: str) -> None: send_post(signing_priv_key_pem, __version__, session_alice, alice_dir, 'alice', alice_domain, alice_port, 'bob', bob_domain, bob_port, cc_url, - http_prefix, 'Alice message', followers_only, save_to_file, + http_prefix, 'Alice message', save_to_file, client_to_server, True, None, None, None, city, federation_list, alice_send_threads, alice_post_log, alice_cached_webfingers, @@ -2278,7 +2274,6 @@ def test_group_follow(base_dir: str) -> None: in_reply_to_atom_uri = None subject = None alice_post_log = [] - followers_only = False save_to_file = True client_to_server = False cc_url = None @@ -2357,7 +2352,6 @@ def test_group_follow(base_dir: str) -> None: in_reply_to_atom_uri = None subject = None bob_post_log = [] - followers_only = False save_to_file = True client_to_server = False cc_url = None @@ -2462,7 +2456,7 @@ def test_group_follow(base_dir: str) -> None: send_post(signing_priv_key_pem, __version__, session_alice, alice_dir, 'alice', alice_domain, alice_port, 'testgroup', testgroup_domain, testgroupPort, cc_url, - http_prefix, "Alice group message", followers_only, + http_prefix, "Alice group message", save_to_file, client_to_server, True, None, None, None, city, federation_list, alice_send_threads, alice_post_log, alice_cached_webfingers, @@ -3043,7 +3037,6 @@ def test_client_to_server(base_dir: str): print('EVENT: Alice sends to Bob via c2s') session_alice = create_session(proxy_type) - followers_only = False attached_image_filename = base_dir + '/img/logo.png' media_type = get_attachment_media_type(attached_image_filename) attached_image_description = 'Logo' @@ -3087,8 +3080,7 @@ def test_client_to_server(base_dir: str): alice_domain, alice_port, 'bob', bob_domain, bob_port, None, http_prefix, 'Sent from my ActivityPub client', - followers_only, True, - attached_image_filename, media_type, + True, attached_image_filename, media_type, attached_image_description, city, cached_webfingers, person_cache, is_article, system_language, languages_understood,