Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Add-on Store mirror to use new UX #17228

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

SaschaCowley
Copy link
Member

Link to issue number:

Follow up to #17099

Summary of the issue:

In PR #17099, the ability to set a mirror to use when accessing the Add-on Store was added.
PR #17151 built upon this, adding the ability to set a mirror for NVDA update checks.
However, it was decided that we needed a more robust way of checking the mirror URLs, and a means of protecting users from accidental changes to the URL.
These UX improvements were implemented for the NVDA update mirror, but not for the Add-on Store server mirror, so as to keep PRs single-issue.

Description of user facing changes

The Add-on Store server mirror settings now use the same UI as the NVDA update check mirror.

Description of development approach

  • Added a responseValidator option to _SetURLDialog, which defaults to always returning True.
  • Added a validator for request.Response objects to check if they're a valid Add-on Store cache hash (JSON comprising a single string of 7-40 hex digits ).
  • Copied the implementation of NVDA update mirror to the Add-on Store page, using the cache hash validator as the responseValidator function.
  • Made failure messages when setting a URL more descriptive.
  • Updated user guide, including consolidating the description of the NVDA update check and Add-on Store server mirror dialogs into one.

Testing strategy:

  • Tested that using the new dialog sets the Add-on Store server mirror as expected.
  • Ran through the NVDA update mirror process and Add-on Store server mirror process, checking that context help works on all controls.

Known issues with pull request:

While not directly related to this issue, note that this work lays part of the groundwork for #17205.

Code Review Checklist:

  • Documentation:
    • Change log entry
    • User Documentation
    • Developer / Technical Documentation
    • Context sensitive help for GUI changes
  • Testing:
    • Unit tests
    • System (end to end) tests
    • Manual testing
  • UX of all users considered:
    • Speech
    • Braille
    • Low Vision
    • Different web browsers
    • Localization in other languages / culture than English
  • API is compatible with existing add-ons.
  • Security precautions taken.

@coderabbitai summary

Added a new section to the settings section of the user guide describing the update mirror and add-on store mirror dialogs in one.
Removed the specific section for the update mirror dialog.
Changed the links that pointed to the add-on store dialog to refer to the new unified section.
Changed references in source code to refer to the correct user guide sections.
Comment on lines +184 to +202
message = _(
# Translators: Message shown to users when testing a given URL has failed because the response was invalid.
"The URL you have entered failed the connection test. The response received from the server was invalid. Check the URL is correct before trying again.",
)
elif isinstance(error, requests.HTTPError):
message = _(
# Translators: Message shown to users when testing a given URL has failed because the server returned an error.
"The URL you have entered failed the connection test. The server returned an error. Check that the URL is correct before trying again.",
)
elif isinstance(error, requests.ConnectionError):
message = _(
# Translators: Message shown to users when testing a given URL has failed because of a network error.
"The URL you have entered failed the connection test. There was a network error. Check that you are connected to the internet and try again.",
)
else:
message = _(
# Translators: Message shown to users when testing a given URL has failed for unknown reasons.
"The URL you have entered failed the connection test. Make sure you are connected to the internet and the URL is correct.",
)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think perhaps this should be a datastructure such as an enum or dataclass.
I think it might also be good to translate the first sentence separately, and prepend it on.

@@ -62,7 +63,6 @@
Set,
cast,
)
from url_normalize import url_normalize
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we remove this from requirements then?

self.addonMetadataMirrorTextbox = sHelper.addLabeledControl(
self.addonMetadataMirrorLabelText,
wx.TextCtrl,
# Translators: The label for the server mirror on the Add-on store Settings panel.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# Translators: The label for the server mirror on the Add-on store Settings panel.
# Translators: The label for the server mirror on the Add-on Store Settings panel.

self.addonMetadataMirrorLabelText,
wx.TextCtrl,
# Translators: The label for the server mirror on the Add-on store Settings panel.
mirrorBoxSizer = wx.StaticBoxSizer(wx.HORIZONTAL, self, label=_("Server mirror"))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pedantic/subjective but maybe this is more accurate phrasing right? Making the subject the server/URL, not the mirror

Suggested change
mirrorBoxSizer = wx.StaticBoxSizer(wx.HORIZONTAL, self, label=_("Server mirror"))
mirrorBoxSizer = wx.StaticBoxSizer(wx.HORIZONTAL, self, label=_("Mirror server"))

Comment on lines +5588 to +5589
# Add-on Store cache hash is a git commit hash as a string.
return isinstance(data, str) and bool(re.fullmatch("[0-9a-fA-F]{7,40}", data))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah I don't think this has to be true - we use a commit hash but mirrors may want to use their own cache hash, like a new UUID every X minutes to cache break, or whenever they generate new data.

I would just ensure there is a non-empty string

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# Add-on Store cache hash is a git commit hash as a string.
return isinstance(data, str) and bool(re.fullmatch("[0-9a-fA-F]{7,40}", data))
# Add-on Store cache hash must be a non-empty JSON string
return isinstance(data, str) and bool(re.fullmatch(".+", data))

This may be of use in locations where access to the NV Access Add-on Store server is slow or unavailable.

Leave this blank to use the default NV Access Add-on Store server.
The read-only text box shows the current mirror URL.
If no mirror is in use (I.E. the NV Access NVDA Add-on Store server is being used), "No mirror" is displayed.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we lowercase i.e. more consistently, also maybe NVDA can be dropped

Suggested change
If no mirror is in use (I.E. the NV Access NVDA Add-on Store server is being used), "No mirror" is displayed.
If no mirror is in use (i.e. the NV Access Add-on Store server is being used), "No mirror" is displayed.

@@ -3131,6 +3115,28 @@ This can be very useful when you want to monitor constantly changing content, su
The refresh takes place every one and a half seconds.
This option is disabled by default.

#### Set Mirror Dialog {#SetURLDialog}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should go under "Advanced settings" or "misc settings" since all the other headers at this level are for settings panels

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I disagree. Putting it in sub-paragraphs of the advanced settings has no sense because this dialog is not accessible from the advanced settings panel. Regarding "Misc", would it be a new paragraph to create?

There are already other level 4 headings which are not settings panels:

  • 12.1.3. Select Synthesizer
  • 12.1.4. Synth settings ring
    12.1.6. Select Braille Display

Though, I acknowledge that Select synthesizer / braille display dialogs are dialogs that can be opened independently as a setting dialog whereas the Set URL dialog cannotn i.e. it is always a sub-dialog of a setting panel.

My proposal is to keep this at level 4, even if it's not a stand-alone settings dialog. But state explicitly in the introduction text of this paragraph that this type of dialog may be opened to set the mirror URL and the add-on store URL.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

makes a lot of sense, this is quite similar to select synthesizer, settings ring and selecting a braille display. Though perhaps grouping those dialogs with this one separately might be worth doing

@AppVeyorBot
Copy link

See test results for failed build of commit 739159131a

@seanbudd seanbudd added the conceptApproved Similar 'triaged' for issues, PR accepted in theory, implementation needs review. label Oct 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
conceptApproved Similar 'triaged' for issues, PR accepted in theory, implementation needs review.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants