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
17b43670
Commit
17b43670
authored
Oct 26, 2017
by
Sean McGivern
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "Merge branch '36670-remove-edit-form' into 'master'"
This reverts commit
915e35a2
, reversing changes made to
9533786f
.
parent
f913f7a1
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
246 additions
and
28 deletions
+246
-28
issues_controller.rb
app/controllers/projects/issues_controller.rb
+9
-1
edit.html.haml
app/views/projects/issues/edit.html.haml
+7
-0
39441-bring-edit-form-back.yml
changelogs/unreleased/39441-bring-edit-form-back.yml
+5
-0
issues_controller_spec.rb
spec/controllers/projects/issues_controller_spec.rb
+23
-0
form_spec.rb
spec/features/issues/form_spec.rb
+44
-5
issues_spec.rb
spec/features/issues_spec.rb
+101
-7
internal_access_spec.rb
spec/features/security/project/internal_access_spec.rb
+15
-0
private_access_spec.rb
spec/features/security/project/private_access_spec.rb
+15
-0
public_access_spec.rb
spec/features/security/project/public_access_spec.rb
+15
-0
update_invalid_issuable.rb
spec/support/update_invalid_issuable.rb
+12
-15
No files found.
app/controllers/projects/issues_controller.rb
View file @
17b43670
...
...
@@ -16,7 +16,7 @@ class Projects::IssuesController < Projects::ApplicationController
before_action
:authorize_create_issue!
,
only:
[
:new
,
:create
]
# Allow modify issue
before_action
:authorize_update_issue!
,
only:
[
:update
,
:move
]
before_action
:authorize_update_issue!
,
only:
[
:
edit
,
:
update
,
:move
]
# Allow create a new branch and empty WIP merge request from current issue
before_action
:authorize_create_merge_request!
,
only:
[
:create_merge_request
]
...
...
@@ -63,6 +63,10 @@ class Projects::IssuesController < Projects::ApplicationController
respond_with
(
@issue
)
end
def
edit
respond_with
(
@issue
)
end
def
show
@noteable
=
@issue
@note
=
@project
.
notes
.
new
(
noteable:
@issue
)
...
...
@@ -122,6 +126,10 @@ class Projects::IssuesController < Projects::ApplicationController
@issue
=
Issues
::
UpdateService
.
new
(
project
,
current_user
,
update_params
).
execute
(
issue
)
respond_to
do
|
format
|
format
.
html
do
recaptcha_check_with_fallback
{
render
:edit
}
end
format
.
json
do
render_issue_json
end
...
...
app/views/projects/issues/edit.html.haml
0 → 100644
View file @
17b43670
-
page_title
"Edit"
,
"
#{
@issue
.
title
}
(
#{
@issue
.
to_reference
}
)"
,
"Issues"
%h3
.page-title
Edit Issue ##{@issue.iid}
%hr
=
render
"form"
changelogs/unreleased/39441-bring-edit-form-back.yml
0 → 100644
View file @
17b43670
---
title
:
Fix editing issue description in mobile view
merge_request
:
author
:
type
:
fixed
spec/controllers/projects/issues_controller_spec.rb
View file @
17b43670
...
...
@@ -557,6 +557,29 @@ describe Projects::IssuesController do
end
end
end
describe
'GET #edit'
do
it_behaves_like
'restricted action'
,
success:
200
def
go
(
id
:)
get
:edit
,
namespace_id:
project
.
namespace
.
to_param
,
project_id:
project
,
id:
id
end
end
describe
'PUT #update'
do
it_behaves_like
'restricted action'
,
success:
302
def
go
(
id
:)
put
:update
,
namespace_id:
project
.
namespace
.
to_param
,
project_id:
project
,
id:
id
,
issue:
{
title:
'New title'
}
end
end
end
describe
'POST #create'
do
...
...
spec/features/issues/form_spec.rb
View file @
17b43670
...
...
@@ -218,15 +218,54 @@ describe 'New/edit issue', :js do
context
'edit issue'
do
before
do
visit
project_issue_path
(
project
,
issue
)
page
.
within
(
'.content .issuable-actions'
)
do
click_on
'Edit'
visit
edit_project_issue_path
(
project
,
issue
)
end
it
'allows user to update issue'
do
expect
(
find
(
'input[name="issue[assignee_ids][]"]'
,
visible:
false
).
value
).
to
match
(
user
.
id
.
to_s
)
expect
(
find
(
'input[name="issue[milestone_id]"]'
,
visible:
false
).
value
).
to
match
(
milestone
.
id
.
to_s
)
expect
(
find
(
'a'
,
text:
'Assign to me'
,
visible:
false
)).
not_to
be_visible
page
.
within
'.js-user-search'
do
expect
(
page
).
to
have_content
user
.
name
end
page
.
within
'.js-milestone-select'
do
expect
(
page
).
to
have_content
milestone
.
title
end
click_button
'Labels'
page
.
within
'.dropdown-menu-labels'
do
click_link
label
.
title
click_link
label2
.
title
end
page
.
within
'.js-label-select'
do
expect
(
page
).
to
have_content
label
.
title
end
expect
(
page
.
all
(
'input[name="issue[label_ids][]"]'
,
visible:
false
)[
1
].
value
).
to
match
(
label
.
id
.
to_s
)
expect
(
page
.
all
(
'input[name="issue[label_ids][]"]'
,
visible:
false
)[
2
].
value
).
to
match
(
label2
.
id
.
to_s
)
click_button
'Save changes'
page
.
within
'.issuable-sidebar'
do
page
.
within
'.assignee'
do
expect
(
page
).
to
have_content
user
.
name
end
page
.
within
'.milestone'
do
expect
(
page
).
to
have_content
milestone
.
title
end
page
.
within
'.labels'
do
expect
(
page
).
to
have_content
label
.
title
expect
(
page
).
to
have_content
label2
.
title
end
end
end
it
'description has autocomplete'
do
find
_field
(
'issue-
description'
).
native
.
send_keys
(
''
)
fill_in
'issue
-
description'
,
with:
'@'
find
(
'#issue_
description'
).
native
.
send_keys
(
''
)
fill_in
'issue
_
description'
,
with:
'@'
expect
(
page
).
to
have_selector
(
'.atwho-view'
)
end
...
...
spec/features/issues_spec.rb
View file @
17b43670
require
'spec_helper'
describe
'Issues'
,
:js
do
describe
'Issues'
do
include
DropzoneHelper
include
IssueHelpers
include
SortingHelper
...
...
@@ -24,15 +24,109 @@ describe 'Issues', :js do
end
before
do
visit
project_issue_path
(
project
,
issue
)
page
.
within
(
'.content .issuable-actions'
)
do
find
(
'.issuable-edit'
).
click
end
find
(
'.issue-details .content-block .js-zen-enter'
).
click
visit
edit_project_issue_path
(
project
,
issue
)
find
(
'.js-zen-enter'
).
click
end
it
'opens new issue popup'
do
expect
(
page
).
to
have_content
(
issue
.
description
)
expect
(
page
).
to
have_content
(
"Issue #
#{
issue
.
iid
}
"
)
end
end
describe
'Editing issue assignee'
do
let!
(
:issue
)
do
create
(
:issue
,
author:
user
,
assignees:
[
user
],
project:
project
)
end
it
'allows user to select unassigned'
,
:js
do
visit
edit_project_issue_path
(
project
,
issue
)
expect
(
page
).
to
have_content
"Assignee
#{
user
.
name
}
"
first
(
'.js-user-search'
).
click
click_link
'Unassigned'
click_button
'Save changes'
page
.
within
(
'.assignee'
)
do
expect
(
page
).
to
have_content
'No assignee - assign yourself'
end
expect
(
issue
.
reload
.
assignees
).
to
be_empty
end
end
describe
'due date'
,
:js
do
context
'on new form'
do
before
do
visit
new_project_issue_path
(
project
)
end
it
'saves with due date'
do
date
=
Date
.
today
.
at_beginning_of_month
fill_in
'issue_title'
,
with:
'bug 345'
fill_in
'issue_description'
,
with:
'bug description'
find
(
'#issuable-due-date'
).
click
page
.
within
'.pika-single'
do
click_button
date
.
day
end
expect
(
find
(
'#issuable-due-date'
).
value
).
to
eq
date
.
to_s
click_button
'Submit issue'
page
.
within
'.issuable-sidebar'
do
expect
(
page
).
to
have_content
date
.
to_s
(
:medium
)
end
end
end
context
'on edit form'
do
let
(
:issue
)
{
create
(
:issue
,
author:
user
,
project:
project
,
due_date:
Date
.
today
.
at_beginning_of_month
.
to_s
)
}
before
do
visit
edit_project_issue_path
(
project
,
issue
)
end
it
'saves with due date'
do
date
=
Date
.
today
.
at_beginning_of_month
expect
(
find
(
'#issuable-due-date'
).
value
).
to
eq
date
.
to_s
date
=
date
.
tomorrow
fill_in
'issue_title'
,
with:
'bug 345'
fill_in
'issue_description'
,
with:
'bug description'
find
(
'#issuable-due-date'
).
click
page
.
within
'.pika-single'
do
click_button
date
.
day
end
expect
(
find
(
'#issuable-due-date'
).
value
).
to
eq
date
.
to_s
click_button
'Save changes'
page
.
within
'.issuable-sidebar'
do
expect
(
page
).
to
have_content
date
.
to_s
(
:medium
)
end
end
it
'warns about version conflict'
do
issue
.
update
(
title:
"New title"
)
fill_in
'issue_title'
,
with:
'bug 345'
fill_in
'issue_description'
,
with:
'bug description'
click_button
'Save changes'
expect
(
page
).
to
have_content
'Someone edited the issue the same time you did'
end
end
end
...
...
spec/features/security/project/internal_access_spec.rb
View file @
17b43670
...
...
@@ -181,6 +181,21 @@ describe "Internal Project Access" do
it
{
is_expected
.
to
be_denied_for
(
:visitor
)
}
end
describe
"GET /:project_path/issues/:id/edit"
do
let
(
:issue
)
{
create
(
:issue
,
project:
project
)
}
subject
{
edit_project_issue_path
(
project
,
issue
)
}
it
{
is_expected
.
to
be_allowed_for
(
:admin
)
}
it
{
is_expected
.
to
be_allowed_for
(
:owner
).
of
(
project
)
}
it
{
is_expected
.
to
be_allowed_for
(
:master
).
of
(
project
)
}
it
{
is_expected
.
to
be_allowed_for
(
:developer
).
of
(
project
)
}
it
{
is_expected
.
to
be_allowed_for
(
:reporter
).
of
(
project
)
}
it
{
is_expected
.
to
be_denied_for
(
:guest
).
of
(
project
)
}
it
{
is_expected
.
to
be_denied_for
(
:user
)
}
it
{
is_expected
.
to
be_denied_for
(
:external
)
}
it
{
is_expected
.
to
be_denied_for
(
:visitor
)
}
end
describe
"GET /:project_path/snippets"
do
subject
{
project_snippets_path
(
project
)
}
...
...
spec/features/security/project/private_access_spec.rb
View file @
17b43670
...
...
@@ -181,6 +181,21 @@ describe "Private Project Access" do
it
{
is_expected
.
to
be_denied_for
(
:visitor
)
}
end
describe
"GET /:project_path/issues/:id/edit"
do
let
(
:issue
)
{
create
(
:issue
,
project:
project
)
}
subject
{
edit_project_issue_path
(
project
,
issue
)
}
it
{
is_expected
.
to
be_allowed_for
(
:admin
)
}
it
{
is_expected
.
to
be_allowed_for
(
:owner
).
of
(
project
)
}
it
{
is_expected
.
to
be_allowed_for
(
:master
).
of
(
project
)
}
it
{
is_expected
.
to
be_allowed_for
(
:developer
).
of
(
project
)
}
it
{
is_expected
.
to
be_allowed_for
(
:reporter
).
of
(
project
)
}
it
{
is_expected
.
to
be_denied_for
(
:guest
).
of
(
project
)
}
it
{
is_expected
.
to
be_denied_for
(
:user
)
}
it
{
is_expected
.
to
be_denied_for
(
:external
)
}
it
{
is_expected
.
to
be_denied_for
(
:visitor
)
}
end
describe
"GET /:project_path/snippets"
do
subject
{
project_snippets_path
(
project
)
}
...
...
spec/features/security/project/public_access_spec.rb
View file @
17b43670
...
...
@@ -394,6 +394,21 @@ describe "Public Project Access" do
it
{
is_expected
.
to
be_allowed_for
(
:visitor
)
}
end
describe
"GET /:project_path/issues/:id/edit"
do
let
(
:issue
)
{
create
(
:issue
,
project:
project
)
}
subject
{
edit_project_issue_path
(
project
,
issue
)
}
it
{
is_expected
.
to
be_allowed_for
(
:admin
)
}
it
{
is_expected
.
to
be_allowed_for
(
:owner
).
of
(
project
)
}
it
{
is_expected
.
to
be_allowed_for
(
:master
).
of
(
project
)
}
it
{
is_expected
.
to
be_allowed_for
(
:developer
).
of
(
project
)
}
it
{
is_expected
.
to
be_allowed_for
(
:reporter
).
of
(
project
)
}
it
{
is_expected
.
to
be_denied_for
(
:guest
).
of
(
project
)
}
it
{
is_expected
.
to
be_denied_for
(
:user
)
}
it
{
is_expected
.
to
be_denied_for
(
:external
)
}
it
{
is_expected
.
to
be_denied_for
(
:visitor
)
}
end
describe
"GET /:project_path/snippets"
do
subject
{
project_snippets_path
(
project
)
}
...
...
spec/support/update_invalid_issuable.rb
View file @
17b43670
...
...
@@ -25,13 +25,11 @@ shared_examples 'update invalid issuable' do |klass|
.
and_raise
(
ActiveRecord
::
StaleObjectError
.
new
(
issuable
,
:save
))
end
if
klass
==
MergeRequest
it
'renders edit when format is html'
do
put
:update
,
params
it
'renders edit when format is html'
do
put
:update
,
params
expect
(
response
).
to
render_template
(
:edit
)
expect
(
assigns
[
:conflict
]).
to
be_truthy
end
expect
(
response
).
to
render_template
(
:edit
)
expect
(
assigns
[
:conflict
]).
to
be_truthy
end
it
'renders json error message when format is json'
do
...
...
@@ -44,17 +42,16 @@ shared_examples 'update invalid issuable' do |klass|
end
end
if
klass
==
MergeRequest
context
'when updating an invalid issuable'
do
before
do
params
[
:merge_request
][
:title
]
=
""
end
context
'when updating an invalid issuable'
do
before
do
key
=
klass
==
Issue
?
:
issue
:
:merge_request
params
[
key
][
:title
]
=
""
end
it
'renders edit when merge request is invalid'
do
put
:update
,
params
it
'renders edit when merge request is invalid'
do
put
:update
,
params
expect
(
response
).
to
render_template
(
:edit
)
end
expect
(
response
).
to
render_template
(
:edit
)
end
end
end
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