Add informational message when repository filtering is disabled#544
Open
gurusatsangi wants to merge 1 commit intofossasia:mainfrom
Open
Add informational message when repository filtering is disabled#544gurusatsangi wants to merge 1 commit intofossasia:mainfrom
gurusatsangi wants to merge 1 commit intofossasia:mainfrom
Conversation
Contributor
Reviewer's GuideAdds an informational UI message that appears when repository filtering is disabled, both on initial load and when toggling the filter checkbox, and wires it into the existing popup script and HTML markup. Sequence diagram for popup initialization and filter disabled message togglesequenceDiagram
actor User
participant PopupScript
participant BrowserStorage
participant UseRepoFilterCheckbox
participant RepoFilterContainer
participant FilterDisabledMessage
User->>PopupScript: Open_popup
PopupScript->>PopupScript: DOMContentLoaded_handler
PopupScript->>BrowserStorage: get(optionSettings)
BrowserStorage-->>PopupScript: items_with_useRepoFilter
PopupScript->>UseRepoFilterCheckbox: set_checked(items.useRepoFilter)
PopupScript->>RepoFilterContainer: toggle_hidden(!items.useRepoFilter)
PopupScript->>FilterDisabledMessage: getElementById(filterDisabledMessage)
alt useRepoFilter_is_false
PopupScript->>FilterDisabledMessage: remove_class(hidden)
else useRepoFilter_is_true
PopupScript->>FilterDisabledMessage: add_class(hidden)
end
User->>UseRepoFilterCheckbox: click_toggle
UseRepoFilterCheckbox-->>PopupScript: change_event
PopupScript->>UseRepoFilterCheckbox: read_checked_state
PopupScript->>RepoFilterContainer: toggle_hidden(!enabled)
PopupScript->>FilterDisabledMessage: getElementById(filterDisabledMessage)
alt enabled_is_false
PopupScript->>FilterDisabledMessage: remove_class(hidden)
else enabled_is_true
PopupScript->>FilterDisabledMessage: add_class(hidden)
end
Flow diagram for deciding visibility of filter disabled messageflowchart TD
A_start[Start] --> B_context[Determine_context]
B_context --> C_init_load[Initial_load_with_items.useRepoFilter]
B_context --> D_toggle_event[Checkbox_toggle_event]
C_init_load --> C1[enabled = items.useRepoFilter]
D_toggle_event --> D1[enabled = useRepoFilter.checked]
C1 --> E{enabled_is_true?}
D1 --> E
E -->|Yes| F_hide_msg[Add_class_hidden_to_FilterDisabledMessage]
E -->|No| G_show_msg[Remove_class_hidden_from_FilterDisabledMessage]
F_hide_msg --> H_end[End]
G_show_msg --> H_end
File-Level Changes
Assessment against linked issues
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Contributor
There was a problem hiding this comment.
Hey - I've found 1 issue, and left some high level feedback:
- The show/hide logic for
filterDisabledMessageis duplicated in both the initialchrome.storage.sync.getcallback and theuseRepoFilterchange handler; consider extracting this into a small helper that takesenabledand the element to reduce repetition and keep behavior consistent. - In the
useRepoFilterchange handler you assumedocument.getElementById('filterDisabledMessage')exists and use it without a null check, whereas the initial load path guards for this; align these to avoid a potential runtime error if the element is absent. - The new informational text is hard-coded in the HTML while nearby strings use
data-i18n; consider moving this message into the i18n system for consistency and localization support.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The show/hide logic for `filterDisabledMessage` is duplicated in both the initial `chrome.storage.sync.get` callback and the `useRepoFilter` change handler; consider extracting this into a small helper that takes `enabled` and the element to reduce repetition and keep behavior consistent.
- In the `useRepoFilter` change handler you assume `document.getElementById('filterDisabledMessage')` exists and use it without a null check, whereas the initial load path guards for this; align these to avoid a potential runtime error if the element is absent.
- The new informational text is hard-coded in the HTML while nearby strings use `data-i18n`; consider moving this message into the i18n system for consistency and localization support.
## Individual Comments
### Comment 1
<location path="src/scripts/popup.js" line_range="1190-1196" />
<code_context>
const enabled = useRepoFilter.checked;
const hasToken = githubTokenInput.value.trim() !== '';
repoFilterContainer.classList.toggle('hidden', !enabled);
+ const disabledMsg = document.getElementById('filterDisabledMessage');
+
+ if (!enabled) {
+ disabledMsg.classList.remove('hidden');
+ } else {
+ disabledMsg.classList.add('hidden');
+ }
if (enabled && !hasToken) {
</code_context>
<issue_to_address>
**issue (bug_risk):** Guard against missing `filterDisabledMessage` element before toggling classes.
Here you access `disabledMsg.classList` without the null check you used earlier in the `chrome.storage.sync.get` callback. If the `filterDisabledMessage` element is renamed or removed, this will throw at runtime. Please add a null-guard (or early return if not found) before toggling the classes.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📌 Fixes #543
Fixes #
📝 Summary of Changes
📸 Screenshots
Before:
After:
✅ Checklist
👀 Reviewer Notes
This PR improves user experience by clearly indicating the behavior when repository filtering is disabled. It reduces confusion and provides better visual feedback to users.
Summary by Sourcery
Add an informational UI message indicating that repository filtering is disabled and ensure it reflects the current toggle state.
New Features:
Enhancements: