File tree 1 file changed +17
-2
lines changed
1 file changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -1380,6 +1380,12 @@ func (q *FakeQuerier) getProvisionerJobsByIDsWithQueuePositionLockedGlobalQueue(
1380
1380
return jobs , nil
1381
1381
}
1382
1382
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
+
1383
1389
func (* FakeQuerier ) AcquireLock (_ context.Context , _ int64 ) error {
1384
1390
return xerrors .New ("AcquireLock must only be called within a transaction" )
1385
1391
}
@@ -13021,8 +13027,17 @@ func (q *FakeQuerier) GetAuthorizedTemplates(ctx context.Context, arg database.G
13021
13027
if arg .ExactName != "" && ! strings .EqualFold (template .Name , arg .ExactName ) {
13022
13028
continue
13023
13029
}
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 ) {
13026
13041
continue
13027
13042
}
13028
13043
if arg .FuzzyName != "" {
You can’t perform that action at this time.
0 commit comments