From 19bc0052f1069d732231950a0ec958f675d57417 Mon Sep 17 00:00:00 2001 From: Diego Imbert <70353967+diegoimbert@users.noreply.github.com> Date: Thu, 18 Jun 2026 23:22:28 +0200 Subject: [PATCH] fix(backend): include raw_app drafts in list_apps draft_users (#9647) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The home list's draft user badges come from list_apps' `draft_users` subquery, which only matched `draft.typ = 'app'`. `app` and `raw_app` are separate draft kinds over the one `app` table, so a deployed raw app with a pending draft had `is_draft = true` (the join already matches both kinds) but an empty `draft_users` — the row showed a "Draft" badge with no owner badge. Match `typ IN ('app', 'raw_app')`, consistent with the `is_draft` join and the draft-only query. Co-authored-by: Claude Opus 4.8 (1M context) --- backend/windmill-api/src/apps.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/backend/windmill-api/src/apps.rs b/backend/windmill-api/src/apps.rs index 3cb2a1aef6..0615735081 100644 --- a/backend/windmill-api/src/apps.rs +++ b/backend/windmill-api/src/apps.rs @@ -397,10 +397,13 @@ async fn list_apps( "draft.path IS NOT NULL as is_draft", // Per-path draft owners as a JSON array; see scripts.rs for the rationale // (admins-workspace identity fallback, legacy NULL-email row). + // `app`/`raw_app` are separate draft kinds over one `app` table — match + // either (like the `is_draft` join below), else a deployed raw app's draft + // owners are dropped and the row shows "Draft" with no user badge. "(SELECT json_agg(json_build_object('username', COALESCE(u.username, CASE WHEN d.workspace_id = 'admins' THEN d.email END)) ORDER BY COALESCE(u.username, CASE WHEN d.workspace_id = 'admins' THEN d.email END) NULLS LAST) \ FROM draft d \ LEFT JOIN usr u ON u.workspace_id = d.workspace_id AND u.email = d.email \ - WHERE d.workspace_id = app.workspace_id AND d.path = app.path AND d.typ = 'app') as draft_users", + WHERE d.workspace_id = app.workspace_id AND d.path = app.path AND d.typ IN ('app', 'raw_app')) as draft_users", "folder_labels(app.workspace_id, app.path) as inherited_labels", ]) .left()