Improve updater messages

Improve the wording of updater messages for better UX.
This commit is contained in:
Alex Pyrgiotis 2023-07-28 20:00:10 +03:00
parent d5ca6bb422
commit c9eac42855
No known key found for this signature in database
GPG key ID: B6C15EBA0357C9AA
3 changed files with 13 additions and 12 deletions

View file

@ -47,8 +47,8 @@ UPDATE_ERROR_MSG_INTRO = """\
UPDATE_ERROR_MSG_OUTRO = """\ UPDATE_ERROR_MSG_OUTRO = """\
<p>You are strongly advised to visit our <p>You are strongly advised to visit our
<a href="https://dangerzone.rocks#downloads">downloads page</a> and check for new <a href="https://dangerzone.rocks#downloads">downloads page</a> and check for new
updates manually, or consult our updates manually, or consult
<a href=https://github.com/freedomofpress/dangerzone/wiki/Updates>wiki page</a> for <a href=https://github.com/freedomofpress/dangerzone/wiki/Updates>this webpage</a> for
common causes of errors. Alternatively, you can uncheck the "Check for updates" option common causes of errors. Alternatively, you can uncheck the "Check for updates" option
in our menu, if you are in an air-gapped environment and have another way of learning in our menu, if you are in an air-gapped environment and have another way of learning
about updates.</p> about updates.</p>

View file

@ -28,17 +28,18 @@ log = logging.getLogger(__name__)
MSG_CONFIRM_UPDATE_CHECKS = """\ MSG_CONFIRM_UPDATE_CHECKS = """\
<p>Do you want to be notified about new Dangerzone releases?</p> <p><b>Do you want to be notified about new Dangerzone releases?</b></p>
<p>If <i>"Yes"</i>, Dangerzone will check GitHub for new releases on startup. If <p>If <i>"Yes"</i>, Dangerzone will check the
<i>"No"</i>, Dangerzone will make no network requests and won't inform you about new <a href="https://github.com/freedomofpress/dangerzone/releases">latest releases page</a>
releases.</p> in github.com on startup. If <i>"No"</i>, Dangerzone will make no network requests and
won't inform you about new releases.</p>
<p>If you prefer another way of getting notified about new releases, we suggest adding <p>If you prefer another way of getting notified about new releases, we suggest adding
to your RSS reader our to your RSS reader our
<a href="https://fosstodon.org/@dangerzone.rss">Mastodon feed</a>. For more information <a href="https://fosstodon.org/@dangerzone.rss">Mastodon feed</a>. For more information
about updates, check our about updates, check
<a href="https://github.com/freedomofpress/dangerzone/wiki/Updates">wiki page</a>.</p> <a href="https://github.com/freedomofpress/dangerzone/wiki/Updates">this webpage</a>.</p>
""" """
UPDATE_CHECK_COOLDOWN_SECS = 60 * 60 * 12 # Check for updates at most every 12 hours. UPDATE_CHECK_COOLDOWN_SECS = 60 * 60 * 12 # Check for updates at most every 12 hours.
@ -214,12 +215,12 @@ class UpdaterThread(QtCore.QThread):
res = requests.get(self.GH_RELEASE_URL, timeout=self.REQ_TIMEOUT) res = requests.get(self.GH_RELEASE_URL, timeout=self.REQ_TIMEOUT)
except Exception as e: except Exception as e:
raise RuntimeError( raise RuntimeError(
f"Encountered an exception while querying {self.GH_RELEASE_URL}: {e}" f"Encountered an exception while checking {self.GH_RELEASE_URL}: {e}"
) )
if res.status_code != 200: if res.status_code != 200:
raise RuntimeError( raise RuntimeError(
f"Encountered an HTTP {res.status_code} error while querying" f"Encountered an HTTP {res.status_code} error while checking"
f" {self.GH_RELEASE_URL}" f" {self.GH_RELEASE_URL}"
) )

View file

@ -217,7 +217,7 @@ def test_update_checks(
requests_mock.side_effect = Exception("failed") # type: ignore [attr-defined] requests_mock.side_effect = Exception("failed") # type: ignore [attr-defined]
report = updater.check_for_updates() report = updater.check_for_updates()
error_msg = ( error_msg = (
f"Encountered an exception while querying {updater.GH_RELEASE_URL}: failed" f"Encountered an exception while checking {updater.GH_RELEASE_URL}: failed"
) )
assert_report_equal(report, UpdateReport(error=error_msg)) assert_report_equal(report, UpdateReport(error=error_msg))
@ -297,7 +297,7 @@ def test_update_checks_cooldown(updater: UpdaterThread, mocker: MockerFixture) -
assert cooldown_spy.spy_return == False assert cooldown_spy.spy_return == False
assert updater.dangerzone.settings.get("updater_last_check") == curtime assert updater.dangerzone.settings.get("updater_last_check") == curtime
error_msg = ( error_msg = (
f"Encountered an exception while querying {updater.GH_RELEASE_URL}: failed" f"Encountered an exception while checking {updater.GH_RELEASE_URL}: failed"
) )
assert_report_equal(report, UpdateReport(error=error_msg)) assert_report_equal(report, UpdateReport(error=error_msg))