Skip to content

Commit 918367c

Browse files
committed
shorten unfurl
author is already in title, no need to spend whole first line on it
1 parent fea354f commit 918367c

File tree

1 file changed

+16
-9
lines changed

1 file changed

+16
-9
lines changed

lib/slack_message.ml

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -121,25 +121,32 @@ let populate_issue repository (issue : issue) =
121121
let populate_commit repository (commit : api_commit) =
122122
let ({ sha; commit; url; author; files; _ } : api_commit) = commit in
123123
let title =
124-
sprintf "`<%s|%s>` *%s - %s*" url (Slack.git_short_sha_hash sha)
124+
sprintf "`<%s|%s>` *%s - <%s|%s>*" url (Slack.git_short_sha_hash sha)
125125
(escape_mrkdwn @@ first_line commit.message)
126+
(escape_mrkdwn author.html_url)
126127
(escape_mrkdwn commit.author.name)
127128
in
128-
let num_change = List.length files in
129-
let prefix_path =
130-
List.map files ~f:(fun f -> f.filename)
131-
|> Common.longest_common_prefix
132-
|> String.split ~on:'/'
133-
|> List.drop_last_exn
134-
|> String.concat ~sep:"/"
129+
let changes =
130+
match files with
131+
| [f] -> sprintf "_modified `%s` (+%d-%d)_" (escape_mrkdwn f.filename) f.additions f.deletions
132+
| _ ->
133+
let prefix_path =
134+
List.map files ~f:(fun f -> f.filename)
135+
|> Common.longest_common_prefix
136+
|> String.split ~on:'/'
137+
|> List.drop_last_exn
138+
|> String.concat ~sep:"/"
139+
in
140+
sprintf "modified %d files in `%s/`" (List.length files) prefix_path
135141
in
136-
let changes = sprintf "%d changed %s in `%s/`" num_change (Slack.pluralize "file" num_change "s") prefix_path in
137142
let text = sprintf "%s\n%s" title changes in
138143
let fallback = sprintf "[%s] %s - %s" (Slack.git_short_sha_hash sha) commit.message commit.author.name in
139144
{
140145
(base_attachment repository) with
146+
(*
141147
author_name = Some author.login;
142148
author_link = Some author.html_url;
149+
*)
143150
author_icon = Some author.avatar_url;
144151
color = Some Colors.gray;
145152
mrkdwn_in = Some [ "text" ];

0 commit comments

Comments
 (0)