Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacopo <beschi.jacopo@gmail.com>2017-10-24 20:49:01 +0300
committerJacopo <beschi.jacopo@gmail.com>2017-11-06 23:30:18 +0300
commitd4a9aedf55793670e40b570b10a1aae6a805d956 (patch)
treeaae221b92ce3ae3fbce416b8cae775348ebd7019 /app/assets/javascripts/search_autocomplete.js
parent15e3d337610d99aa13ee8d52267573e8dc0b73d9 (diff)
Fixes 404 error to `Issues assigned to me` and `Issues I've created` when issues are disabled
The dropdown options `Issues assigned to me` and `Issues I've created` in project search are now hidden when issues are disabled on the project.
Diffstat (limited to 'app/assets/javascripts/search_autocomplete.js')
-rw-r--r--app/assets/javascripts/search_autocomplete.js16
1 files changed, 14 insertions, 2 deletions
diff --git a/app/assets/javascripts/search_autocomplete.js b/app/assets/javascripts/search_autocomplete.js
index f15452ec683..9dec5d7645a 100644
--- a/app/assets/javascripts/search_autocomplete.js
+++ b/app/assets/javascripts/search_autocomplete.js
@@ -162,13 +162,19 @@ import { isInGroupsPage, isInProjectPage, getGroupSlug, getProjectSlug } from '.
items = [
{
header: "" + name
- }, {
+ }
+ ];
+ const issueItems = [
+ {
text: 'Issues assigned to me',
url: issuesPath + "/?assignee_username=" + userName
}, {
text: "Issues I've created",
url: issuesPath + "/?author_username=" + userName
- }, 'separator', {
+ }
+ ];
+ const mergeRequestItems = [
+ {
text: 'Merge requests assigned to me',
url: mrPath + "/?assignee_username=" + userName
}, {
@@ -176,6 +182,11 @@ import { isInGroupsPage, isInProjectPage, getGroupSlug, getProjectSlug } from '.
url: mrPath + "/?author_username=" + userName
}
];
+ if (options.issuesDisabled) {
+ items = items.concat(mergeRequestItems);
+ } else {
+ items = items.concat(...issueItems, 'separator', ...mergeRequestItems);
+ }
if (!name) {
items.splice(0, 1);
}
@@ -408,6 +419,7 @@ import { isInGroupsPage, isInProjectPage, getGroupSlug, getProjectSlug } from '.
gl.projectOptions[projectPath] = {
name: $projectOptionsDataEl.data('name'),
issuesPath: $projectOptionsDataEl.data('issues-path'),
+ issuesDisabled: $projectOptionsDataEl.data('issues-disabled'),
mrPath: $projectOptionsDataEl.data('mr-path')
};
}