mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-01-01 21:21:50 +08:00
[CAPA] - When creating tasks designated user activity is missing - No notification is sent[SCI-9432]
This commit is contained in:
parent
ba8782b339
commit
9dcb89e371
1 changed files with 9 additions and 0 deletions
|
@ -67,6 +67,7 @@ class MyModulesController < ApplicationController
|
|||
subject: @my_module,
|
||||
message_items: { my_module: @my_module.id }
|
||||
)
|
||||
log_user_assignment_activity
|
||||
redirect_to canvas_experiment_path(@experiment) if params[:my_module][:view_mode] == 'canvas'
|
||||
rescue ActiveRecord::RecordInvalid
|
||||
render json: @my_module.errors, status: :unprocessable_entity
|
||||
|
@ -545,6 +546,14 @@ class MyModulesController < ApplicationController
|
|||
log_activity(type_of, @my_module, message_items)
|
||||
end
|
||||
|
||||
def log_user_assignment_activity
|
||||
users = User.where(id: params[:my_module][:user_ids])
|
||||
|
||||
users.each do |user|
|
||||
log_activity(:designate_user_to_my_module, @my_module, { user_target: user.id })
|
||||
end
|
||||
end
|
||||
|
||||
def log_activity(type_of, my_module = nil, message_items = {})
|
||||
my_module ||= @my_module
|
||||
message_items = { my_module: my_module.id }.merge(message_items)
|
||||
|
|
Loading…
Reference in a new issue