@@ -110,8 +110,7 @@ let partition_push cfg n =
110
110
|> List. concat
111
111
in
112
112
let prefix_chans =
113
- let chans = List. map rules ~f: (fun (rule : prefix_rule ) -> rule.chan) in
114
- let chans = Option. value_map cfg.prefix_rules.default ~default: chans ~f: (fun default -> default :: chans) in
113
+ let chans = Option. to_list cfg.prefix_rules.default @ List. map rules ~f: (fun (rule : prefix_rule ) -> rule.chan) in
115
114
List. dedup_and_sort chans ~compare: String. compare
116
115
in
117
116
List. filter_map prefix_chans ~f: (fun chan ->
@@ -127,7 +126,7 @@ let filter_label rules label =
127
126
| true -> Some rule.chan)
128
127
129
128
let partition_label cfg labels =
130
- let default = Option. value_map cfg.label_rules.default ~default: [] ~f: ( fun webhook -> [ webhook ]) in
129
+ let default = Option. to_list cfg.label_rules.default in
131
130
match labels with
132
131
| [] -> default
133
132
| labels ->
@@ -181,10 +180,7 @@ let partition_commit cfg files =
181
180
let names = List. map ~f: (fun f -> f.filename) files in
182
181
match unique_chans_of_files cfg.prefix_rules.rules names with
183
182
| _ :: _ as xs -> xs
184
- | [] ->
185
- match cfg.prefix_rules.default with
186
- | Some webhook -> [ webhook ]
187
- | None -> []
183
+ | [] -> Option. to_list cfg.prefix_rules.default
188
184
189
185
let hide_cancelled (notification : status_notification ) cfg =
190
186
let find_cancelled status_state =
@@ -221,9 +217,7 @@ let partition_status (ctx : Context.t) (n : status_notification) =
221
217
let cfg = ctx.cfg in
222
218
let get_commit_info () =
223
219
match % lwt Github. generate_query_commmit cfg ~url: n.commit.url ~sha: n.commit.sha with
224
- | None ->
225
- let default = Option. value_map cfg.prefix_rules.default ~default: [] ~f: (fun webhook -> [ webhook ]) in
226
- Lwt. return default
220
+ | None -> Lwt. return @@ Option. to_list cfg.prefix_rules.default
227
221
| Some commit ->
228
222
match
229
223
List. exists n.branches ~f: (fun { name } -> is_main_merge_message ~msg: commit.commit.message ~branch: name cfg)
@@ -257,7 +251,7 @@ let partition_status (ctx : Context.t) (n : status_notification) =
257
251
res
258
252
259
253
let partition_commit_comment cfg n =
260
- let default = Option. value_map cfg.prefix_rules.default ~default: [] ~f: ( fun webhook -> [ webhook ]) in
254
+ let default = Option. to_list cfg.prefix_rules.default in
261
255
match n.comment.path with
262
256
| None ->
263
257
( match % lwt Github. generate_commit_from_commit_comment cfg n with
0 commit comments