Merge branch 'release/11.1' into dev

pull/8939/head
ulferts 4 years ago
commit cf385d53e6
No known key found for this signature in database
GPG Key ID: A205708DE1284017
  1. 11
      app/workers/attachments/finish_direct_upload_job.rb
  2. 2
      spec/workers/attachments/finish_direct_upload_job_integration_spec.rb

@ -78,10 +78,19 @@ class Attachments::FinishDirectUploadJob < ApplicationJob
# This remains a TODO.
# But with the timestamp update in place as it is, at least the collapsing of aggregated journals
# from days before with the newly uploaded attachment is prevented.
journable.touch
touch_journable(journable)
Journals::CreateService
.new(journable, attachment.author)
.call
end
def touch_journable(journable)
# Not using touch here on purpose,
# as to avoid changing lock versions on the journables for this change
attributes = journable.send(:timestamp_attributes_for_update_in_model)
timestamps = attributes.index_with { Time.now }
journable.update_columns(timestamps) if timestamps.any?
end
end

@ -93,7 +93,7 @@ describe Attachments::FinishDirectUploadJob, 'integration', type: :job do
container.reload
expect(container.lock_version)
.to eql 1
.to eql 0
end
end

Loading…
Cancel
Save