From 14978f7c1fd882b2fecc8bb2f338fca802b77677 Mon Sep 17 00:00:00 2001 From: Oleksii Kriuchykhin Date: Wed, 3 Apr 2019 19:51:54 +0200 Subject: [PATCH] Fix activity creation for editing wopi file in protocol repository [SCI-3281] --- app/utilities/wopi_util.rb | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/app/utilities/wopi_util.rb b/app/utilities/wopi_util.rb index 8a1d04ca1..103a393b2 100644 --- a/app/utilities/wopi_util.rb +++ b/app/utilities/wopi_util.rb @@ -79,24 +79,28 @@ module WopiUtil t('activities.wupi_file_editing.finished') end if @assoc.class == Step - type_of = :edit_wopi_file_on_step_in_repository default_step_items = { step: @asset.step.id, step_position: { id: @asset.step.id, value_for: 'position' }, asset_name: { id: @asset.id, value_for: 'file_file_name' }, action: action } - message_items = { protocol: @protocol.id } if @protocol.in_module? project = @protocol.my_module.experiment.project + team = project.team type_of = :edit_wopi_file_on_step message_items = { my_module: @protocol.my_module.id } + else + type_of = :edit_wopi_file_on_step_in_repository + project = nil + team = @protocol.team + message_items = { protocol: @protocol.id } end message_items = default_step_items.merge(message_items) Activities::CreateActivityService .call(activity_type: type_of, owner: current_user, subject: @protocol, - team: @protocol.my_module.experiment.project.team, + team: team, project: project, message_items: message_items) elsif @assoc.class == Result