mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-09-09 08:03:50 +00:00
fix: let a draft-only schedule, trigger or resource be deleted (#11010)
* fix: let a draft-only schedule, trigger or resource be deleted Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012SV5kjTis3AFtTx2nW2VRi * fix: keep the legacy-draft write gate out of the draft-only delete Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012SV5kjTis3AFtTx2nW2VRi * fix: don't gate a draft-only resource discard on the deployment rules Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012SV5kjTis3AFtTx2nW2VRi * docs: condense the draft-only delete comments per the comment policy Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012SV5kjTis3AFtTx2nW2VRi --------- Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
1be390aa87
commit
8d0f4754e4
@@ -18,8 +18,9 @@ use windmill_common::{
|
||||
error::{Error, JsonResult, Result},
|
||||
trigger_history::{self, TriggerHistoryEvent, TriggerOperation, TriggerSource},
|
||||
user_drafts::{
|
||||
delete_all_drafts_for_path, delete_own_draft_for_path, fetch_draft_only_list_rows,
|
||||
overlay_or_draft_only, UserDraftItemKind, WithDraftOverlay, WithDraftQuery,
|
||||
delete_all_drafts_for_path, delete_draft_only_for_path, delete_own_draft_for_path,
|
||||
fetch_draft_only_list_rows, overlay_or_draft_only, UserDraftItemKind, WithDraftOverlay,
|
||||
WithDraftQuery,
|
||||
},
|
||||
utils::{paginate, Pagination, StripPath},
|
||||
worker::CLOUD_HOSTED,
|
||||
@@ -990,6 +991,18 @@ async fn delete_trigger<T: TriggerCrud>(
|
||||
.await?;
|
||||
|
||||
if !deleted {
|
||||
drop(tx);
|
||||
if delete_draft_only_for_path(
|
||||
&db,
|
||||
&workspace_id,
|
||||
T::user_draft_item_kind(),
|
||||
path,
|
||||
&authed.email,
|
||||
)
|
||||
.await?
|
||||
{
|
||||
return Ok(format!("Draft-only trigger '{}' deleted", path));
|
||||
}
|
||||
return Err(Error::NotFound(format!(
|
||||
"Trigger not found at path: {}",
|
||||
path
|
||||
|
||||
Reference in New Issue
Block a user