diff --git a/app/controllers/my_modules_controller.rb b/app/controllers/my_modules_controller.rb index 07a6b549a..6f6e69a16 100644 --- a/app/controllers/my_modules_controller.rb +++ b/app/controllers/my_modules_controller.rb @@ -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)