Sha256: d420f8f6aebca7242b9db72fd2591b1c640aa604fccba079fa07a9c1d5e89fae

Contents?: true

Size: 831 Bytes

Versions: 46

Compression:

Stored size: 831 Bytes

Contents

# frozen_string_literal: true

module Decidim
  class Notification < ApplicationRecord
    include Decidim::DataPortability

    belongs_to :resource, foreign_key: "decidim_resource_id", foreign_type: "decidim_resource_type", polymorphic: true
    belongs_to :user, foreign_key: "decidim_user_id", class_name: "Decidim::User"

    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

    def user_role
      extra["received_as"]
    end

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

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

Version data entries

46 entries across 46 versions & 1 rubygems

Version Path
decidim-core-0.26.10 app/models/decidim/notification.rb
decidim-core-0.26.9 app/models/decidim/notification.rb
decidim-core-0.26.8 app/models/decidim/notification.rb
decidim-core-0.26.7 app/models/decidim/notification.rb
decidim-core-0.26.5 app/models/decidim/notification.rb
decidim-core-0.26.4 app/models/decidim/notification.rb
decidim-core-0.26.3 app/models/decidim/notification.rb
decidim-core-0.26.2 app/models/decidim/notification.rb
decidim-core-0.26.1 app/models/decidim/notification.rb
decidim-core-0.26.0 app/models/decidim/notification.rb
decidim-core-0.26.0.rc2 app/models/decidim/notification.rb
decidim-core-0.26.0.rc1 app/models/decidim/notification.rb
decidim-core-0.25.2 app/models/decidim/notification.rb
decidim-core-0.25.1 app/models/decidim/notification.rb
decidim-core-0.25.0 app/models/decidim/notification.rb
decidim-core-0.25.0.rc4 app/models/decidim/notification.rb
decidim-core-0.25.0.rc3 app/models/decidim/notification.rb
decidim-core-0.25.0.rc2 app/models/decidim/notification.rb
decidim-core-0.25.0.rc1 app/models/decidim/notification.rb
decidim-core-0.24.3 app/models/decidim/notification.rb