Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
gitlab-ce
Commits
352e3222
Commit
352e3222
authored
Jul 02, 2018
by
Jan Beckmann
Committed by
Sean McGivern
Jul 02, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Resolve "404 when trying to create a new issue from the group"
parent
1de68dc3
Changes
14
Show whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
89 additions
and
20 deletions
+89
-20
app/assets/javascripts/api.js
app/assets/javascripts/api.js
+6
-5
app/assets/javascripts/pages/search/show/search.js
app/assets/javascripts/pages/search/show/search.js
+1
-1
app/assets/javascripts/project_select.js
app/assets/javascripts/project_select.js
+4
-1
app/views/groups/issues.html.haml
app/views/groups/issues.html.haml
+1
-1
app/views/groups/merge_requests.html.haml
app/views/groups/merge_requests.html.haml
+1
-1
app/views/shared/empty_states/_issues.html.haml
app/views/shared/empty_states/_issues.html.haml
+1
-1
app/views/shared/empty_states/_merge_requests.html.haml
app/views/shared/empty_states/_merge_requests.html.haml
+1
-1
changelogs/unreleased/47462-issues-disabled-group-page.yml
changelogs/unreleased/47462-issues-disabled-group-page.yml
+6
-0
doc/api/groups.md
doc/api/groups.md
+2
-0
lib/api/groups.rb
lib/api/groups.rb
+4
-0
spec/features/groups/empty_states_spec.rb
spec/features/groups/empty_states_spec.rb
+22
-8
spec/features/groups/issues_spec.rb
spec/features/groups/issues_spec.rb
+22
-0
spec/features/groups/merge_requests_spec.rb
spec/features/groups/merge_requests_spec.rb
+17
-0
spec/javascripts/api_spec.js
spec/javascripts/api_spec.js
+1
-1
No files found.
app/assets/javascripts/api.js
View file @
352e3222
...
@@ -150,14 +150,15 @@ const Api = {
...
@@ -150,14 +150,15 @@ const Api = {
},
},
// Return group projects list. Filtered by query
// Return group projects list. Filtered by query
groupProjects
(
groupId
,
query
,
callback
)
{
groupProjects
(
groupId
,
query
,
options
,
callback
)
{
const
url
=
Api
.
buildUrl
(
Api
.
groupProjectsPath
).
replace
(
'
:id
'
,
groupId
);
const
url
=
Api
.
buildUrl
(
Api
.
groupProjectsPath
).
replace
(
'
:id
'
,
groupId
);
return
axios
const
defaults
=
{
.
get
(
url
,
{
params
:
{
search
:
query
,
search
:
query
,
per_page
:
20
,
per_page
:
20
,
},
};
return
axios
.
get
(
url
,
{
params
:
Object
.
assign
({},
defaults
,
options
),
})
})
.
then
(({
data
})
=>
callback
(
data
));
.
then
(({
data
})
=>
callback
(
data
));
},
},
...
...
app/assets/javascripts/pages/search/show/search.js
View file @
352e3222
...
@@ -105,7 +105,7 @@ export default class Search {
...
@@ -105,7 +105,7 @@ export default class Search {
getProjectsData
(
term
)
{
getProjectsData
(
term
)
{
return
new
Promise
((
resolve
)
=>
{
return
new
Promise
((
resolve
)
=>
{
if
(
this
.
groupId
)
{
if
(
this
.
groupId
)
{
Api
.
groupProjects
(
this
.
groupId
,
term
,
resolve
);
Api
.
groupProjects
(
this
.
groupId
,
term
,
{},
resolve
);
}
else
{
}
else
{
Api
.
projects
(
term
,
{
Api
.
projects
(
term
,
{
order_by
:
'
id
'
,
order_by
:
'
id
'
,
...
...
app/assets/javascripts/project_select.js
View file @
352e3222
...
@@ -47,7 +47,10 @@ export default function projectSelect() {
...
@@ -47,7 +47,10 @@ export default function projectSelect() {
projectsCallback
=
finalCallback
;
projectsCallback
=
finalCallback
;
}
}
if
(
_this
.
groupId
)
{
if
(
_this
.
groupId
)
{
return
Api
.
groupProjects
(
_this
.
groupId
,
query
.
term
,
projectsCallback
);
return
Api
.
groupProjects
(
_this
.
groupId
,
query
.
term
,
{
with_issues_enabled
:
_this
.
withIssuesEnabled
,
with_merge_requests_enabled
:
_this
.
withMergeRequestsEnabled
,
},
projectsCallback
);
}
else
{
}
else
{
return
Api
.
projects
(
query
.
term
,
{
return
Api
.
projects
(
query
.
term
,
{
order_by
:
_this
.
orderBy
,
order_by
:
_this
.
orderBy
,
...
...
app/views/groups/issues.html.haml
View file @
352e3222
...
@@ -9,7 +9,7 @@
...
@@ -9,7 +9,7 @@
=
render
'shared/issuable/nav'
,
type: :issues
=
render
'shared/issuable/nav'
,
type: :issues
.nav-controls
.nav-controls
=
render
'shared/issuable/feed_buttons'
=
render
'shared/issuable/feed_buttons'
=
render
'shared/new_project_item_select'
,
path:
'issues/new'
,
label:
"New issue"
,
type: :issues
=
render
'shared/new_project_item_select'
,
path:
'issues/new'
,
label:
"New issue"
,
type: :issues
,
with_feature_enabled:
'issues'
=
render
'shared/issuable/search_bar'
,
type: :issues
=
render
'shared/issuable/search_bar'
,
type: :issues
...
...
app/views/groups/merge_requests.html.haml
View file @
352e3222
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
=
render
'shared/issuable/nav'
,
type: :merge_requests
=
render
'shared/issuable/nav'
,
type: :merge_requests
-
if
current_user
-
if
current_user
.nav-controls
.nav-controls
=
render
'shared/new_project_item_select'
,
path:
'merge_requests/new'
,
label:
"New merge request"
,
type: :merge_requests
=
render
'shared/new_project_item_select'
,
path:
'merge_requests/new'
,
label:
"New merge request"
,
type: :merge_requests
,
with_feature_enabled:
'merge_requests'
=
render
'shared/issuable/search_bar'
,
type: :merge_requests
=
render
'shared/issuable/search_bar'
,
type: :merge_requests
...
...
app/views/shared/empty_states/_issues.html.haml
View file @
352e3222
...
@@ -16,7 +16,7 @@
...
@@ -16,7 +16,7 @@
-
if
has_button
-
if
has_button
.text-center
.text-center
-
if
project_select_button
-
if
project_select_button
=
render
'shared/new_project_item_select'
,
path:
'issues/new'
,
label:
'New issue'
,
type: :issues
=
render
'shared/new_project_item_select'
,
path:
'issues/new'
,
label:
'New issue'
,
type: :issues
,
with_feature_enabled:
'issues'
-
else
-
else
=
link_to
'New issue'
,
button_path
,
class:
'btn btn-success'
,
title:
'New issue'
,
id:
'new_issue_link'
=
link_to
'New issue'
,
button_path
,
class:
'btn btn-success'
,
title:
'New issue'
,
id:
'new_issue_link'
-
else
-
else
...
...
app/views/shared/empty_states/_merge_requests.html.haml
View file @
352e3222
...
@@ -15,7 +15,7 @@
...
@@ -15,7 +15,7 @@
=
_
(
"Interested parties can even contribute by pushing commits if they want to."
)
=
_
(
"Interested parties can even contribute by pushing commits if they want to."
)
.text-center
.text-center
-
if
project_select_button
-
if
project_select_button
=
render
'shared/new_project_item_select'
,
path:
'merge_requests/new'
,
label:
_
(
'New merge request'
),
type: :merge_requests
=
render
'shared/new_project_item_select'
,
path:
'merge_requests/new'
,
label:
_
(
'New merge request'
),
type: :merge_requests
,
with_feature_enabled:
'merge_requests'
-
else
-
else
=
link_to
_
(
'New merge request'
),
button_path
,
class:
'btn btn-new'
,
title:
_
(
'New merge request'
),
id:
'new_merge_request_link'
=
link_to
_
(
'New merge request'
),
button_path
,
class:
'btn btn-new'
,
title:
_
(
'New merge request'
),
id:
'new_merge_request_link'
-
else
-
else
...
...
changelogs/unreleased/47462-issues-disabled-group-page.yml
0 → 100644
View file @
352e3222
---
title
:
Only show new issue / new merge request on group page when issues / merge requests
are enabled
merge_request
:
19869
author
:
Jan Beckmann
type
:
fixed
doc/api/groups.md
View file @
352e3222
...
@@ -147,6 +147,8 @@ Parameters:
...
@@ -147,6 +147,8 @@ Parameters:
|
`simple`
| boolean | no | Return only the ID, URL, name, and path of each project |
|
`simple`
| boolean | no | Return only the ID, URL, name, and path of each project |
|
`owned`
| boolean | no | Limit by projects owned by the current user |
|
`owned`
| boolean | no | Limit by projects owned by the current user |
|
`starred`
| boolean | no | Limit by projects starred by the current user |
|
`starred`
| boolean | no | Limit by projects starred by the current user |
|
`with_issues_enabled`
| boolean | no | Limit by enabled issues feature |
|
`with_merge_requests_enabled`
| boolean | no | Limit by enabled merge requests feature |
|
`with_custom_attributes`
| boolean | no | Include
[
custom attributes
](
custom_attributes.md
)
in response (admins only) |
|
`with_custom_attributes`
| boolean | no | Include
[
custom attributes
](
custom_attributes.md
)
in response (admins only) |
Example response:
Example response:
...
...
lib/api/groups.rb
View file @
352e3222
...
@@ -56,6 +56,8 @@ module API
...
@@ -56,6 +56,8 @@ module API
def
find_group_projects
(
params
)
def
find_group_projects
(
params
)
group
=
find_group!
(
params
[
:id
])
group
=
find_group!
(
params
[
:id
])
projects
=
GroupProjectsFinder
.
new
(
group:
group
,
current_user:
current_user
,
params:
project_finder_params
).
execute
projects
=
GroupProjectsFinder
.
new
(
group:
group
,
current_user:
current_user
,
params:
project_finder_params
).
execute
projects
=
projects
.
with_issues_available_for_user
(
current_user
)
if
params
[
:with_issues_enabled
]
projects
=
projects
.
with_merge_requests_enabled
if
params
[
:with_merge_requests_enabled
]
projects
=
reorder_projects
(
projects
)
projects
=
reorder_projects
(
projects
)
paginate
(
projects
)
paginate
(
projects
)
end
end
...
@@ -191,6 +193,8 @@ module API
...
@@ -191,6 +193,8 @@ module API
desc:
'Return only the ID, URL, name, and path of each project'
desc:
'Return only the ID, URL, name, and path of each project'
optional
:owned
,
type:
Boolean
,
default:
false
,
desc:
'Limit by owned by authenticated user'
optional
:owned
,
type:
Boolean
,
default:
false
,
desc:
'Limit by owned by authenticated user'
optional
:starred
,
type:
Boolean
,
default:
false
,
desc:
'Limit by starred status'
optional
:starred
,
type:
Boolean
,
default:
false
,
desc:
'Limit by starred status'
optional
:with_issues_enabled
,
type:
Boolean
,
default:
false
,
desc:
'Limit by enabled issues feature'
optional
:with_merge_requests_enabled
,
type:
Boolean
,
default:
false
,
desc:
'Limit by enabled merge requests feature'
use
:pagination
use
:pagination
use
:with_custom_attributes
use
:with_custom_attributes
...
...
spec/features/groups/empty_states_spec.rb
View file @
352e3222
...
@@ -59,6 +59,18 @@ feature 'Group empty states' do
...
@@ -59,6 +59,18 @@ feature 'Group empty states' do
end
end
end
end
shared_examples
"no projects"
do
it
'displays an empty state'
do
expect
(
page
).
to
have_selector
(
'.empty-state'
)
end
it
"does not show a new
#{
issuable_name
}
button"
do
within
'.empty-state'
do
expect
(
page
).
not_to
have_link
(
"create
#{
issuable_name
}
"
)
end
end
end
context
'group without a project'
do
context
'group without a project'
do
context
'group has a subgroup'
,
:nested_groups
do
context
'group has a subgroup'
,
:nested_groups
do
let
(
:subgroup
)
{
create
(
:group
,
parent:
group
)
}
let
(
:subgroup
)
{
create
(
:group
,
parent:
group
)
}
...
@@ -92,16 +104,18 @@ feature 'Group empty states' do
...
@@ -92,16 +104,18 @@ feature 'Group empty states' do
visit
path
visit
path
end
end
it
'displays an empty state'
do
it_behaves_like
"no projects"
expect
(
page
).
to
have_selector
(
'.empty-state'
)
end
it
"shows a new
#{
issuable_name
}
button"
do
within
'.empty-state'
do
expect
(
page
).
not_to
have_link
(
"create
#{
issuable_name
}
"
)
end
end
end
end
context
'group has only a project with issues disabled'
do
let
(
:project_with_issues_disabled
)
{
create
(
:empty_project
,
:issues_disabled
,
group:
group
)
}
before
do
visit
path
end
end
it_behaves_like
"no projects"
end
end
end
end
end
end
...
...
spec/features/groups/issues_spec.rb
View file @
352e3222
...
@@ -5,6 +5,7 @@ feature 'Group issues page' do
...
@@ -5,6 +5,7 @@ feature 'Group issues page' do
let
(
:group
)
{
create
(
:group
)
}
let
(
:group
)
{
create
(
:group
)
}
let
(
:project
)
{
create
(
:project
,
:public
,
group:
group
)}
let
(
:project
)
{
create
(
:project
,
:public
,
group:
group
)}
let
(
:project_with_issues_disabled
)
{
create
(
:project
,
:issues_disabled
,
group:
group
)
}
let
(
:path
)
{
issues_group_path
(
group
)
}
let
(
:path
)
{
issues_group_path
(
group
)
}
context
'with shared examples'
do
context
'with shared examples'
do
...
@@ -76,4 +77,25 @@ feature 'Group issues page' do
...
@@ -76,4 +77,25 @@ feature 'Group issues page' do
end
end
end
end
end
end
context
'projects with issues disabled'
do
describe
'issue dropdown'
do
let
(
:user_in_group
)
{
create
(
:group_member
,
:master
,
user:
create
(
:user
),
group:
group
).
user
}
before
do
[
project
,
project_with_issues_disabled
].
each
{
|
project
|
project
.
add_master
(
user_in_group
)
}
sign_in
(
user_in_group
)
visit
issues_group_path
(
group
)
end
it
'shows projects only with issues feature enabled'
,
:js
do
find
(
'.new-project-item-link'
).
click
page
.
within
(
'.select2-results'
)
do
expect
(
page
).
to
have_content
(
project
.
full_name
)
expect
(
page
).
not_to
have_content
(
project_with_issues_disabled
.
full_name
)
end
end
end
end
end
end
spec/features/groups/merge_requests_spec.rb
View file @
352e3222
...
@@ -56,4 +56,21 @@ feature 'Group merge requests page' do
...
@@ -56,4 +56,21 @@ feature 'Group merge requests page' do
expect
(
find
(
'#js-dropdown-assignee .filter-dropdown'
)).
not_to
have_content
(
user2
.
name
)
expect
(
find
(
'#js-dropdown-assignee .filter-dropdown'
)).
not_to
have_content
(
user2
.
name
)
end
end
end
end
describe
'new merge request dropdown'
do
let
(
:project_with_merge_requests_disabled
)
{
create
(
:project
,
:merge_requests_disabled
,
group:
group
)
}
before
do
visit
path
end
it
'shows projects only with merge requests feature enabled'
,
:js
do
find
(
'.new-project-item-link'
).
click
page
.
within
(
'.select2-results'
)
do
expect
(
page
).
to
have_content
(
project
.
name_with_namespace
)
expect
(
page
).
not_to
have_content
(
project_with_merge_requests_disabled
.
name_with_namespace
)
end
end
end
end
end
spec/javascripts/api_spec.js
View file @
352e3222
...
@@ -242,7 +242,7 @@ describe('Api', () => {
...
@@ -242,7 +242,7 @@ describe('Api', () => {
},
},
]);
]);
Api
.
groupProjects
(
groupId
,
query
,
response
=>
{
Api
.
groupProjects
(
groupId
,
query
,
{},
response
=>
{
expect
(
response
.
length
).
toBe
(
1
);
expect
(
response
.
length
).
toBe
(
1
);
expect
(
response
[
0
].
name
).
toBe
(
'
test
'
);
expect
(
response
[
0
].
name
).
toBe
(
'
test
'
);
done
();
done
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment