From e4e8997cc17a8c530d52ba13ece3dae1ee49eed2 Mon Sep 17 00:00:00 2001 From: Martin Artnik Date: Tue, 7 Mar 2023 14:45:52 +0100 Subject: [PATCH] Add draft created activity [SCI-8093] --- app/controllers/protocols_controller.rb | 1 + config/initializers/extends.rb | 5 +++-- config/locales/global_activities/en.yml | 1 + 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/app/controllers/protocols_controller.rb b/app/controllers/protocols_controller.rb index 80c6110e7..14a65cbbe 100644 --- a/app/controllers/protocols_controller.rb +++ b/app/controllers/protocols_controller.rb @@ -389,6 +389,7 @@ class ProtocolsController < ApplicationController flash[:error] = draft.errors.full_messages.join(', ') redirect_to protocols_path else + log_activity(:protocol_template_draft_created, nil, protocol: @protocol.id) redirect_to protocol_path(draft) end rescue StandardError => e diff --git a/config/initializers/extends.rb b/config/initializers/extends.rb index 57a76f7de..9fe1a9b15 100644 --- a/config/initializers/extends.rb +++ b/config/initializers/extends.rb @@ -436,7 +436,8 @@ class Extends protocol_template_access_granted: 233, protocol_template_access_changed: 234, protocol_template_access_revoked: 235, - task_protocol_save_to_template: 236 + task_protocol_save_to_template: 236, + protocol_template_draft_created: 237 } ACTIVITY_GROUPS = { @@ -453,7 +454,7 @@ class Extends 78, 96, 107, 113, 114, *133..136, 180, 181, 182], protocol_repository: [80, 103, 89, 87, 79, 90, 91, 88, 85, 86, 84, 81, 82, 83, 101, 112, 123, 125, 117, 119, 129, 131, 170, 173, 179, 187, 186, - 190, 191, *204..215, 220, 221, 223, 227, 228, 229, *230..235], + 190, 191, *204..215, 220, 221, 223, 227, 228, 229, *230..235, 237], team: [92, 94, 93, 97, 104], label_repository: [*216..219] } diff --git a/config/locales/global_activities/en.yml b/config/locales/global_activities/en.yml index a87d291fc..03ff2dc05 100644 --- a/config/locales/global_activities/en.yml +++ b/config/locales/global_activities/en.yml @@ -257,6 +257,7 @@ en: protocol_template_published_html: "%{user} published protocol template %{protocol} version %{version_number}" protocol_template_revision_notes_updated_html: "%{user} edited revision notes of %{protocol}" protocol_template_draft_deleted_html: "%{user} deleted draft of %{protocol}" + protocol_template_draft_created_html: "%{user} created draft of %{protocol}" protocol_template_access_granted_html: "%{user} granted access to %{user_target} with user role %{role} to protocol template %{protocol}" protocol_template_access_changed_html: "%{user} changed %{user_target}’s role on protocol template %{protocol} to %{role}" protocol_template_access_revoked_html: "%{user} removed %{user_target} with user role %{role} from protocol template %{protocol}"