mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-12-26 01:35:34 +08:00
Merge pull request #199 from Ducz0r/lm-sys-notifications-rake-task
Update the system notification rake task
This commit is contained in:
commit
156d8f755e
1 changed files with 18 additions and 5 deletions
|
@ -1,10 +1,23 @@
|
|||
namespace :notifications do
|
||||
|
||||
desc 'Creates new system notification for all active users'
|
||||
task :new_release => :environment do
|
||||
task :new_system, [:title, :message] => :environment do |_, args|
|
||||
include NotificationsHelper
|
||||
puts 'Creation of system notification for all active users with link to release notes'
|
||||
create_system_notification('New release', 'http://scinote.net/docs/release-notes/')
|
||||
|
||||
if args.blank? ||
|
||||
args.empty? ||
|
||||
args[:title].blank? ||
|
||||
args[:message].blank?
|
||||
puts 'One or both of arguments are missing'
|
||||
return
|
||||
end
|
||||
|
||||
title = args[:title]
|
||||
message = args[:message]
|
||||
|
||||
puts 'Creating following system notification:'
|
||||
puts " *** #{title} ***"
|
||||
puts " #{I18n.l(Time.now, format: :full)} | #{message}"
|
||||
|
||||
create_system_notification(title, message)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue