Skip to content

Add popup rule-retention option for disabling vs deleting rules#527

Merged
salarcode merged 3 commits into
masterfrom
copilot/add-protect-from-deletion-checkbox
Apr 10, 2026
Merged

Add popup rule-retention option for disabling vs deleting rules#527
salarcode merged 3 commits into
masterfrom
copilot/add-protect-from-deletion-checkbox

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 9, 2026

Disabling a rule from the popup currently removes it, which makes accidentally unchecked or complex rules hard to recover. This change adds a configurable option in General Options to choose whether popup uncheck deletes the rule or only disables it, with the new default preserving the rule.

  • Behavior change in popup rule toggling

    • When Delete rule when disabled/unchecked from popup menu is off (default), unchecking a rule from the popup now sets enabled = false instead of removing the rule.
    • Re-adding the same rule from the popup now re-enables the existing disabled rule instead of creating a duplicate.
    • When the option is on, popup behavior stays unchanged and continues deleting the rule.
  • Persisted settings

    • Added deleteRuleWhenDisabledFromPopup to GeneralOptions
    • Updated option copy/equality/save/load paths so the new setting round-trips correctly across settings operations
  • Settings UI

    • Added a new checkbox under General Options → Other Settings:
      • Delete rule when disabled/unchecked from popup menu
    • Default state is unchecked
  • Localization

    • Added localized text for the new option across existing locale files
  • Focused coverage

    • Added tests for:
      • disabling vs deleting behavior
      • re-enabling an existing disabled rule
      • options copy/equality handling for the new setting
if (Settings.current?.options?.deleteRuleWhenDisabledFromPopup) {
	ProfileRules.removeRule(smartProfile, rule);
} else {
	rule.enabled = false;
}

Settings UI - new popup rule deletion option

Copilot AI linked an issue Apr 9, 2026 that may be closed by this pull request
@salarcode salarcode requested a review from Copilot April 9, 2026 00:06
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot wasn't able to review any files in this pull request.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Agent-Logs-Url: https://github.com/salarcode/SmartProxy/sessions/f6085f67-e788-497a-ac13-f21d1a66ab9e

Co-authored-by: salarcode <1272095+salarcode@users.noreply.github.com>
Copilot AI changed the title [WIP] Add possibility to protect rules from deletion Add popup rule-retention option for disabling vs deleting rules Apr 9, 2026
Copilot AI requested a review from salarcode April 9, 2026 00:13
@salarcode salarcode requested a review from Copilot April 9, 2026 00:48
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 20 out of 20 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/ui/settings.html Outdated
Comment on lines +546 to +558
<label class="mx-2 form-label">
<input id="chkRefreshTabOnConfigChanges" checked type="checkbox"
class="form-check-input" />
<span data-localize="settingsGeneralRefreshTabOnConfigChanges">Refresh active tab when
proxy profile changed</span>
</label>
<br />
<label class="mx-2 form-label">
<input id="chkDeleteRuleWhenDisabledFromPopup" type="checkbox" class="form-check-input" />
<span data-localize="settingsGeneralDeleteRuleWhenDisabledFromPopup">Delete rule when
disabled/unchecked from popup menu</span>
</label>
</div>
Copy link

Copilot AI Apr 9, 2026

Choose a reason for hiding this comment

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

The newly added lines appear to use different line endings than the surrounding file (existing lines show CRLF while these lines are LF-only), which can leave the file with mixed EOLs and cause noisy diffs/formatting issues. Please normalize settings.html to a single line-ending style (preferably whatever the repo already uses) and re-save the file.

Copilot uses AI. Check for mistakes.
Comment thread src/ui/settings.html Outdated
Comment thread src/tests/ProxyRules.test.ts
@salarcode salarcode marked this pull request as ready for review April 10, 2026 14:11
@salarcode salarcode merged commit d0aa953 into master Apr 10, 2026
@salarcode salarcode deleted the copilot/add-protect-from-deletion-checkbox branch April 10, 2026 14:11
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.

Possibility to protect rules from deletion

3 participants