From 7dc4a7624e962780d5704ee64256f38178129e59 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sat, 16 Sep 2023 15:12:31 +0100 Subject: [PATCH] Show offline status on person options screen --- daemon.py | 3 ++- webapp_person_options.py | 15 +++++++++++---- webapp_profile.py | 4 ++-- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/daemon.py b/daemon.py index 42c5be52e..32899464e 100644 --- a/daemon.py +++ b/daemon.py @@ -9144,7 +9144,8 @@ class PubServer(BaseHTTPRequestHandler): access_keys, is_group, self.server.theme_name, self.server.blocked_cache, - repo_url) + repo_url, + self.server.sites_unavailable) if msg: msg = msg.encode('utf-8') msglen = len(msg) diff --git a/webapp_person_options.py b/webapp_person_options.py index be908438a..fb6b0b641 100644 --- a/webapp_person_options.py +++ b/webapp_person_options.py @@ -165,7 +165,8 @@ def html_person_options(default_timeline: str, is_group: bool, theme: str, blocked_cache: [], - repo_url: str) -> str: + repo_url: str, + sites_unavailable: []) -> str: """Show options for a person: view/follow/block/report """ options_link_str = '' @@ -180,6 +181,9 @@ def html_person_options(default_timeline: str, base_dir + '/accounts/options-background.jpg') dormant = False + offline = False + if options_domain in sites_unavailable: + offline = True follow_str = 'Follow' if is_group: follow_str = 'Join' @@ -198,9 +202,10 @@ def html_person_options(default_timeline: str, follow_str = 'Unfollow' if is_group: follow_str = 'Leave' - dormant = \ - is_dormant(base_dir, nickname, domain, options_actor, - dormant_months) + if not offline: + dormant = \ + is_dormant(base_dir, nickname, domain, options_actor, + dormant_months) options_nickname = get_nickname_from_actor(options_actor) if not options_nickname: @@ -291,6 +296,8 @@ def html_person_options(default_timeline: str, handle_shown += ' ⌂' if dormant: handle_shown += ' 💤' + if offline: + handle_shown += ' [' + translate['offline'].upper() + ']' options_str += \ '

' + translate['Options for'] + \ ' @' + handle_shown + '

\n' diff --git a/webapp_profile.py b/webapp_profile.py index 1fe7a782a..69138c1d1 100644 --- a/webapp_profile.py +++ b/webapp_profile.py @@ -3168,10 +3168,10 @@ def _individual_follow_as_html(signing_priv_key_pem: str, display_name, False, translate) title_str = display_name - if dormant: - title_str += ' 💤' if offline: title_str += ' [' + translate['offline'].upper() + ']' + elif dormant: + title_str += ' 💤' buttons_str = '' if authorized: