Skip to content

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

Fix comments service after added param

Oliver Güntheree26f4ce2ddf
diff --git a/modules/bim/app/services/bim/bcf/comments/create_service.rb b/modules/bim/app/services/bim/bcf/comments/create_service.rb
index 6259ca4fb6d..61ebeb1e138 100644
--- a/modules/bim/app/services/bim/bcf/comments/create_service.rb
+++ b/modules/bim/app/services/bim/bcf/comments/create_service.rb
@@ -31,7 +31,7 @@ module Bim::Bcf
class CreateService < ::BaseServices::Create
private
- def before_perform(params)
+ def before_perform(params, service_result)
journal_call = create_journal(params[:issue].work_package,
params[:comment])
return journal_call if journal_call.failure?
@@ -39,7 +39,7 @@ module Bim::Bcf
input = { journal: journal_call.result }
.merge(params)
.slice(*::Bim::Bcf::Comment::CREATE_ATTRIBUTES)
- super input
+ super input, service_result
end
def create_journal(work_package, comment)
diff --git a/modules/bim/app/services/bim/bcf/comments/update_service.rb b/modules/bim/app/services/bim/bcf/comments/update_service.rb
index 71bacc49fc7..3e448585495 100644
--- a/modules/bim/app/services/bim/bcf/comments/update_service.rb
+++ b/modules/bim/app/services/bim/bcf/comments/update_service.rb
@@ -31,11 +31,11 @@ module Bim::Bcf
class UpdateService < ::BaseServices::Update
private
- def before_perform(params)
+ def before_perform(params, service_result)
journal_call = update_journal(params[:original_comment].journal, params[:comment])
return journal_call if journal_call.failure?
- super params.slice(*::Bim::Bcf::Comment::UPDATE_ATTRIBUTES)
+ super params.slice(*::Bim::Bcf::Comment::UPDATE_ATTRIBUTES), service_result
end
def update_journal(journal, comment)
diff --git a/modules/documents/app/controllers/documents_controller.rb b/modules/documents/app/controllers/documents_controller.rb
index f03b3bced4d..6ae61ced8b8 100644
--- a/modules/documents/app/controllers/documents_controller.rb
+++ b/modules/documents/app/controllers/documents_controller.rb
@@ -87,8 +87,6 @@ class DocumentsController < ApplicationController
model: @document,
args: document_params
- binding.pry
-
if call.success?
flash[:notice] = I18n.t(:notice_successful_update)
redirect_to action: 'show', id: @document
diff --git a/modules/documents/spec/controllers/documents_controller_spec.rb b/modules/documents/spec/controllers/documents_controller_spec.rb
index 9a0d0e6d610..291fb48ff06 100644
--- a/modules/documents/spec/controllers/documents_controller_spec.rb
+++ b/modules/documents/spec/controllers/documents_controller_spec.rb
@@ -129,12 +129,6 @@ describe DocumentsController do
.with(:create_notifications, document.journals.last, true)
end
- it 'does trigger a workflow job for the document' do
- expect(Notifications::WorkflowJob)
- .to have_been_enqueued
- .with(:create_notifications, document.journals.last, true)
- end
-
describe "with attachments" do
let(:uncontainered) { FactoryBot.create :attachment, container: nil, author: admin }