Fix activity creation for editing wopi file in protocol repository [SCI-3281]

This commit is contained in:
Oleksii Kriuchykhin 2019-04-03 19:51:54 +02:00
parent 05963eb245
commit 14978f7c1f

View file

@ -79,24 +79,28 @@ module WopiUtil
t('activities.wupi_file_editing.finished') t('activities.wupi_file_editing.finished')
end end
if @assoc.class == Step if @assoc.class == Step
type_of = :edit_wopi_file_on_step_in_repository
default_step_items = default_step_items =
{ step: @asset.step.id, { step: @asset.step.id,
step_position: { id: @asset.step.id, value_for: 'position' }, step_position: { id: @asset.step.id, value_for: 'position' },
asset_name: { id: @asset.id, value_for: 'file_file_name' }, asset_name: { id: @asset.id, value_for: 'file_file_name' },
action: action } action: action }
message_items = { protocol: @protocol.id }
if @protocol.in_module? if @protocol.in_module?
project = @protocol.my_module.experiment.project project = @protocol.my_module.experiment.project
team = project.team
type_of = :edit_wopi_file_on_step type_of = :edit_wopi_file_on_step
message_items = { my_module: @protocol.my_module.id } 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 end
message_items = default_step_items.merge(message_items) message_items = default_step_items.merge(message_items)
Activities::CreateActivityService Activities::CreateActivityService
.call(activity_type: type_of, .call(activity_type: type_of,
owner: current_user, owner: current_user,
subject: @protocol, subject: @protocol,
team: @protocol.my_module.experiment.project.team, team: team,
project: project, project: project,
message_items: message_items) message_items: message_items)
elsif @assoc.class == Result elsif @assoc.class == Result