Class: Decidim::Notification

Inherits:
ApplicationRecord show all
Includes:
DataPortability
Defined in:
decidim-core/app/models/decidim/notification.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.export_serializerObject


28
29
30
# File 'decidim-core/app/models/decidim/notification.rb', line 28

def self.export_serializer
  Decidim::DataPortabilitySerializers::DataPortabilityNotificationSerializer
end

.user_collection(user) ⇒ Object


24
25
26
# File 'decidim-core/app/models/decidim/notification.rb', line 24

def self.user_collection(user)
  where(decidim_user_id: user.id)
end

Instance Method Details

#event_class_instanceObject


10
11
12
13
14
15
16
17
18
# File 'decidim-core/app/models/decidim/notification.rb', line 10

def event_class_instance
  @event_class_instance ||= event_class.constantize.new(
    resource: resource,
    event_name: event_name,
    user: user,
    user_role: user_role,
    extra: extra
  )
end

#user_roleObject


20
21
22
# File 'decidim-core/app/models/decidim/notification.rb', line 20

def user_role
  extra["received_as"]
end