diff --git a/app/finders/personal_access_tokens_finder.rb b/app/finders/personal_access_tokens_finder.rb index 57d5cd03f730fe41b9f42b67fa812d027103e41b..d11514aa64ead2ceabe217e0195c1ecb56d81688 100644 --- a/app/finders/personal_access_tokens_finder.rb +++ b/app/finders/personal_access_tokens_finder.rb @@ -105,7 +105,7 @@ def by_state(tokens) def by_revoked_state(tokens) return tokens unless params.has_key?(:revoked) - params[:revoked] ? tokens.revoked : tokens.not_revoked + Gitlab::Utils.to_boolean(params[:revoked]) ? tokens.revoked : tokens.not_revoked end def by_created_before(tokens) diff --git a/ee/spec/finders/authn/credentials_inventory_personal_access_tokens_finder_spec.rb b/ee/spec/finders/authn/credentials_inventory_personal_access_tokens_finder_spec.rb index a3e807984ac05ff0d22c102ab00125480089a234..e54bb1b605daf539d948de64a943a2d6e3d09e73 100644 --- a/ee/spec/finders/authn/credentials_inventory_personal_access_tokens_finder_spec.rb +++ b/ee/spec/finders/authn/credentials_inventory_personal_access_tokens_finder_spec.rb @@ -35,8 +35,10 @@ describe 'by revoked state' do where(:by_revoked_state, :expected_tokens) do - true | [:revoked] - false | [:active, :expired] + true | [:revoked] + 'true' | [:revoked] + false | [:active, :expired] + 'false' | [:active, :expired] end with_them do diff --git a/spec/finders/personal_access_tokens_finder_spec.rb b/spec/finders/personal_access_tokens_finder_spec.rb index 2da1ed2d7df7b89ea99e513f74d99c1cee72daef..610171c27bdca3d3416bbf0a85e818afd4825c0d 100644 --- a/spec/finders/personal_access_tokens_finder_spec.rb +++ b/spec/finders/personal_access_tokens_finder_spec.rb @@ -227,9 +227,11 @@ describe 'by revoked state' do where(:by_revoked_state, :expected_tokens) do - nil | [:active, :active_other, :expired, :active_impersonation, :expired_impersonation, :bot, :with_group, :with_another_group] - true | [:revoked, :revoked_impersonation] - false | [:active, :active_other, :expired, :active_impersonation, :expired_impersonation, :bot, :with_group, :with_another_group] + nil | [:active, :active_other, :expired, :active_impersonation, :expired_impersonation, :bot, :with_group, :with_another_group] + true | [:revoked, :revoked_impersonation] + 'true' | [:revoked, :revoked_impersonation] + false | [:active, :active_other, :expired, :active_impersonation, :expired_impersonation, :bot, :with_group, :with_another_group] + 'false' | [:active, :active_other, :expired, :active_impersonation, :expired_impersonation, :bot, :with_group, :with_another_group] end with_them do