* Rubocop fixes * Rubocop fixes * Fixed rubocop violation * Fixed policies rubocop violations * More rubocop fixes
25 lines
555 B
Ruby
25 lines
555 B
Ruby
module Notifications
|
|
class RemoveAll
|
|
def self.call(...)
|
|
new(...).call
|
|
end
|
|
|
|
def initialize(notifiable_ids, notifiable_type)
|
|
return unless %w[Article Comment Mention].include?(notifiable_type) && notifiable_ids.present?
|
|
|
|
@notifiable_type = notifiable_type
|
|
@notifiable_ids = notifiable_ids
|
|
end
|
|
|
|
def call
|
|
Notification.where(
|
|
notifiable_type: notifiable_type,
|
|
notifiable_id: notifiable_ids,
|
|
).delete_all
|
|
end
|
|
|
|
private
|
|
|
|
attr_reader :notifiable_type, :notifiable_ids
|
|
end
|
|
end
|