Commit 3ab04d57 authored by Luke Duncalfe's avatar Luke Duncalfe

Notes::UpdateService return note if no params

Previously the service would continue to update the note when there
were no changes passed to the service.
parent a15388de
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
module Notes module Notes
class UpdateService < BaseService class UpdateService < BaseService
def execute(note) 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 old_mentioned_users = note.mentioned_users(current_user).to_a
......
...@@ -30,6 +30,12 @@ describe Notes::UpdateService do ...@@ -30,6 +30,12 @@ describe Notes::UpdateService do
@note.reload @note.reload
end 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 context 'suggestions' do
it 'refreshes note suggestions' do it 'refreshes note suggestions' do
markdown = <<-MARKDOWN.strip_heredoc 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