diff --git a/app/controllers/concerns/issuable_actions.rb b/app/controllers/concerns/issuable_actions.rb index 1c55cd340ec..8ef3b6502df 100644 --- a/app/controllers/concerns/issuable_actions.rb +++ b/app/controllers/concerns/issuable_actions.rb @@ -162,12 +162,10 @@ module IssuableActions end format.json do - # We want to pass back the latest valid data, so reload the model render json: { errors: [ "Someone edited this #{issuable.human_class_name} at the same time you did. Please refresh your browser and make sure your changes will not unintentionally remove theirs." - ], - data: serializer.represent(@issuable.reload) # rubocop:disable Gitlab/ModuleWithInstanceVariables + ] }, status: :conflict end end diff --git a/spec/controllers/projects/issues_controller_spec.rb b/spec/controllers/projects/issues_controller_spec.rb index c2afff6b732..26c88382acc 100644 --- a/spec/controllers/projects/issues_controller_spec.rb +++ b/spec/controllers/projects/issues_controller_spec.rb @@ -379,6 +379,23 @@ describe Projects::IssuesController do expect(response).to have_gitlab_http_status(200) end end + + context 'when getting the changes' do + before do + project.add_developer(user) + + sign_in(user) + end + + it 'returns the necessary data' do + go(id: issue.iid) + + data = JSON.parse(response.body) + + expect(data).to include('title_text', 'description', 'description_text') + expect(data).to include('task_status', 'lock_version') + end + end end describe 'Confidential Issues' do diff --git a/spec/models/concerns/cache_markdown_field_spec.rb b/spec/models/concerns/cache_markdown_field_spec.rb index ef6af232999..a8a5521a5fc 100644 --- a/spec/models/concerns/cache_markdown_field_spec.rb +++ b/spec/models/concerns/cache_markdown_field_spec.rb @@ -133,6 +133,15 @@ describe CacheMarkdownField do end end + context 'when a markdown field and html field are both set' do + it do + expect(thing).not_to receive(:refresh_markdown_cache) + thing.foo = '_look over there!_' + thing.foo_html = 'look over there!' + thing.save + end + end + context 'a non-markdown field changed' do shared_examples 'with cache version' do |cache_version| let(:thing) { ThingWithMarkdownFields.new(foo: markdown, foo_html: html, cached_markdown_version: cache_version) }