effective_events 3.3.15 → 3.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a03f3210e66ed5dc23b57619f77100a0eb585d803a0ac45f4d1842d5576f5350
4
- data.tar.gz: 1be08a25e213346060d119f134f0f1cad3b0d58c786195a8777e382ff2b9187c
3
+ metadata.gz: d36c39d52577f7de941d719224d2f4b6133250477dea413d9e31d8b5c6ac3b23
4
+ data.tar.gz: 4100baee17818a324d6e75adf8180db11133e69169d1e1c6f4b71cc36499b395
5
5
  SHA512:
6
- metadata.gz: cc59cb96af9eea49b09e079ffebcce4084e540a5f965fd1961f49f424dfa492d8433b2782b8f20ccdb423b42bff081d992c076c82e2f731e8c8fd1fb456c667e
7
- data.tar.gz: d8c7f4337a6b740203a4efd5c646f64bfb40d7d7cf642de432995fdb53e9b91f41f84fe8aec760ce4121276a2e83dfa59aa10218891137d033136cba1689a605
6
+ metadata.gz: 6ac1adf4082dc46c4d2245083a671678af9c14d9088f9b1a9e0a0c2cf50d1f3f488976280c3d9ae1600e93d045d47aadf5475e79b132af7b2a9f45e3ad59f8bb
7
+ data.tar.gz: 4229959384d4a312218fa8868f70c6d313c9730c4cec319f5079f12ba9d1c2220c46a7d68f5ca150d20e306693609eaf0c7c2826040b29f21b8087911b3617d4
@@ -85,7 +85,7 @@ module Effective
85
85
  self.owner ||= event_registration.owner
86
86
  end
87
87
 
88
- with_options(unless: -> { purchased? && !blank_registrant_was }) do
88
+ with_options(unless: -> { purchased? && !blank_registrant_was && !user_changed? }) do
89
89
  before_validation(if: -> { blank_registrant? }) do
90
90
  assign_attributes(user: nil, organization: nil, first_name: nil, last_name: nil, email: nil, company: nil)
91
91
  end
@@ -103,6 +103,11 @@ module Effective
103
103
  assign_attributes(first_name: user.first_name, last_name: user.last_name, email: (user.try(:public_email).presence || user.email))
104
104
  end
105
105
 
106
+ before_validation(if: -> { user.present? && user_changed? && user.class.try(:effective_memberships_organization_user?) }) do
107
+ organization = user.organizations.first
108
+ assign_attributes(organization: organization, company: organization.to_s.presence)
109
+ end
110
+
106
111
  before_validation(if: -> { organization.blank? && user.present? && user.class.try(:effective_memberships_organization_user?) }) do
107
112
  assign_attributes(company: user.organizations.first.to_s.presence) if company.blank?
108
113
  end
@@ -134,7 +139,7 @@ module Effective
134
139
 
135
140
  # Validate this user isn't already registered for this event ticket on another registration
136
141
  # Or for this event on any ticket, when one ticket per event is enabled
137
- validate(if: -> { user.present? && event_ticket.present? && registrant_validations_enabled? }, unless: -> { purchased? }) do
142
+ validate(if: -> { user.present? && event_ticket.present? && (registrant_validations_enabled? || (registered? && !archived? && user_changed?)) }) do
138
143
  duplicate_of = (validate_one_ticket_per_event? ? { event: event } : { event_ticket: event_ticket })
139
144
 
140
145
  if Effective::EventRegistrant.unarchived.registered.where(user: user).where(duplicate_of).where.not(id: id).present?
@@ -1,3 +1,3 @@
1
1
  module EffectiveEvents
2
- VERSION = '3.3.15'.freeze
2
+ VERSION = '3.4.1'.freeze
3
3
  end
@@ -20,7 +20,7 @@ module EffectiveEvents
20
20
  include EffectiveGem
21
21
 
22
22
  def self.EventRegistration
23
- event_registration_class_name&.constantize || Effective::EventRegistration
23
+ klass(:event_registration)
24
24
  end
25
25
 
26
26
  def self.mailer_class
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: effective_events
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.3.15
4
+ version: 3.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Code and Effect