Commit fb7abd87 authored by Sean McGivern's avatar Sean McGivern

Merge branch 'issue_40058' into 'master'

Prevent position update for image diff notes

Closes #40058

See merge request gitlab-org/gitlab-ce!15357
parents acc60818 aefefbf1
...@@ -18,7 +18,8 @@ class DiffNote < Note ...@@ -18,7 +18,8 @@ class DiffNote < Note
validate :positions_complete validate :positions_complete
validate :verify_supported validate :verify_supported
before_validation :set_original_position, :update_position, on: :create before_validation :set_original_position, on: :create
before_validation :update_position, on: :create, if: :on_text?
before_validation :set_line_code before_validation :set_line_code
after_save :keep_around_commits after_save :keep_around_commits
......
---
title: Prevents position update for image diff notes
merge_request:
author:
type: fixed
...@@ -283,6 +283,12 @@ describe DiffNote do ...@@ -283,6 +283,12 @@ describe DiffNote do
expect(diff_line).to be nil expect(diff_line).to be nil
expect(subject).to be_valid expect(subject).to be_valid
end end
it "does not update the position" do
expect(subject).not_to receive(:update_position)
subject.save
end
end end
it "returns true for on_image?" do it "returns true for on_image?" do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment