diff --git a/app/models/experiment.rb b/app/models/experiment.rb index f30ad9fad..2ee527e66 100644 --- a/app/models/experiment.rb +++ b/app/models/experiment.rb @@ -263,7 +263,7 @@ class Experiment < ApplicationRecord def archive_modules(module_ids, current_user) my_modules.where(id: module_ids).each do |my_module| my_module.archive!(current_user) - log_activity(:archive_task, current_user, my_module) + log_activity(:archive_module, current_user, my_module) end my_modules.reload end diff --git a/app/services/report_actions/save_pdf_to_inventory_item.rb b/app/services/report_actions/save_pdf_to_inventory_item.rb index c27ddf2bc..6d7d0bd81 100644 --- a/app/services/report_actions/save_pdf_to_inventory_item.rb +++ b/app/services/report_actions/save_pdf_to_inventory_item.rb @@ -17,6 +17,7 @@ module ReportActions cell.destroy if cell @new_cell_value = create_new_cell_value(asset) @new_cell_value.save + log_activity end def error_messages @@ -107,6 +108,18 @@ module ReportActions return content unless content.blank? I18n.t('projects.reports.new.no_content_for_PDF_html') end + + def log_activity + Activities::CreateActivityService + .call(activity_type: :edit_item_inventory, + owner: @user, + subject: @repository, + team: @team, + message_items: { + repository_row: @repository_item.id, + repository: @repository.id + }) + end end RepositoryPermissionError = Class.new(StandardError) diff --git a/app/utilities/repository_import_parser/importer.rb b/app/utilities/repository_import_parser/importer.rb index 2ba54e6aa..92d291728 100644 --- a/app/utilities/repository_import_parser/importer.rb +++ b/app/utilities/repository_import_parser/importer.rb @@ -107,6 +107,8 @@ module RepositoryImportParser errors = true raise ActiveRecord::Rollback end + + log_activity(record_row) @new_rows_added += 1 end end @@ -155,5 +157,18 @@ module RepositoryImportParser end current_column end + + def log_activity(repository_row) + Activities::CreateActivityService.call( + activity_type: :create_item_inventory, + owner: @user, + subject: @repository, + team: @repository.team, + message_items: { + repository_row: repository_row.id, + repository: @repository.id + } + ) + end end end diff --git a/config/locales/global_activities/en.yml b/config/locales/global_activities/en.yml index 70f34a252..c5ac7e525 100644 --- a/config/locales/global_activities/en.yml +++ b/config/locales/global_activities/en.yml @@ -13,7 +13,7 @@ en: custom_dates_label: "Select custom dates" from_label: "Select end date" to_label: "Select start date" - clear: "clear" + clear: "Clear" activity_type: "Activity type" user: "User" object: "Object" @@ -181,7 +181,6 @@ en: restore_experiment: "Experiment restored" rename_task: "Task renamed" move_task: "Task moved" - archive_task: "Task archived" set_task_due_date: "Task due date set" change_task_due_date: "Task due date changed" remove_task_due_date: "Task due date removed" diff --git a/spec/models/experiment_spec.rb b/spec/models/experiment_spec.rb index 9c2da5944..8f2c32359 100644 --- a/spec/models/experiment_spec.rb +++ b/spec/models/experiment_spec.rb @@ -180,7 +180,7 @@ describe Experiment, type: :model do expect(Activities::CreateActivityService) .to(receive(:call) .with(hash_including(activity_type: - :archive_task))).exactly(3).times + :archive_module))).exactly(3).times function_call end