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
21af3855
Commit
21af3855
authored
Nov 19, 2020
by
Kassio Borges
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Avoid exception when validating diff_note support
parent
ab82aee6
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/kassio-diff-note-avoid-exception-when-validating-style.yml
...assio-diff-note-avoid-exception-when-validating-style.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 @
21af3855
...
...
@@ -149,7 +149,7 @@ class DiffNote < Note
end
def
supported?
for_commit?
||
for_design?
||
self
.
noteable
.
has_complete_diff_refs?
for_commit?
||
for_design?
||
self
.
noteable
&
.
has_complete_diff_refs?
end
def
set_line_code
...
...
changelogs/unreleased/kassio-diff-note-avoid-exception-when-validating-style.yml
0 → 100644
View file @
21af3855
---
title
:
Avoid exception when validating diff_note support
merge_request
:
48187
author
:
type
:
fixed
spec/models/diff_note_spec.rb
View file @
21af3855
...
...
@@ -38,6 +38,14 @@ RSpec.describe DiffNote do
it_behaves_like
'a valid diff positionable note'
do
subject
{
build
(
:diff_note_on_commit
,
project:
project
,
commit_id:
commit_id
,
position:
position
)
}
end
it
"is not valid when noteable is empty"
do
note
=
build
(
:diff_note_on_merge_request
,
project:
project
,
noteable:
nil
)
note
.
valid?
expect
(
note
.
errors
[
:noteable
]).
to
include
(
"doesn't support new-style diff notes"
)
end
end
describe
"#position="
do
...
...
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