Skip to content

Commit 25f85b6

Browse files
committed
Add A keybinding to dismiss all PRs by an author
Useful for hiding noisy authors like dependabot. Works like D for repos — press shift-A on any PR to hide all PRs by that author for the session.
1 parent 328b1f3 commit 25f85b6

1 file changed

Lines changed: 19 additions & 7 deletions

File tree

tui.go

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,9 @@ func nameColor(name string) lipgloss.Style {
5858
type model struct {
5959
items []ClassifiedPR
6060
cursor int
61-
dismissed map[string]bool
62-
dismissedRepos map[string]bool
61+
dismissed map[string]bool
62+
dismissedRepos map[string]bool
63+
dismissedAuthors map[string]bool
6364
cols colWidths
6465
width int
6566
height int
@@ -231,8 +232,9 @@ func newModel(cfg modelConfig) model {
231232
dismissedRepos = make(map[string]bool)
232233
}
233234
m := model{
234-
dismissed: make(map[string]bool),
235-
dismissedRepos: dismissedRepos,
235+
dismissed: make(map[string]bool),
236+
dismissedRepos: dismissedRepos,
237+
dismissedAuthors: make(map[string]bool),
236238
rawPRs: cfg.rawPRs,
237239
me: cfg.me,
238240
myTeams: cfg.myTeams,
@@ -390,6 +392,15 @@ func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
390392
m.cursor = len(vis) - 1
391393
}
392394
}
395+
case "A":
396+
if pr, ok := m.selectedPR(); ok {
397+
m.dismissedAuthors[pr.Author] = true
398+
m.statusMsg = fmt.Sprintf("Dismissed author %s", pr.Author)
399+
vis := m.visibleItems()
400+
if m.cursor >= len(vis) && m.cursor > 0 {
401+
m.cursor = len(vis) - 1
402+
}
403+
}
393404
case "c":
394405
if pr, ok := m.selectedPR(); ok {
395406
m.statusMsg = fmt.Sprintf("Commenting on %s#%d...", pr.RepoName, pr.Number)
@@ -554,7 +565,7 @@ func (m model) View() string {
554565
var help string
555566
if m.showAuthor {
556567
help = helpStyle.Render(fmt.Sprintf(
557-
"j/k: navigate enter: open d/D: dismiss PR/repo c: @claude o: %s a: %s r: refresh ?: legend q: quit",
568+
"j/k: navigate enter: open d/D/A: dismiss PR/repo/author c: @claude o: %s a: %s r: refresh ?: legend q: quit",
558569
sortLabel, authorLabel,
559570
))
560571
} else {
@@ -567,7 +578,7 @@ func (m model) View() string {
567578
assignedLabel = "assigned:on"
568579
}
569580
help = helpStyle.Render(fmt.Sprintf(
570-
"j/k: navigate enter: open d/D: dismiss PR/repo c: @claude s: %s f: %s o: %s a: %s r: refresh ?: legend q: quit",
581+
"j/k: navigate enter: open d/D/A: dismiss PR/repo/author c: @claude s: %s f: %s o: %s a: %s r: refresh ?: legend q: quit",
571582
authoredLabel, assignedLabel, sortLabel, authorLabel,
572583
))
573584
}
@@ -618,6 +629,7 @@ func (m model) renderLegend() string {
618629
b.WriteString(" enter Open PR in browser\n")
619630
b.WriteString(" d Dismiss current PR (hide it)\n")
620631
b.WriteString(" D Dismiss entire repo\n")
632+
b.WriteString(" A Dismiss author (e.g. dependabot)\n")
621633
b.WriteString(" s Toggle showing PRs you authored\n")
622634
b.WriteString(" f Toggle showing only PRs assigned to you\n")
623635
b.WriteString(" a Toggle author mode (your PRs + their review status)\n")
@@ -633,7 +645,7 @@ func (m model) renderLegend() string {
633645
func (m model) visibleItems() []ClassifiedPR {
634646
var vis []ClassifiedPR
635647
for _, pr := range m.items {
636-
if m.dismissed[pr.URL] || m.dismissedRepos[pr.RepoName] {
648+
if m.dismissed[pr.URL] || m.dismissedRepos[pr.RepoName] || m.dismissedAuthors[pr.Author] {
637649
continue
638650
}
639651
vis = append(vis, pr)

0 commit comments

Comments
 (0)