OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Ensure we're not updating the user reference from delayed job
Oliver Günther262b457f198a
diff --git a/modules/job_status/app/workers/job_status/application_job_with_status.rb b/modules/job_status/app/workers/job_status/application_job_with_status.rbindex 6f6ab2ea2ab..510ec8552d9 100644--- a/modules/job_status/app/workers/job_status/application_job_with_status.rb+++ b/modules/job_status/app/workers/job_status/application_job_with_status.rb@@ -63,18 +63,19 @@ module JobStatus### Update the status code for a given jobdef upsert_status(status:, **args)- upsert_attributes = args.reverse_merge(- status: status,- message: nil,- payload: nil,- reference_id: status_reference&.id,- reference_type: status_reference&.class.to_s,- user_id: User.current.id,- job_id: job_id- )+ upsert_attributes =- ::JobStatus::Status.upsert upsert_attributes,- unique_by: :job_id+ # Can't use upsert, as we only want to insert the user_id once+ # and not update it repeatedly+ resource = ::JobStatus::Status.find_or_initialize_by(job_id: job_id)++ if resource.new_record?+ resource.user_id = User.current.id+ resource.reference = status_reference+ end++ new_attributes = args.reverse_merge(status: status, message: nil, payload: nil)+ resource.update! new_attributesendprotected