Merge pull request #4715 from aignatov-bio/ai-sci-7559-add-step-text-notification

Add new step text notification [SCI-7559]
This commit is contained in:
aignatov-bio 2023-01-04 10:06:57 +01:00 committed by GitHub
commit 6af72a28ee
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 0 deletions

View file

@ -55,6 +55,17 @@ module StepsActions
)
end
def step_text_annotation(step, step_text, old_text = nil)
smart_annotation_notification(
old_text: old_text,
new_text: step_text.text,
title: t('notifications.step_text_title',
user: current_user.full_name,
step: step.name),
message: annotation_message(step)
)
end
def checklist_name_annotation(step, checklist, old_text = nil)
smart_annotation_notification(
old_text: old_text,

View file

@ -2,6 +2,9 @@
module StepElements
class TextsController < BaseController
include ApplicationHelper
include StepsActions
before_action :load_step_text, only: %i(update destroy duplicate)
def create
@ -18,10 +21,12 @@ module StepElements
end
def update
old_text = @step_text.text
ActiveRecord::Base.transaction do
@step_text.update!(step_text_params)
TinyMceAsset.update_images(@step_text, params[:tiny_mce_images], current_user)
log_step_activity(:text_edited, { text_name: @step_text.name })
step_text_annotation(@step, @step_text, old_text)
end
render json: @step_text, serializer: StepTextSerializer, user: current_user

View file

@ -3021,6 +3021,7 @@ en:
step_comment_annotation_title: "%{user} mentioned you in a comment on step %{step}."
step_description_title: "%{user} mentioned you in a description on step %{step}."
checklist_title: "%{user} mentioned you in a checklist on step %{step}."
step_text_title: "%{user} mentioned you in a text on step %{step}."
step_annotation_message_html: "Project: %{project} | Experiment: %{experiment} | Task: %{my_module} | Step: %{step}"
result_annotation_title: "%{user} mentioned you in result %{result}."
result_comment_annotation_title: "%{user} mentioned you in a comment on result %{result}."