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')
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