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
Jérome Perrin
gitlab-ce
Commits
d4bc1255
Commit
d4bc1255
authored
Oct 20, 2014
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #7856 from cirosantilli/error-to-msg
Fix missing flash on file edit error from web UI.
parents
d7ec8451
2d235221
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
42 additions
and
11 deletions
+42
-11
app/controllers/projects/blob_controller.rb
app/controllers/projects/blob_controller.rb
+1
-1
app/controllers/projects/edit_tree_controller.rb
app/controllers/projects/edit_tree_controller.rb
+1
-1
app/services/files/base_service.rb
app/services/files/base_service.rb
+0
-6
features/project/source/browse_files.feature
features/project/source/browse_files.feature
+20
-0
features/steps/project/source/browse_files.rb
features/steps/project/source/browse_files.rb
+8
-0
features/steps/shared/paths.rb
features/steps/shared/paths.rb
+9
-0
lib/api/files.rb
lib/api/files.rb
+3
-3
No files found.
app/controllers/projects/blob_controller.rb
View file @
d4bc1255
...
@@ -20,7 +20,7 @@ class Projects::BlobController < Projects::ApplicationController
...
@@ -20,7 +20,7 @@ class Projects::BlobController < Projects::ApplicationController
flash
[
:notice
]
=
"Your changes have been successfully committed"
flash
[
:notice
]
=
"Your changes have been successfully committed"
redirect_to
project_tree_path
(
@project
,
@ref
)
redirect_to
project_tree_path
(
@project
,
@ref
)
else
else
flash
[
:alert
]
=
result
[
:
error
]
flash
[
:alert
]
=
result
[
:
message
]
render
:show
render
:show
end
end
end
end
...
...
app/controllers/projects/edit_tree_controller.rb
View file @
d4bc1255
...
@@ -22,7 +22,7 @@ class Projects::EditTreeController < Projects::BaseTreeController
...
@@ -22,7 +22,7 @@ class Projects::EditTreeController < Projects::BaseTreeController
redirect_to
after_edit_path
redirect_to
after_edit_path
else
else
flash
[
:alert
]
=
result
[
:
error
]
flash
[
:alert
]
=
result
[
:
message
]
render
:show
render
:show
end
end
end
end
...
...
app/services/files/base_service.rb
View file @
d4bc1255
...
@@ -10,12 +10,6 @@ module Files
...
@@ -10,12 +10,6 @@ module Files
private
private
def
success
out
=
super
()
out
[
:error
]
=
''
out
end
def
repository
def
repository
project
.
repository
project
.
repository
end
end
...
...
features/project/source/browse_files.feature
View file @
d4bc1255
...
@@ -34,6 +34,16 @@ Feature: Project Source Browse Files
...
@@ -34,6 +34,16 @@ Feature: Project Source Browse Files
Then
I am redirected to the new file
Then
I am redirected to the new file
And
I should see its new content
And
I should see its new content
@javascript
Scenario
:
If I enter an illegal file name I see an error message
Given
I click on
"new file"
link in repo
And
I fill the new file name with an illegal name
And
I edit code
And
I fill the commit message
And
I click on
"Commit changes"
Then
I am on the new file page
And
I see a commit error message
@javascript
@javascript
Scenario
:
I
can edit file
Scenario
:
I
can edit file
Given
I click on
".gitignore"
file in repo
Given
I click on
".gitignore"
file in repo
...
@@ -50,6 +60,16 @@ Feature: Project Source Browse Files
...
@@ -50,6 +60,16 @@ Feature: Project Source Browse Files
Then
I am redirected to the
".gitignore"
Then
I am redirected to the
".gitignore"
And
I should see its new content
And
I should see its new content
@javascript
@wip
Scenario
:
If I don't change the content of the file I see an error message
Given
I click on
".gitignore"
file in repo
And
I click button
"edit"
And
I fill the commit message
And
I click on
"Commit changes"
# Test fails because carriage returns are added to the file.
Then
I am on the
".gitignore"
edit file page
And
I see a commit error message
@javascript
@javascript
Scenario
:
I
can see editing preview
Scenario
:
I
can see editing preview
Given
I click on
".gitignore"
file in repo
Given
I click on
".gitignore"
file in repo
...
...
features/steps/project/source/browse_files.rb
View file @
d4bc1255
...
@@ -61,6 +61,10 @@ class Spinach::Features::ProjectSourceBrowseFiles < Spinach::FeatureSteps
...
@@ -61,6 +61,10 @@ class Spinach::Features::ProjectSourceBrowseFiles < Spinach::FeatureSteps
fill_in
:file_name
,
with:
new_file_name
fill_in
:file_name
,
with:
new_file_name
end
end
step
'I fill the new file name with an illegal name'
do
fill_in
:file_name
,
with:
'.git'
end
step
'I fill the commit message'
do
step
'I fill the commit message'
do
fill_in
:commit_message
,
with:
'Not yet a commit message.'
fill_in
:commit_message
,
with:
'Not yet a commit message.'
end
end
...
@@ -151,6 +155,10 @@ class Spinach::Features::ProjectSourceBrowseFiles < Spinach::FeatureSteps
...
@@ -151,6 +155,10 @@ class Spinach::Features::ProjectSourceBrowseFiles < Spinach::FeatureSteps
expect
(
page
).
not_to
have_link
(
'permalink'
)
expect
(
page
).
not_to
have_link
(
'permalink'
)
end
end
step
'I see a commit error message'
do
expect
(
page
).
to
have_content
(
'Your changes could not be committed'
)
end
private
private
def
set_new_content
def
set_new_content
...
...
features/steps/shared/paths.rb
View file @
d4bc1255
...
@@ -265,6 +265,15 @@ module SharedPaths
...
@@ -265,6 +265,15 @@ module SharedPaths
visit
project_blob_path
(
@project
,
File
.
join
(
root_ref
,
'.gitignore'
))
visit
project_blob_path
(
@project
,
File
.
join
(
root_ref
,
'.gitignore'
))
end
end
step
'I am on the new file page'
do
current_path
.
should
eq
(
project_new_tree_path
(
@project
,
root_ref
))
end
step
'I am on the ".gitignore" edit file page'
do
current_path
.
should
eq
(
project_edit_tree_path
(
@project
,
File
.
join
(
root_ref
,
'.gitignore'
)))
end
step
'I visit project source page for "6d39438"'
do
step
'I visit project source page for "6d39438"'
do
visit
project_tree_path
(
@project
,
"6d39438"
)
visit
project_tree_path
(
@project
,
"6d39438"
)
end
end
...
...
lib/api/files.rb
View file @
d4bc1255
...
@@ -85,7 +85,7 @@ module API
...
@@ -85,7 +85,7 @@ module API
branch_name:
branch_name
branch_name:
branch_name
}
}
else
else
render_api_error!
(
result
[
:
error
],
400
)
render_api_error!
(
result
[
:
message
],
400
)
end
end
end
end
...
@@ -117,7 +117,7 @@ module API
...
@@ -117,7 +117,7 @@ module API
branch_name:
branch_name
branch_name:
branch_name
}
}
else
else
render_api_error!
(
result
[
:
error
],
400
)
render_api_error!
(
result
[
:
message
],
400
)
end
end
end
end
...
@@ -149,7 +149,7 @@ module API
...
@@ -149,7 +149,7 @@ module API
branch_name:
branch_name
branch_name:
branch_name
}
}
else
else
render_api_error!
(
result
[
:
error
],
400
)
render_api_error!
(
result
[
:
message
],
400
)
end
end
end
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