Sha256: 03f91366040743e387a844f5b85426f7f753e0108e953904f269ad7e8d0ed9f3

Contents?: true

Size: 966 Bytes

Versions: 64

Compression:

Stored size: 966 Bytes

Contents

module UINotifications
  module Tasks
    class TaskBulkStop < ::UINotifications::Base
      def initialize(task, stopped_length, skipped_length)
        @subject = task
        @stopped_length = stopped_length
        @skipped_length = skipped_length
      end

      def create
        Notification.create!(
          initiator: initiator,
          audience: audience,
          subject: subject,
          notification_blueprint: blueprint,
          message: message,
          notification_recipients: [NotificationRecipient.create(:user => User.current)]
        )
      end

      def audience
        Notification::AUDIENCE_GLOBAL
      end

      def message
        ('%{stopped} Tasks were stopped. %{skipped} Tasks were already stopped. ' %
          { stopped: @stopped_length,
          skipped: @skipped_length })
      end

      def blueprint
        @blueprint ||= NotificationBlueprint.find_by(name: 'tasks_bulk_stop')
      end
    end
  end
end

Version data entries

64 entries across 64 versions & 1 rubygems

Version Path
foreman-tasks-8.1.2 app/services/ui_notifications/tasks/task_bulk_stop.rb
foreman-tasks-8.1.1 app/services/ui_notifications/tasks/task_bulk_stop.rb
foreman-tasks-8.1.0 app/services/ui_notifications/tasks/task_bulk_stop.rb
foreman-tasks-8.0.2 app/services/ui_notifications/tasks/task_bulk_stop.rb
foreman-tasks-8.0.1 app/services/ui_notifications/tasks/task_bulk_stop.rb
foreman-tasks-8.0.0 app/services/ui_notifications/tasks/task_bulk_stop.rb
foreman-tasks-7.2.1 app/services/ui_notifications/tasks/task_bulk_stop.rb
foreman-tasks-7.1.1 app/services/ui_notifications/tasks/task_bulk_stop.rb
foreman-tasks-7.2.0 app/services/ui_notifications/tasks/task_bulk_stop.rb
foreman-tasks-7.1.0 app/services/ui_notifications/tasks/task_bulk_stop.rb
foreman-tasks-6.0.3 app/services/ui_notifications/tasks/task_bulk_stop.rb
foreman-tasks-7.0.0 app/services/ui_notifications/tasks/task_bulk_stop.rb
foreman-tasks-6.0.2 app/services/ui_notifications/tasks/task_bulk_stop.rb
foreman-tasks-4.1.6 app/services/ui_notifications/tasks/task_bulk_stop.rb
foreman-tasks-5.2.3 app/services/ui_notifications/tasks/task_bulk_stop.rb
foreman-tasks-6.0.1 app/services/ui_notifications/tasks/task_bulk_stop.rb
foreman-tasks-5.2.2 app/services/ui_notifications/tasks/task_bulk_stop.rb
foreman-tasks-6.0.0 app/services/ui_notifications/tasks/task_bulk_stop.rb
foreman-tasks-5.2.1 app/services/ui_notifications/tasks/task_bulk_stop.rb
foreman-tasks-5.3.0 app/services/ui_notifications/tasks/task_bulk_stop.rb