File tree Expand file tree Collapse file tree 4 files changed +13
-5
lines changed Expand file tree Collapse file tree 4 files changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -331,8 +331,7 @@ module Action (Github_api : Api.Github) (Slack_api : Api.Slack) = struct
331
331
let % lwt unfurls = List. map links ~f: process |> Lwt. all |> Lwt. map List. filter_opt |> Lwt. map StringMap. of_list in
332
332
if Map. is_empty unfurls then Lwt. return " ignored: no links to unfurl"
333
333
else begin
334
- let req : Slack_j.chat_unfurl_req = { channel = event.channel; ts = event.message_ts; unfurls } in
335
- match % lwt Slack_api. send_chat_unfurl ~ctx req with
334
+ match % lwt Slack_api. send_chat_unfurl ~ctx ~channel: event.channel ~ts: event.message_ts ~unfurls () with
336
335
| Ok () -> Lwt. return " ok"
337
336
| Error e ->
338
337
log#error " %s" e;
Original file line number Diff line number Diff line change 18
18
19
19
module type Slack = sig
20
20
val send_notification : ctx :Context .t -> msg :post_message_req -> unit slack_response Lwt .t
21
- val send_chat_unfurl : ctx :Context .t -> chat_unfurl_req -> unit slack_response Lwt .t
21
+
22
+ val send_chat_unfurl
23
+ : ctx:Context. t ->
24
+ channel:string ->
25
+ ts:string ->
26
+ unfurls:message_attachment Common.StringMap. t ->
27
+ unit ->
28
+ unit slack_response Lwt. t
29
+
22
30
val send_auth_test : ctx :Context .t -> unit -> auth_test_res slack_response Lwt .t
23
31
end
Original file line number Diff line number Diff line change 25
25
26
26
module Slack_base : Api .Slack = struct
27
27
let send_notification ~ctx :_ ~msg :_ = Lwt. return @@ Error " undefined for local setup"
28
- let send_chat_unfurl ~ctx :_ _ = Lwt. return @@ Error " undefined for local setup"
28
+ let send_chat_unfurl ~ctx :_ ~ channel : _ ~ ts : _ ~ unfurls : _ () = Lwt. return @@ Error " undefined for local setup"
29
29
let send_auth_test ~ctx :_ () = Lwt. return @@ Error " undefined for local setup"
30
30
end
31
31
Original file line number Diff line number Diff line change @@ -139,7 +139,8 @@ module Slack : Api.Slack = struct
139
139
| Error e -> Lwt. return @@ build_error e
140
140
end
141
141
142
- let send_chat_unfurl ~(ctx : Context.t ) req =
142
+ let send_chat_unfurl ~(ctx : Context.t ) ~channel ~ts ~unfurls () =
143
+ let req = Slack_j. { channel; ts; unfurls } in
143
144
let data = Slack_j. string_of_chat_unfurl_req req in
144
145
request_token_auth ~name: " unfurl slack links"
145
146
~body: (`Raw (" application/json" , data))
You can’t perform that action at this time.
0 commit comments