From 4868ec53316f0a0069b15416b0b722420829041a Mon Sep 17 00:00:00 2001 From: Oleksii Kriuchykhin Date: Tue, 28 Feb 2017 17:07:59 +0100 Subject: [PATCH] Remove task completion duplicated code [SCI-1075] --- app/controllers/my_modules_controller.rb | 30 ------------------------ 1 file changed, 30 deletions(-) diff --git a/app/controllers/my_modules_controller.rb b/app/controllers/my_modules_controller.rb index 665e79e52..870e07542 100644 --- a/app/controllers/my_modules_controller.rb +++ b/app/controllers/my_modules_controller.rb @@ -360,7 +360,6 @@ class MyModulesController < ApplicationController completed = @my_module.completed? if @my_module.save task_completion_activity - task_completion_notification if completed # Create localized title for complete/uncomplete button button_title = t('my_modules.buttons.complete') @@ -407,35 +406,6 @@ class MyModulesController < ApplicationController ) end - def task_completion_notification - title = I18n.t('notifications.types.recent_changes') - message = I18n.t( - 'notifications.task_completed', - user: current_user.full_name, - module: @my_module.name, - date: l(@my_module.completed_on, format: :full), - project: - view_context.link_to(@project.name, project_path(@project)), - experiment: - view_context.link_to( - @my_module.experiment.name, - canvas_experiment_path(@my_module.experiment) - ) - ) - - notification = Notification.create( - type_of: :recent_changes, - title: title, - message: sanitize_input(message), - generator_user_id: current_user.id - ) - if current_user.recent_notification - UserNotification.create( - notification: notification, user: current_user - ) - end - end - def load_vars @my_module = MyModule.find_by_id(params[:id]) if @my_module