Skip to content

Portable copy safe creation fixups#16850

Merged
seanbudd merged 1 commit into
betafrom
doNotWarnForUpdate
Jul 15, 2024
Merged

Portable copy safe creation fixups#16850
seanbudd merged 1 commit into
betafrom
doNotWarnForUpdate

Conversation

@seanbudd

@seanbudd seanbudd commented Jul 12, 2024

Copy link
Copy Markdown
Member

Link to issue number:

Fixup of #16686
Fixes #16847

Summary of the issue:

When updating a portable copy either from the auto-update check UX, or through the portable copy CLI, a warning is shown to confirm if a user wants to update and overwrite the portable copy.
This is not ideal UX, as the update check UX should assume the user wants to update, same with the portable copy CLI.

Additionally, some translator strings in #16686 were not formatted correctly

Description of user facing changes

Warnings are no longer shown when updating a portable copy via the auto-update UX or via CLI.
Warnings are still shown when overwriting any other directory via CLI.

Messages in warning dialogs are now translatable correctly

Description of development approach

Fix format of translation strings

check if an update is being performed when creating a portable copy via CLI, do not warn in that case.
The portable copy auto-update UX uses the CLI to perform the update.

Testing strategy:

Known issues with pull request:

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.

Summary by CodeRabbit

  • New Features

    • Introduced a new variable to handle updates in portable installations.
    • Added checks for existing NVDA installations in specified directories.
  • Bug Fixes

    • Improved logic for warning and confirmation dialogs related to non-empty directories during installations.

@seanbudd seanbudd added this to the 2024.3 milestone Jul 12, 2024
@seanbudd seanbudd changed the base branch from master to beta July 15, 2024 02:01
@seanbudd seanbudd marked this pull request as ready for review July 15, 2024 02:02
@seanbudd seanbudd requested a review from a team as a code owner July 15, 2024 02:02
@seanbudd seanbudd requested review from gerald-hartig and removed request for a team July 15, 2024 02:02
@coderabbitai

coderabbitai Bot commented Jul 15, 2024

Copy link
Copy Markdown
Contributor

Walkthrough

The changes introduce a new variable isUpdate to determine if an existing NVDA portable installation is being updated. This variable is then used to modify the behavior of the warnForNonEmptyDirectory logic to prevent unnecessary warnings during updates. Additionally, the directory existence and content checking logic in installerGui.py is refactored with a new helper function _nvdaExistsInDir.

Changes

Files Change Summary
source/core.py Added isUpdate variable to check for existing NVDA installations and modified warnForNonEmptyDirectory logic.
source/gui/installerGui.py Introduced _nvdaExistsInDir helper function and updated _warnAndConfirmForNonEmptyDirectory logic accordingly.

Sequence Diagrams

Old Flow: Directory Warning Logic

sequenceDiagram
    participant User
    participant NVDA
    participant Directory
    User->>NVDA: Initiate Portable Installation
    NVDA->>Directory: Check if Directory is Non-Empty
    Directory-->>NVDA: Non-Empty Directory
    NVDA->>User: Display Warning Dialog
Loading

New Flow: Updated Directory Warning Logic

sequenceDiagram
    participant User
    participant NVDA
    participant Directory
    User->>NVDA: Initiate Portable Installation
    NVDA->>Directory: Check if NVDA Exists in Directory
    Directory-->>NVDA: NVDA Exists
    NVDA->>NVDA: Set isUpdate = True
    NVDA->>Directory: Check if Directory is Non-Empty
    Directory-->>NVDA: Non-Empty Directory
    alt isUpdate is True
        NVDA->>User: Skip Warning Dialog
    else isUpdate is False
        NVDA->>User: Display Warning Dialog
    end
Loading

Assessment against linked issues

Objective (Issue #16847) Addressed Explanation
Prevent warning dialogs from appearing when updating the portable version of NVDA.
Ensure the updated logic checks if NVDA already exists in the directory before displaying warning dialogs.
Refactor the existing logic for checking directory contents and user confirmation messages.

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@seanbudd seanbudd closed this Jul 15, 2024
@seanbudd seanbudd reopened this Jul 15, 2024
@seanbudd seanbudd marked this pull request as draft July 15, 2024 02:03
@seanbudd seanbudd marked this pull request as ready for review July 15, 2024 04:53
@seanbudd seanbudd merged commit 31d453c into beta Jul 15, 2024
@seanbudd seanbudd deleted the doNotWarnForUpdate branch July 15, 2024 07:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

When updating the portable version of NVDA, a warning dialog box pops up

2 participants