mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-02-12 01:46:55 +08:00
Merge pull request #503 from okriuchykhin/ok_SCI_1075
Remove task completion notification generation duplicated code [SCI-1075]
This commit is contained in:
commit
a5bae1b19b
1 changed files with 0 additions and 30 deletions
|
@ -360,7 +360,6 @@ class MyModulesController < ApplicationController
|
||||||
completed = @my_module.completed?
|
completed = @my_module.completed?
|
||||||
if @my_module.save
|
if @my_module.save
|
||||||
task_completion_activity
|
task_completion_activity
|
||||||
task_completion_notification if completed
|
|
||||||
|
|
||||||
# Create localized title for complete/uncomplete button
|
# Create localized title for complete/uncomplete button
|
||||||
button_title = t('my_modules.buttons.complete')
|
button_title = t('my_modules.buttons.complete')
|
||||||
|
@ -407,35 +406,6 @@ class MyModulesController < ApplicationController
|
||||||
)
|
)
|
||||||
end
|
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
|
def load_vars
|
||||||
@my_module = MyModule.find_by_id(params[:id])
|
@my_module = MyModule.find_by_id(params[:id])
|
||||||
if @my_module
|
if @my_module
|
||||||
|
|
Loading…
Reference in a new issue