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
8a570944
Commit
8a570944
authored
Apr 20, 2017
by
Stan Hu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix Error 500 when referencing issue with project in pending delete
Closes #31215
parent
a9da3743
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
1 deletion
+14
-1
app/models/issue.rb
app/models/issue.rb
+1
-1
spec/lib/banzai/redactor_spec.rb
spec/lib/banzai/redactor_spec.rb
+13
-0
No files found.
app/models/issue.rb
View file @
8a570944
...
@@ -199,7 +199,7 @@ class Issue < ActiveRecord::Base
...
@@ -199,7 +199,7 @@ class Issue < ActiveRecord::Base
# Returns `true` if the current issue can be viewed by either a logged in User
# Returns `true` if the current issue can be viewed by either a logged in User
# or an anonymous user.
# or an anonymous user.
def
visible_to_user?
(
user
=
nil
)
def
visible_to_user?
(
user
=
nil
)
return
false
unless
project
.
feature_available?
(
:issues
,
user
)
return
false
unless
project
&&
project
.
feature_available?
(
:issues
,
user
)
user
?
readable_by?
(
user
)
:
publicly_visible?
user
?
readable_by?
(
user
)
:
publicly_visible?
end
end
...
...
spec/lib/banzai/redactor_spec.rb
View file @
8a570944
...
@@ -42,6 +42,19 @@ describe Banzai::Redactor do
...
@@ -42,6 +42,19 @@ describe Banzai::Redactor do
end
end
end
end
context
'when project is in pending delete'
do
it
'redacts an issue attached'
do
project
.
pending_delete
=
true
project
.
save
issue
=
create
(
:issue
,
project:
project
)
redactor
=
described_class
.
new
(
project
,
user
)
doc
=
Nokogiri
::
HTML
.
fragment
(
"<a class='gfm' data-reference-type='issue' data-project=
\"
#{
project
.
id
}
\"
data-issue=
\"
#{
issue
.
id
}
\"
>foo</a>"
)
redactor
.
redact
([
doc
])
expect
(
doc
.
to_html
).
to
eq
(
'foo'
)
end
end
context
'when reference visible to user'
do
context
'when reference visible to user'
do
it
'does not redact an array of documents'
do
it
'does not redact an array of documents'
do
doc1_html
=
'<a class="gfm" data-reference-type="issue">foo</a>'
doc1_html
=
'<a class="gfm" data-reference-type="issue">foo</a>'
...
...
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