Release tag filtering doesn't work on Merge Requests/Issues dashboard
While I was testing for !105197 (merged), I've discovered that the Release filtering doesn't work on dashboard. I think that's because we implicitly provide project_id
from the current project url and it's coming in as NULL
in the case of dashboard as it is not under any project.
Also, I see frontend also seems to be using the current project_id to request the list of release_tags and it's failing because there is no project.
We may need to fix release_tag lookup for frontend and the actual filtering separately.
Screen recording
Proposal
Remove the Release
and Environment
filters from pages that are not scoped to a project.
The environment
filter has the same issue as reported in #385021 (comment 1253031425)
An old diff is below, this may need to be modified slightly.
diff --git a/app/assets/javascripts/filtered_search/issuable_filtered_search_token_keys.js b/app/assets/javascripts/filtered_search/issuable_filtered_search_token_keys.js
index 8aa99ec52f95..aa0f2b4de634 100644
--- a/app/assets/javascripts/filtered_search/issuable_filtered_search_token_keys.js
+++ b/app/assets/javascripts/filtered_search/issuable_filtered_search_token_keys.js
@@ -45,15 +45,6 @@ export const tokenKeys = [
icon: 'clock',
tag: '%milestone',
},
- {
- formattedKey: TOKEN_TITLE_RELEASE,
- key: TOKEN_TYPE_RELEASE,
- type: 'string',
- param: 'tag',
- symbol: '',
- icon: 'rocket',
- tag: __('tag name'),
- },
{
formattedKey: TOKEN_TITLE_LABEL,
key: TOKEN_TYPE_LABEL,
@@ -78,6 +69,18 @@ if (gon.current_user_id) {
});
}
+if (gon.project_id) {
+ tokenKeys.push({
+ formattedKey: TOKEN_TITLE_RELEASE,
+ key: TOKEN_TYPE_RELEASE,
+ type: 'string',
+ param: 'tag',
+ symbol: '',
+ icon: 'rocket',
+ tag: __('tag name'),
+ })
+}
+
export const alternativeTokenKeys = [
{
formattedKey: TOKEN_TITLE_LABEL,
Edited by Andrew Fontaine