Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
heptapod
heptapod
Commits
14589ca7f942
Commit
14589ca7
authored
Jun 19, 2015
by
Stan Hu
Browse files
Fix Error 500 when one user attempts to access a personal, internal snippet
Closes #1815
parent
a25454ba7b19
Changes
6
Hide whitespace changes
Inline
Side-by-side
CHANGELOG
View file @
14589ca7
...
...
@@ -9,6 +9,7 @@
- Update ssl_ciphers in Nginx example to remove DHE settings. This will deny forward secrecy for Android 2.3.7, Java 6 and OpenSSL 0.9.8
v 7.12.0 (unreleased)
- Fix Error 500 when one user attempts to access a personal, internal snippet (Stan Hu)
- Fix post-receive errors on a push when an external issue tracker is configured (Stan Hu)
- Update oauth button logos for Twitter and Google to recommended assets
- Fix hooks for web based events with external issue references (Daniel Gerhardt)
...
...
app/models/ability.rb
View file @
14589ca7
...
...
@@ -263,7 +263,7 @@
:"modify_
#{
name
}
"
,
]
else
if
subject
.
respond_to?
(
:project
)
if
subject
.
respond_to?
(
:project
)
&&
subject
.
project
project_abilities
(
user
,
subject
.
project
)
else
[]
...
...
features/snippets/snippets.feature
View file @
14589ca7
...
...
@@ -25,4 +25,15 @@
Scenario
:
I
destroy
"Personal snippet one"
Given
I visit snippet page
"Personal snippet one"
And
I click link
"Destroy"
Then
I should not see
"Personal snippet one"
in snippets
\ No newline at end of file
Then
I should not see
"Personal snippet one"
in snippets
Scenario
:
I
create new internal snippet
Given
I logout directly
And
I sign in as an admin
Then
I visit new snippet page
And
I submit new internal snippet
Then
I visit snippet page
"Internal personal snippet one"
And
I logout directly
Then
I sign in as a user
Given
I visit new snippet page
Then
I visit snippet page
"Internal personal snippet one"
features/steps/shared/authentication.rb
View file @
14589ca7
...
...
@@ -28,6 +28,10 @@
logout
end
step
"I logout directly"
do
logout_direct
end
def
current_user
@user
||
User
.
first
end
...
...
features/steps/snippets/snippets.rb
View file @
14589ca7
...
...
@@ -31,6 +31,18 @@
click_button
"Create snippet"
end
step
'I submit new internal snippet'
do
fill_in
"personal_snippet_title"
,
:with
=>
"Internal personal snippet one"
fill_in
"personal_snippet_file_name"
,
:with
=>
"my_snippet.rb"
choose
'personal_snippet_visibility_level_10'
page
.
within
(
'.file-editor'
)
do
find
(
:xpath
,
"//input[@id='personal_snippet_content']"
).
set
'Content of internal snippet'
end
click_button
"Create snippet"
end
step
'I should see snippet "Personal snippet three"'
do
expect
(
page
).
to
have_content
"Personal snippet three"
expect
(
page
).
to
have_content
"Content of snippet three"
...
...
@@ -58,6 +70,10 @@
visit
snippet_path
(
snippet
)
end
step
'I visit snippet page "Internal personal snippet one"'
do
visit
snippet_path
(
internal_snippet
)
end
def
snippet
@snippet
||=
PersonalSnippet
.
find_by!
(
title:
"Personal snippet one"
)
end
...
...
@@ -61,4 +77,8 @@
def
snippet
@snippet
||=
PersonalSnippet
.
find_by!
(
title:
"Personal snippet one"
)
end
def
internal_snippet
@snippet
||=
PersonalSnippet
.
find_by!
(
title:
"Internal personal snippet one"
)
end
end
spec/support/login_helpers.rb
View file @
14589ca7
...
...
@@ -39,4 +39,9 @@
def
logout
find
(
:css
,
".fa.fa-sign-out"
).
click
end
# Logout without JavaScript driver
def
logout_direct
page
.
driver
.
submit
:delete
,
'/users/sign_out'
,
{}
end
end
Write
Preview
Supports
Markdown
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