Skip to content

Commit

Permalink
slack: fix dropped commits count in push message
Browse files Browse the repository at this point in the history
regressed in 7ce909b
  • Loading branch information
yasunariw committed Dec 6, 2023
1 parent 45c3ab3 commit a0ca842
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
3 changes: 1 addition & 2 deletions lib/slack.ml
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,7 @@ let pp_list_with_previews ~pp_item list =
if dropped > 3 then begin
let h, list' = List.split_n list (num_shown / 2) in
let t = List.drop list' dropped in
let num_after_h = num_items - List.length h in
List.concat [ List.map ~f:pp_item h; [ sprintf "+%d more...\n" num_after_h ]; List.map ~f:pp_item t ]
List.concat [ List.map ~f:pp_item h; [ sprintf "+%d more...\n" dropped ]; List.map ~f:pp_item t ]
end
else List.map ~f:pp_item list

Expand Down
2 changes: 1 addition & 1 deletion test/slack_payloads.expected
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ will notify #all-push-events
{
"channel": "all-push-events",
"username": "monorepo:develop",
"text": "<https://github.com/thatportugueseguy/monorepo/compare/fb245e2a6d52...e2173f38ae43|12 commits> pushed by thatportugueseguy\n`<https://github.com/thatportugueseguy/monorepo/commit/80452f696a8988e7234063d47720a62e902f2afc|80452f69>` Update readme - jose nogueira\n`<https://github.com/thatportugueseguy/monorepo/commit/75170cc6e1b1aa0c603a13b9480ee1e7d1c9b0d7|75170cc6>` Update readme 2 - jose nogueira\n`<https://github.com/thatportugueseguy/monorepo/commit/82e3497b0fb250ef1a19daa0996ae0ad51641bea|82e3497b>` Update readme 3 - jose nogueira\n+9 more...\n\n`<https://github.com/thatportugueseguy/monorepo/commit/d6a17bfc44f7e752e02176ba87ec5a97f5b3316b|d6a17bfc>` Update readme 9 - jose nogueira\n`<https://github.com/thatportugueseguy/monorepo/commit/003927e6c73068f440c28da69386798ece9cb6dc|003927e6>` Update readme 10 - jose nogueira\n`<https://github.com/thatportugueseguy/monorepo/commit/5de643873ff93dc9163c4c63d3fb7c2ee1bb33b4|5de64387>` Update readme 11 - jose nogueira\n`<https://github.com/thatportugueseguy/monorepo/commit/e2173f38ae43865433a182c1fc1b5442d9763b54|e2173f38>` Add TESTING.md - jose nogueira",
"text": "<https://github.com/thatportugueseguy/monorepo/compare/fb245e2a6d52...e2173f38ae43|12 commits> pushed by thatportugueseguy\n`<https://github.com/thatportugueseguy/monorepo/commit/80452f696a8988e7234063d47720a62e902f2afc|80452f69>` Update readme - jose nogueira\n`<https://github.com/thatportugueseguy/monorepo/commit/75170cc6e1b1aa0c603a13b9480ee1e7d1c9b0d7|75170cc6>` Update readme 2 - jose nogueira\n`<https://github.com/thatportugueseguy/monorepo/commit/82e3497b0fb250ef1a19daa0996ae0ad51641bea|82e3497b>` Update readme 3 - jose nogueira\n+5 more...\n\n`<https://github.com/thatportugueseguy/monorepo/commit/d6a17bfc44f7e752e02176ba87ec5a97f5b3316b|d6a17bfc>` Update readme 9 - jose nogueira\n`<https://github.com/thatportugueseguy/monorepo/commit/003927e6c73068f440c28da69386798ece9cb6dc|003927e6>` Update readme 10 - jose nogueira\n`<https://github.com/thatportugueseguy/monorepo/commit/5de643873ff93dc9163c4c63d3fb7c2ee1bb33b4|5de64387>` Update readme 11 - jose nogueira\n`<https://github.com/thatportugueseguy/monorepo/commit/e2173f38ae43865433a182c1fc1b5442d9763b54|e2173f38>` Add TESTING.md - jose nogueira",
"unfurl_links": false
}
===== file ../mock_payloads/push.two_commits_longest_match.json =====
Expand Down

0 comments on commit a0ca842

Please sign in to comment.