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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
5a89bcc4
Commit
5a89bcc4
authored
Feb 19, 2019
by
Oswaldo Ferreira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Avoid 500's when commit is not reachable
parent
d9a761ed
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
1 deletion
+14
-1
app/models/diff_note.rb
app/models/diff_note.rb
+1
-1
changelogs/unreleased/osw-avoid-500-on-suggestions-check.yml
changelogs/unreleased/osw-avoid-500-on-suggestions-check.yml
+5
-0
spec/models/diff_note_spec.rb
spec/models/diff_note_spec.rb
+8
-0
No files found.
app/models/diff_note.rb
View file @
5a89bcc4
...
@@ -77,7 +77,7 @@ class DiffNote < Note
...
@@ -77,7 +77,7 @@ class DiffNote < Note
end
end
def
supports_suggestion?
def
supports_suggestion?
return
false
unless
noteable
.
supports_suggestion?
&&
on_text?
return
false
unless
noteable
&
.
supports_suggestion?
&&
on_text?
# We don't want to trigger side-effects of `diff_file` call.
# We don't want to trigger side-effects of `diff_file` call.
return
false
unless
file
=
latest_diff_file
return
false
unless
file
=
latest_diff_file
return
false
unless
line
=
file
.
line_for_position
(
self
.
position
)
return
false
unless
line
=
file
.
line_for_position
(
self
.
position
)
...
...
changelogs/unreleased/osw-avoid-500-on-suggestions-check.yml
0 → 100644
View file @
5a89bcc4
---
title
:
Avoid 500 when rendering users ATOM data
merge_request
:
25408
author
:
type
:
fixed
spec/models/diff_note_spec.rb
View file @
5a89bcc4
...
@@ -321,6 +321,14 @@ describe DiffNote do
...
@@ -321,6 +321,14 @@ describe DiffNote do
end
end
describe
'#supports_suggestion?'
do
describe
'#supports_suggestion?'
do
context
'when noteable does not exist'
do
it
'returns false'
do
allow
(
subject
).
to
receive
(
:noteable
)
{
nil
}
expect
(
subject
.
supports_suggestion?
).
to
be
(
false
)
end
end
context
'when noteable does not support suggestions'
do
context
'when noteable does not support suggestions'
do
it
'returns false'
do
it
'returns false'
do
allow
(
subject
.
noteable
).
to
receive
(
:supports_suggestion?
)
{
false
}
allow
(
subject
.
noteable
).
to
receive
(
:supports_suggestion?
)
{
false
}
...
...
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