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
Adds in_queue response. Makes sure target is reloaded just in case.
Marcello Rocha614372dd56c5
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 e0c6e128fce..f5f3bb07d0c 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@@ -27,7 +27,7 @@#++module JobStatusmodule ApplicationJobWithStatus- # Backgroun jobs can have a status JobStatus::Status+ # Background jobs can have a status JobStatus::Status# which is related to the job via a reference which is an AR model instance.def status_referencenildiff --git a/modules/job_status/lib/api/v3/job_status/job_status_representer.rb b/modules/job_status/lib/api/v3/job_status/job_status_representer.rbindex 721b25896a9..e3d73817c00 100644--- a/modules/job_status/lib/api/v3/job_status/job_status_representer.rb+++ b/modules/job_status/lib/api/v3/job_status/job_status_representer.rb@@ -53,7 +53,12 @@ module APIbatch = GoodJob::Job.find_by(id: represented.job_id)&.batchreturn represented.status unless batch- return "in_process" unless batch.finished?+ unless batch.finished?+ return "in_process" if batch.jobs.any?(&:running?)++ return "in_queue"+ end+return "success" if batch.succeeded?"failure" if batch.discarded?diff --git a/modules/job_status/spec/lib/api/v3/job_status/job_status_representer_spec.rb b/modules/job_status/spec/lib/api/v3/job_status/job_status_representer_spec.rbindex 5065b2d95aa..b8ed79e5758 100644--- a/modules/job_status/spec/lib/api/v3/job_status/job_status_representer_spec.rb+++ b/modules/job_status/spec/lib/api/v3/job_status/job_status_representer_spec.rb@@ -72,7 +72,7 @@ RSpec.describe API::V3::JobStatus::JobStatusRepresenter dostatus = JobStatus::Status.order(:created_at).laststatus_json = described_class.new(status, current_user: user).to_json- expect(status_json).to be_json_eql("in_process".to_json).at_path("status")+ expect(status_json).to be_json_eql("in_queue".to_json).at_path("status")endit "returns success if the batch has finished and is successful" dodiff --git a/modules/storages/app/workers/storages/copy_project_folders_job.rb b/modules/storages/app/workers/storages/copy_project_folders_job.rbindex e26a39fa41e..4d186d746f0 100644--- a/modules/storages/app/workers/storages/copy_project_folders_job.rb+++ b/modules/storages/app/workers/storages/copy_project_folders_job.rb@@ -48,7 +48,7 @@ module Storagesproject_folder_mode: source.project_folder_mode).on_failure { |failed| log_failure(failed) and return failed }- FileLinks::CopyFileLinksService.call(source: @source, target:, user:, work_packages_map:)+ FileLinks::CopyFileLinksService.call(source: @source, target: target.reload, user:, work_packages_map:)endprivatediff --git a/spec/requests/api/v3/projects/copy/copy_resource_spec.rb b/spec/requests/api/v3/projects/copy/copy_resource_spec.rbindex 8192400f99e..37ab48d5b10 100644--- a/spec/requests/api/v3/projects/copy/copy_resource_spec.rb+++ b/spec/requests/api/v3/projects/copy/copy_resource_spec.rb@@ -111,7 +111,7 @@ RSpec.describe "API::V3::Projects::Copy::CopyAPI", content_type: :json, with_gooexpect(last_response.status).to eq(200)expect(last_response.body)- .to be_json_eql("in_process".to_json)+ .to be_json_eql("in_queue".to_json).at_path("status")GoodJob.perform_inline