Merge pull request #199 from Ducz0r/lm-sys-notifications-rake-task

Update the system notification rake task
This commit is contained in:
Luka Murn 2016-10-06 14:23:22 +02:00 committed by GitHub
commit 156d8f755e

View file

@ -1,10 +1,23 @@
namespace :notifications do namespace :notifications do
desc 'Creates new system notification for all active users' desc 'Creates new system notification for all active users'
task :new_release => :environment do task :new_system, [:title, :message] => :environment do |_, args|
include NotificationsHelper 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 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 end