effective_resources 2.22.0 → 2.22.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bf772c98b5fdf940a4fabb5138b37d2d34244f62bd6ee35b44e9d5bc2b6980d6
4
- data.tar.gz: fc4cd66e588ccb8cc6aebe24bbb5b9101c67d1a7a667a0e8f38d2f4c83cc90ab
3
+ metadata.gz: 155b88e4f6e0f28971593f6c25da4f9c787a0da62ef6f7f851cec0496def856e
4
+ data.tar.gz: 1ad5f683874982e47be3186363354adf0460bfb4af7ed4c4c2e922341a34de66
5
5
  SHA512:
6
- metadata.gz: 45b9292be198f62c61313e7762930c8d5752f36223aeea93702069a5189b1c2c02b93fe8ce0061683784beddc936bf903e47cd850f25fb617c8d2e52ec938333
7
- data.tar.gz: 24f95b7eceeb74f84b0bda8275e4a3dccd29858cee58dd2bceb8728ff215a1603705a3083d4b0d080559692f6834318f0576b279196571af74364fb4599e642c
6
+ metadata.gz: 3dca56a7285c363e1bdbb79f775c53d3e645788ecf783caaa72ade6824b191998824548069b6b52ab6d1d78b37828ce5a730c51d92a74810f80cfd1cae44f668
7
+ data.tar.gz: baa235bfd2a657daae89b7ae1e5103f10ae9c41e47c4d2fd3e1d18160f7f9eb399d494c614927fa089991209830c50c2c85573c83be0e81751ce4c78d23f9ff3
@@ -38,7 +38,7 @@ module EffectiveResourcesWizardHelper
38
38
  if (current || disabled)
39
39
  content_tag(:a, label, class: klass)
40
40
  else
41
- link_to(label, path || wizard_path(nav_step), class: klass)
41
+ link_to(label, path || wizard_path(nav_step), class: klass, 'data-turbolinks': false)
42
42
  end
43
43
  end
44
44
 
@@ -96,7 +96,7 @@ module ActsAsPurchasableWizard
96
96
  # From Billing Step
97
97
  order.billing_address = owner.billing_address if owner.try(:billing_address).present?
98
98
 
99
- # This will update all order items to match the prices from their purchasable
99
+ # This will assign all order items to match the prices from their purchasable
100
100
  order.try(:update_purchasable_attributes)
101
101
 
102
102
  # Handle effective_memberships coupon fees price reduction
@@ -165,9 +165,14 @@ module ActsAsPurchasableWizard
165
165
  order
166
166
  end
167
167
 
168
+ def update_submit_fees_and_order!
169
+ build_submit_fees_and_order(force: true)
170
+ save!
171
+ end
172
+
168
173
  # Should be indempotent.
169
- def build_submit_fees_and_order
170
- return false if was_submitted?
174
+ def build_submit_fees_and_order(force: false)
175
+ return false if was_submitted? && !force
171
176
 
172
177
  fees = find_or_build_submit_fees()
173
178
  raise('already has purchased submit fees') if Array(fees).any?(&:purchased?)
@@ -45,25 +45,6 @@ module EffectiveDeviseUser
45
45
  avatar_url :string
46
46
  end
47
47
 
48
- # Devise invitable ignores model validations, so we manually check for duplicate email addresses.
49
- before_save(if: -> { new_record? && try(:invitation_sent_at).present? }) do
50
- if email.blank?
51
- errors.add(:email, "can't be blank")
52
- raise("email can't be blank")
53
- end
54
-
55
- value = email.strip.downcase
56
-
57
- if self.class.where(email: value).present?
58
- errors.add(:email, 'has already been taken')
59
- raise("email has already been taken")
60
- end
61
-
62
- if respond_to?(:alternate_email) && self.class.where(alternate_email: value).present?
63
- errors.add(:email, 'has already been taken')
64
- raise("email has already been taken")
65
- end
66
- end
67
48
 
68
49
  # Clear the provider if an oauth signed in user resets password
69
50
  before_save(if: -> { persisted? && encrypted_password_changed? }) do
@@ -245,6 +226,30 @@ module EffectiveDeviseUser
245
226
  super(value.to_s.strip.downcase.presence)
246
227
  end
247
228
 
229
+ # Devise invitable ignores model validations, so we manually check for duplicate email addresses.
230
+ def invite!(invited_by = nil, options = {})
231
+ if new_record?
232
+ value = email.to_s.strip.downcase
233
+
234
+ if value.blank?
235
+ errors.add(:email, "can't be blank")
236
+ return false
237
+ end
238
+
239
+ if self.class.where(email: value).present?
240
+ errors.add(:email, 'has already been taken')
241
+ return false
242
+ end
243
+
244
+ if respond_to?(:alternate_email) && self.class.where(alternate_email: value).present?
245
+ errors.add(:email, 'has already been taken')
246
+ return false
247
+ end
248
+ end
249
+
250
+ super
251
+ end
252
+
248
253
  def reinvite!
249
254
  invite!
250
255
  end
@@ -258,6 +263,13 @@ module EffectiveDeviseUser
258
263
  false
259
264
  end
260
265
 
266
+ # This allows the Sign Up form to work for existing users with a pending invitation
267
+ # It assigns the attributes from the sign_up_params, saves the user, accepts the invitation
268
+ # Note that this action skips the invitation_token validation and is therefore insecure.
269
+ def allow_sign_up_from_invitation?
270
+ true
271
+ end
272
+
261
273
  def inactive_message
262
274
  (respond_to?(:archived?) && archived?) ? :archived : super
263
275
  end
@@ -1,3 +1,3 @@
1
1
  module EffectiveResources
2
- VERSION = '2.22.0'.freeze
2
+ VERSION = '2.22.2'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: effective_resources
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.22.0
4
+ version: 2.22.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Code and Effect
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-05-29 00:00:00.000000000 Z
11
+ date: 2024-06-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails