Sha256: ad99eac24f672bd81190d9e4923b8bf8e043e2182e4c866934d93aa1d48a29eb

Contents?: true

Size: 1.06 KB

Versions: 67

Compression:

Stored size: 1.06 KB

Contents

module UINotifications
  module Tasks
    class TaskBulkResume < ::UINotifications::Base
      def initialize(task, resumed_length, failed_length, skipped_length)
        @subject = task
        @resumed_length = resumed_length
        @failed_length = failed_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_USER
      end

      def message
        ('%{resumed} Tasks were resumed. %{failed} Tasks failed to resume. %{skipped} Tasks were skipped. ' %
          { resumed: @resumed_length,
          failed: @failed_length,
          skipped: @skipped_length })
      end

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

Version data entries

67 entries across 67 versions & 1 rubygems

Version Path
foreman-tasks-10.0.1 app/services/ui_notifications/tasks/task_bulk_resume.rb
foreman-tasks-10.0.0 app/services/ui_notifications/tasks/task_bulk_resume.rb
foreman-tasks-9.2.3 app/services/ui_notifications/tasks/task_bulk_resume.rb
foreman-tasks-9.2.2 app/services/ui_notifications/tasks/task_bulk_resume.rb
foreman-tasks-9.2.1 app/services/ui_notifications/tasks/task_bulk_resume.rb
foreman-tasks-9.2.0 app/services/ui_notifications/tasks/task_bulk_resume.rb
foreman-tasks-9.1.1 app/services/ui_notifications/tasks/task_bulk_resume.rb
foreman-tasks-9.0.4 app/services/ui_notifications/tasks/task_bulk_resume.rb
foreman-tasks-9.1.0 app/services/ui_notifications/tasks/task_bulk_resume.rb
foreman-tasks-9.0.2 app/services/ui_notifications/tasks/task_bulk_resume.rb
foreman-tasks-9.0.1 app/services/ui_notifications/tasks/task_bulk_resume.rb
foreman-tasks-8.3.3 app/services/ui_notifications/tasks/task_bulk_resume.rb
foreman-tasks-9.0.0 app/services/ui_notifications/tasks/task_bulk_resume.rb
foreman-tasks-8.2.1 app/services/ui_notifications/tasks/task_bulk_resume.rb
foreman-tasks-8.1.4 app/services/ui_notifications/tasks/task_bulk_resume.rb
foreman-tasks-8.3.2 app/services/ui_notifications/tasks/task_bulk_resume.rb
foreman-tasks-8.3.1 app/services/ui_notifications/tasks/task_bulk_resume.rb
foreman-tasks-8.1.3 app/services/ui_notifications/tasks/task_bulk_resume.rb
foreman-tasks-8.3.0 app/services/ui_notifications/tasks/task_bulk_resume.rb
foreman-tasks-8.2.0 app/services/ui_notifications/tasks/task_bulk_resume.rb