@@ -1380,6 +1380,12 @@ func (q *FakeQuerier) getProvisionerJobsByIDsWithQueuePositionLockedGlobalQueue(
13801380return jobs ,nil
13811381}
13821382
1383+ // isDeprecated returns true if the template is deprecated.
1384+ // A template is considered deprecated when it has a deprecation message.
1385+ func isDeprecated (template database.Template )bool {
1386+ return template .Deprecated != ""
1387+ }
1388+
13831389func (* FakeQuerier )AcquireLock (_ context.Context ,_ int64 )error {
13841390return xerrors .New ("AcquireLock must only be called within a transaction" )
13851391}
@@ -13021,8 +13027,17 @@ func (q *FakeQuerier) GetAuthorizedTemplates(ctx context.Context, arg database.G
1302113027if arg .ExactName != "" && ! strings .EqualFold (template .Name ,arg .ExactName ) {
1302213028continue
1302313029}
13024- // Check if the search query filter 'Deprecated' status matches the template's 'Deprecated' status
13025- if arg .Deprecated .Valid && arg .Deprecated .Bool != (template .Deprecated != "" ) {
13030+ // Filters templates based on the search query filter 'Deprecated' status
13031+ // Matching SQL logic:
13032+ // -- Filter by deprecated
13033+ // AND CASE
13034+ // WHEN :deprecated IS NOT NULL THEN
13035+ // CASE
13036+ // WHEN :deprecated THEN deprecated != ''
13037+ // ELSE deprecated = ''
13038+ // END
13039+ // ELSE true
13040+ if arg .Deprecated .Valid && arg .Deprecated .Bool != isDeprecated (template ) {
1302613041continue
1302713042}
1302813043if arg .FuzzyName != "" {