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
b2e990f4
Commit
b2e990f4
authored
Dec 17, 2019
by
nmilojevic1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix MR review comments
- Add some new lines - Remove translation for error message
parent
8900ddf3
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
7 additions
and
8 deletions
+7
-8
app/models/diff_note.rb
app/models/diff_note.rb
+2
-2
locale/gitlab.pot
locale/gitlab.pot
+0
-6
spec/models/diff_note_spec.rb
spec/models/diff_note_spec.rb
+1
-0
spec/support/shared_examples/models/diff_note_after_commit_shared_examples.rb
...examples/models/diff_note_after_commit_shared_examples.rb
+4
-0
No files found.
app/models/diff_note.rb
View file @
b2e990f4
...
...
@@ -26,8 +26,8 @@ class DiffNote < Note
NoteDiffFileCreationError
=
Class
.
new
(
StandardError
)
DIFF_LINE_NOT_FOUND_MESSAGE
=
_
(
"Failed to find diff line for: %{file_path}, old_line: %{old_line}, new_line: %{new_line}"
)
DIFF_FILE_NOT_FOUND_MESSAGE
=
_
(
"Failed to find diff file"
)
DIFF_LINE_NOT_FOUND_MESSAGE
=
"Failed to find diff line for: %{file_path}, old_line: %{old_line}, new_line: %{new_line}"
DIFF_FILE_NOT_FOUND_MESSAGE
=
"Failed to find diff file"
after_commit
:create_diff_file
,
on: :create
...
...
locale/gitlab.pot
View file @
b2e990f4
...
...
@@ -7373,12 +7373,6 @@ msgstr ""
msgid "Failed to enqueue the rebase operation, possibly due to a long-lived transaction. Try again later."
msgstr ""
msgid "Failed to find diff file"
msgstr ""
msgid "Failed to find diff line for: %{file_path}, old_line: %{old_line}, new_line: %{new_line}"
msgstr ""
msgid "Failed to get ref."
msgstr ""
...
...
spec/models/diff_note_spec.rb
View file @
b2e990f4
...
...
@@ -207,6 +207,7 @@ describe DiffNote do
it
'does not create diff note file if it is a reply'
do
diff_note
=
create
(
:diff_note_on_merge_request
,
project:
project
,
noteable:
merge_request
)
expect
{
create
(
:diff_note_on_merge_request
,
noteable:
merge_request
,
in_reply_to:
diff_note
)
}
.
not_to
change
(
NoteDiffFile
,
:count
)
end
...
...
spec/support/shared_examples/models/diff_note_after_commit_shared_examples.rb
View file @
b2e990f4
...
...
@@ -9,6 +9,7 @@ shared_examples 'a valid diff note with after commit callback' do
context
'when diff_line is not found'
do
it
'raises an error'
do
allow
(
diff_file_from_repository
).
to
receive
(
:line_for_position
).
with
(
position
).
and_return
(
nil
)
expect
{
subject
.
save
}.
to
raise_error
(
::
DiffNote
::
NoteDiffFileCreationError
,
"Failed to find diff line for:
#{
diff_file_from_repository
.
file_path
}
, "
\
"old_line:
#{
position
.
old_line
}
"
\
...
...
@@ -23,11 +24,13 @@ shared_examples 'a valid diff note with after commit callback' do
it
'fallback to fetch file from repository'
do
expect_any_instance_of
(
::
Gitlab
::
Diff
::
Position
).
to
receive
(
:diff_file
).
with
(
project
.
repository
)
subject
.
save
end
it
'creates a diff note file'
do
subject
.
save
expect
(
subject
.
reload
.
note_diff_file
).
to
be_present
end
end
...
...
@@ -36,6 +39,7 @@ shared_examples 'a valid diff note with after commit callback' do
context
'when diff file is not found in repository'
do
it
'raises an error'
do
allow_any_instance_of
(
::
Gitlab
::
Diff
::
Position
).
to
receive
(
:diff_file
).
with
(
project
.
repository
).
and_return
(
nil
)
expect
{
subject
.
save
}.
to
raise_error
(
::
DiffNote
::
NoteDiffFileCreationError
,
'Failed to find diff file'
)
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