BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
aea78ded
Commit
aea78ded
authored
Mar 06, 2017
by
Sam Rose
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Redirect to signin when New Issue for not logged in
parent
9ed3db91
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
33 additions
and
7 deletions
+33
-7
issues_controller.rb
app/controllers/projects/issues_controller.rb
+2
-0
index.html.haml
app/views/projects/issues/index.html.haml
+0
-1
show.html.haml
app/views/projects/issues/show.html.haml
+0
-3
_issues.html.haml
app/views/shared/empty_states/_issues.html.haml
+1
-2
issues_controller_spec.rb
spec/controllers/projects/issues_controller_spec.rb
+11
-0
issues_spec.rb
spec/features/issues_spec.rb
+19
-1
No files found.
app/controllers/projects/issues_controller.rb
View file @
aea78ded
...
...
@@ -6,6 +6,8 @@ class Projects::IssuesController < Projects::ApplicationController
include
IssuableCollections
include
SpammableActions
prepend_before_action
:authenticate_user!
,
only:
[
:new
]
before_action
:redirect_to_external_issue_tracker
,
only:
[
:index
,
:new
]
before_action
:module_enabled
before_action
:issue
,
only:
[
:edit
,
:update
,
:show
,
:referenced_merge_requests
,
...
...
app/views/projects/issues/index.html.haml
View file @
aea78ded
...
...
@@ -19,7 +19,6 @@
.nav-controls
=
link_to
params
.
merge
(
rss_url_options
),
class:
'btn append-right-10 has-tooltip'
,
title:
'Subscribe'
do
=
icon
(
'rss'
)
-
if
can?
current_user
,
:create_issue
,
@project
=
link_to
new_namespace_project_issue_path
(
@project
.
namespace
,
@project
,
issue:
{
assignee_id:
issues_finder
.
assignee
.
try
(
:id
),
...
...
app/views/projects/issues/show.html.haml
View file @
aea78ded
...
...
@@ -20,7 +20,6 @@
=
confidential_icon
(
@issue
)
=
issuable_meta
(
@issue
,
@project
,
"Issue"
)
-
if
can?
(
current_user
,
:create_issue
,
@project
)
||
can?
(
current_user
,
:update_issue
,
@issue
)
.issuable-actions
.clearfix.issue-btn-group.dropdown
%button
.btn.btn-default.pull-left.hidden-md.hidden-lg
{
type:
"button"
,
data:
{
toggle:
"dropdown"
}
}
...
...
@@ -28,7 +27,6 @@
=
icon
(
'caret-down'
)
.dropdown-menu.dropdown-menu-align-right.hidden-lg
%ul
-
if
can?
(
current_user
,
:create_issue
,
@project
)
%li
=
link_to
'New issue'
,
new_namespace_project_issue_path
(
@project
.
namespace
,
@project
),
title:
'New issue'
,
id:
'new_issue_link'
-
if
can?
(
current_user
,
:update_issue
,
@issue
)
...
...
@@ -42,7 +40,6 @@
%li
=
link_to
'Submit as spam'
,
mark_as_spam_namespace_project_issue_path
(
@project
.
namespace
,
@project
,
@issue
),
method: :post
,
class:
'btn-spam'
,
title:
'Submit as spam'
-
if
can?
(
current_user
,
:create_issue
,
@project
)
=
link_to
new_namespace_project_issue_path
(
@project
.
namespace
,
@project
),
class:
'hidden-xs hidden-sm btn btn-grouped new-issue-link btn-new btn-inverted'
,
title:
'New issue'
,
id:
'new_issue_link'
do
New issue
-
if
can?
(
current_user
,
:update_issue
,
@issue
)
...
...
app/views/shared/empty_states/_issues.html.haml
View file @
aea78ded
...
...
@@ -17,6 +17,5 @@
-
if
project_select_button
=
render
'shared/new_project_item_select'
,
path:
'issues/new'
,
label:
'New issue'
-
else
%h4
There are no issues to show.
=
link_to
'New issue'
,
button_path
,
class:
'btn btn-new'
,
title:
'New issue'
,
id:
'new_issue_link'
-
else
%h4
.text-center
There are no issues to show.
spec/controllers/projects/issues_controller_spec.rb
View file @
aea78ded
...
...
@@ -87,6 +87,12 @@ describe Projects::IssuesController do
end
describe
'GET #new'
do
it
'redirects to signin if not logged in'
do
get
:new
,
namespace_id:
project
.
namespace
,
project_id:
project
expect
(
response
).
to
redirect_to
(
new_user_session_path
)
end
context
'internal issue tracker'
do
before
do
sign_in
(
user
)
...
...
@@ -112,6 +118,11 @@ describe Projects::IssuesController do
end
context
'external issue tracker'
do
before
do
sign_in
(
user
)
project
.
team
<<
[
user
,
:developer
]
end
it
'redirects to the external issue tracker'
do
external
=
double
(
new_issue_path:
'https://example.com/issues/new'
)
allow
(
project
).
to
receive
(
:external_issue_tracker
).
and_return
(
external
)
...
...
spec/features/issues_spec.rb
View file @
aea78ded
...
...
@@ -6,7 +6,7 @@ describe 'Issues', feature: true do
include
SortingHelper
include
WaitForAjax
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
,
:public
)
}
before
do
login_as
:user
...
...
@@ -565,6 +565,24 @@ describe 'Issues', feature: true do
end
describe
'new issue'
do
context
'by unauthenticated user'
do
before
do
logout
end
it
'redirects to signin then back to new issue after signin'
do
visit
namespace_project_issues_path
(
project
.
namespace
,
project
)
click_link
'New issue'
expect
(
current_path
).
to
eq
new_user_session_path
login_as
:user
expect
(
current_path
).
to
eq
new_namespace_project_issue_path
(
project
.
namespace
,
project
)
end
end
context
'dropzone upload file'
,
js:
true
do
before
do
visit
new_namespace_project_issue_path
(
project
.
namespace
,
project
)
...
...
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