Sha256: 061f4a25fa2b369f2be04b5b281710c5c338d0da07fe259db3026bcbcb76ab7f

Contents?: true

Size: 1.2 KB

Versions: 25

Compression:

Stored size: 1.2 KB

Contents

# frozen_string_literal: true

module Decidim
  module Conferences
    # The data store for an Invite in the Decidim::Conferences component.
    class ConferenceInvite < ApplicationRecord
      include Decidim::Traceable
      include Decidim::Loggable
      include Decidim::DownloadYourData

      belongs_to :conference, foreign_key: "decidim_conference_id", class_name: "Decidim::Conference"
      belongs_to :user, foreign_key: "decidim_user_id", class_name: "Decidim::User"
      belongs_to :registration_type, foreign_key: "decidim_conference_registration_type_id", class_name: "Decidim::Conferences::RegistrationType"

      validates :user, uniqueness: { scope: :conference }

      def self.export_serializer
        Decidim::Conferences::DownloadYourDataConferenceInviteSerializer
      end

      def self.log_presenter_class_for(_log)
        Decidim::Conferences::AdminLog::InvitePresenter
      end

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

      def accept!
        update!(accepted_at: Time.current, rejected_at: nil)
      end

      def reject!
        update!(rejected_at: Time.current, accepted_at: nil)
      end
      alias decline! reject!
    end
  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
decidim-conferences-0.29.1 app/models/decidim/conferences/conference_invite.rb
decidim-conferences-0.28.4 app/models/decidim/conferences/conference_invite.rb
decidim-conferences-0.27.9 app/models/decidim/conferences/conference_invite.rb
decidim-conferences-0.29.0 app/models/decidim/conferences/conference_invite.rb
decidim-conferences-0.28.3 app/models/decidim/conferences/conference_invite.rb
decidim-conferences-0.27.8 app/models/decidim/conferences/conference_invite.rb
decidim-conferences-0.29.0.rc4 app/models/decidim/conferences/conference_invite.rb
decidim-conferences-0.29.0.rc3 app/models/decidim/conferences/conference_invite.rb
decidim-conferences-0.29.0.rc2 app/models/decidim/conferences/conference_invite.rb
decidim-conferences-0.29.0.rc1 app/models/decidim/conferences/conference_invite.rb
decidim-conferences-0.28.2 app/models/decidim/conferences/conference_invite.rb
decidim-conferences-0.27.7 app/models/decidim/conferences/conference_invite.rb
decidim-conferences-0.28.1 app/models/decidim/conferences/conference_invite.rb
decidim-conferences-0.27.6 app/models/decidim/conferences/conference_invite.rb
decidim-conferences-0.28.0 app/models/decidim/conferences/conference_invite.rb
decidim-conferences-0.27.5 app/models/decidim/conferences/conference_invite.rb
decidim-conferences-0.28.0.rc5 app/models/decidim/conferences/conference_invite.rb
decidim-conferences-0.28.0.rc4 app/models/decidim/conferences/conference_invite.rb
decidim-conferences-0.27.4 app/models/decidim/conferences/conference_invite.rb
decidim-conferences-0.27.3 app/models/decidim/conferences/conference_invite.rb