Commit 602c74bf authored by Nick Thomas's avatar Nick Thomas

Merge branch 'ld-return-note-when-params-blank' into 'master'

Prevent Notes::UpdateService from updating a note when no params passed

See merge request gitlab-org/gitlab!23936
parents b92d163a 3ab04d57
......@@ -3,7 +3,7 @@
module Notes
class UpdateService < BaseService
def execute(note)
return note unless note.editable?
return note unless note.editable? && params.present?
old_mentioned_users = note.mentioned_users(current_user).to_a
......
......@@ -30,6 +30,12 @@ describe Notes::UpdateService do
@note.reload
end
it 'does not update the note when params is blank' do
Timecop.freeze(1.day.from_now) do
expect { update_note({}) }.not_to change { note.reload.updated_at }
end
end
context 'suggestions' do
it 'refreshes note suggestions' do
markdown = <<-MARKDOWN.strip_heredoc
......
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