fix(site): display tasks link when no templates contain an AI task (#19184)

Fixes https://github.com/coder/coder/issues/19059

This change ensures we always show the "Tasks" link, even when a deployment doesn't yet have a tasks template set up.
This commit is contained in:
Danielle Maywood
2025-08-05 19:30:17 +01:00
committed by GitHub
parent 760dc8b467
commit cc609cbd53
9 changed files with 7 additions and 65 deletions
-12
View File
@@ -13014,18 +13014,6 @@ func (q *sqlQuerier) GetTemplateVersionsCreatedAfter(ctx context.Context, create
return items, nil
}
const hasTemplateVersionsWithAITask = `-- name: HasTemplateVersionsWithAITask :one
SELECT EXISTS (SELECT 1 FROM template_versions WHERE has_ai_task = TRUE)
`
// Determines if the template versions table has any rows with has_ai_task = TRUE.
func (q *sqlQuerier) HasTemplateVersionsWithAITask(ctx context.Context) (bool, error) {
row := q.db.QueryRowContext(ctx, hasTemplateVersionsWithAITask)
var exists bool
err := row.Scan(&exists)
return exists, err
}
const insertTemplateVersion = `-- name: InsertTemplateVersion :exec
INSERT INTO
template_versions (