Skip to content

Commit

Permalink
Suppress multiple acks in issue view
Browse files Browse the repository at this point in the history
When viewing an issue, if the same person has acked the issue multiple
times, it shows up as multiple acks in the acknowledgement list.  This
PR suppresses multiple acks by the same person, showing only the first.

Fixes # 46

Signed-off-by: Chris Collins <[email protected]>
  • Loading branch information
clcollins committed Jun 20, 2024
1 parent 07eb325 commit e1b6c81
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pkg/tui/views.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"bytes"
"fmt"
"html/template"
"slices"
"strings"

"github.com/PagerDuty/go-pagerduty"
Expand Down Expand Up @@ -238,8 +239,12 @@ func summarizeIncident(i *pagerduty.Incident) incidentSummary {
for _, asn := range i.Assignments {
s.Assigned = append(s.Assigned, asn.Assignee.Summary)
}

for _, ack := range i.Acknowledgements {
s.Acknowledged = append(s.Acknowledged, ack.Acknowledger.Summary)
// Suppress multiple acknowledgements by the same person being shown in the summary
if !slices.Contains(s.Acknowledged, ack.Acknowledger.Summary) {
s.Acknowledged = append(s.Acknowledged, ack.Acknowledger.Summary)
}
}

return s
Expand Down

0 comments on commit e1b6c81

Please sign in to comment.