fix: support custom keybindings for PR/Issue notifications#782
Conversation
|
Yesss thank you! |
5787089 to
ff4bfcc
Compare
|
I think we should also support overriding notification view specific keybinds, like - mark as done etc, as part of this pr. |
…ations view Both isUserDefinedKeybinding() and executeKeybinding() only handled PRsView, IssuesView, and RepoView — the NotificationsView case was missing entirely. Custom keybindings defined under keybindings.prs or keybindings.issues were never recognized or executed when viewing notifications. Add NotificationsView handling that checks the notification's subject type and dispatches to the appropriate keybinding set. Template variables RepoName and PrNumber/IssueNumber are always available. When the sidebar is open, HeadRefName, BaseRefName, and Author are also populated for PR notifications, and Author for Issue notifications.
Fixes QF1012 staticcheck lint in branchsidebar.go.
Add keybindings.notifications config option, following the same pattern as keybindings.prs, keybindings.issues, and keybindings.branches. Users can now rebind built-in notification keys (view, markAsDone, markAllAsDone, markAsRead, markAllAsRead, unsubscribe, toggleBookmark, open, sortByRepo, switchToPRs, toggleSmartFiltering), and define custom command bindings with RepoName and Number template variables. Notification-specific custom commands are checked before the existing PR/Issue subject-type custom commands, so they work regardless of what type of notification is currently selected.
ff4bfcc to
51e8a8a
Compare
👍 Yes — made it so: sideshowbarker@51e8a8a |
1 similar comment
👍 Yes — made it so: sideshowbarker@51e8a8a |
Problem: Custom keybindings defined under
keybindings.prsorkeybindings.issuesin any user config unexpectedly do not work when viewing PR/Issue notifications in the Notifications dashboard.Root cause: Both
isUserDefinedKeybinding()andexecuteKeybinding()only handlePRsView,IssuesView, andRepoView— theNotificationsViewcase is missing entirely.Fix: This PR adds
NotificationsViewhandling that checks the notification’s subject type, and dispatches to the appropriate keybinding set.Template variables
Template variables
RepoNameandPrNumber/IssueNumberare always available. When the sidebar is open (i.e., the user has pressed Enter to view the notification), additional fields are populated from the fetched PR/Issue data:RepoName,PrNumber,RepoPathHeadRefName,BaseRefName,AuthorRepoName,IssueNumber,RepoPathAuthorIf a command template references a sidebar-only field before the sidebar is opened, the template engine’s
missingkey=erroroption produces a clear error message.