Skip to content

Commit

Permalink
chore: Move Slack approval text to top level (#425)
Browse files Browse the repository at this point in the history
  • Loading branch information
johnjcsmith authored Dec 30, 2024
1 parent 72c103c commit e73d437
Showing 1 changed file with 4 additions and 17 deletions.
21 changes: 4 additions & 17 deletions control-plane/src/modules/integrations/slack/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,14 +166,9 @@ export const handleApprovalRequest = async ({
client?.chat.postMessage({
thread_ts: metadata[THREAD_META_KEY],
channel: metadata[CHANNEL_META_KEY],
mrkdwn: true,
text: `I need your approval to call \`${service}.${targetFn}\` on run <${env.APP_ORIGIN}/clusters/${clusterId}/runs/${runId}|${runId}>`,
blocks: [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": `I need your approval to call \`${service}.${targetFn}\` on run <${env.APP_ORIGIN}/clusters/${clusterId}/runs/${runId}|${runId}>`
}
},
{
"type": "actions",
"elements": [
Expand Down Expand Up @@ -620,19 +615,11 @@ const handleCallApprovalAction = async ({
callId: action.value,
});

const blockMessage = `${approved ? "✅" : "❌"} Call \`${action.value}\` was ${approved ? "approved" : "denied"}`;
const text = `${approved ? "✅" : "❌"} Call \`${action.value}\` was ${approved ? "approved" : "denied"}`;

await client.chat.update({
channel: channelId,
ts: messageTs,
blocks: [
{
type: 'section',
text: {
type: 'mrkdwn',
text: blockMessage
},
},
],
text,
});
};

0 comments on commit e73d437

Please sign in to comment.