Skip to content

Commit

Permalink
ellipsis comments
Browse files Browse the repository at this point in the history
  • Loading branch information
alpetric committed Dec 18, 2024
1 parent eab99fc commit 18b7372
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
16 changes: 14 additions & 2 deletions backend/windmill-api/src/slack_approvals.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,10 @@ pub async fn slack_app_callback_handler(
tracing::debug!("Form data: {:#?}", form_data);
let payload: Payload = serde_json::from_str(&form_data.payload)?;

if payload.actions.is_empty() {
return Err(Error::BadRequest("No actions found in payload.".to_string()));
}

let action_value = payload.actions[0].value.clone();
let response_url = payload.response_url.clone();

Expand Down Expand Up @@ -126,13 +130,21 @@ pub async fn slack_app_callback_handler(
tracing::debug!("W ID: {}, Action: {}, Job ID: {}, Resume ID: {}, Secret: {}, Approver: {:?}, State JSON: {:?}",
w_id, action, job_id, resume_id, secret, approver.approver, state_json);

let job_uuid = Uuid::from_str(job_id).map_err(|_| {
Error::BadRequest("Invalid job ID format.".to_string())
})?;

let resume_id_parsed = resume_id.parse::<u32>().map_err(|_| {
Error::BadRequest("Invalid resume ID format.".to_string())
})?;

let res = resume_suspended_job(
authed,
Extension(db),
Path((
w_id.to_string(),
Uuid::from_str(job_id).unwrap_or_default(),
resume_id.parse::<u32>().unwrap_or_default(),
job_uuid,
resume_id_parsed,
secret.to_string(),
)),
Query(approver),
Expand Down
2 changes: 1 addition & 1 deletion typescript-client/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -869,7 +869,7 @@ export async function requestInteractiveSlackApproval({

if (!flowJobId) {
throw new Error(
"You can't use this function in a standalon script or flow step preview. Please us it in a flow or a flow preview."
"You can't use this function in a standalone script or flow step preview. Please us it in a flow or a flow preview."
);
}

Expand Down

0 comments on commit 18b7372

Please sign in to comment.