effective_memberships 0.9.13 → 0.9.15

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: b9433add3d7d0b17df72da4ff6041b5667d2d57361b58d1f0a33e6c58e9a75ed
4
- data.tar.gz: 68b962790a39557618f6b3f43bf79ad1d9416631b5bf7a48eba8296d68f9afc2
3
+ metadata.gz: e299db8cf3241529169d0f61a9524263dce1b1752fb04cbec395951ae7d1d029
4
+ data.tar.gz: e04637274efa4c3bffae73bbd27b62588ec3f6c74379050f51c58609f513bbc0
5
5
  SHA512:
6
- metadata.gz: 79784d64235015655ef74cb86025ea250b97984984b307508f7897d9800b48fae553fdcb7815d00a8332160ec2bd4d41667c89707ee1bd81871d181b3c5d8f29
7
- data.tar.gz: 8d2063383c55489ab29f5a2f2532c2086f0827affae2d52cb5e29a973ea1e26f21125cdb61a5b7c344a4b9896cb65151520239e6a7287bcff5bc32d86edd2dfa
6
+ metadata.gz: 9d01059e8b8e98c6c5ed0838a15a4b126a6d031cbaea7f76adb19146985f687514f5d518ca05bebbf6b9b3735739efd26c63a5d3a970097572d836cadb478c01
7
+ data.tar.gz: 00da75ee33edb063d76280cfb6bd1c771903ff24bdab9db0bf5c0ca06cc76e0998bd72313705ae0bf2ef90acf0c37dc4703b9fc5b3d15b34808f13606ccf38bc
@@ -607,7 +607,7 @@ module EffectiveMembershipsApplicant
607
607
  def can_apply_applicant_types_collection
608
608
  if owner.blank?
609
609
  ['Apply to Join']
610
- elsif owner.membership_removed?
610
+ elsif owner.membership_removed? && owner.reinstatement_membership_history.present?
611
611
  ['Apply for Reinstatement', 'Apply to Join']
612
612
  elsif owner.membership.blank? || owner.membership.categories.blank?
613
613
  ['Apply to Join']
@@ -144,11 +144,11 @@ module EffectiveMembershipsOwner
144
144
  end
145
145
 
146
146
  def reinstatement_membership_category
147
- reinstatement_membership_history.membership_categories.first if membership_removed?
147
+ reinstatement_membership_history&.membership_categories&.first
148
148
  end
149
149
 
150
150
  def reinstatement_membership_statuses
151
- reinstatement_membership_history.membership_statuses if membership_removed?
151
+ reinstatement_membership_history&.membership_statuses
152
152
  end
153
153
 
154
154
  def registrar_action_categories(action)
@@ -202,15 +202,14 @@ module EffectiveMembershipsRegistrar
202
202
 
203
203
  def reinstate!(owner, to: nil, date: nil, skip_fees: false)
204
204
  raise('expecting a memberships owner') unless owner.class.respond_to?(:effective_memberships_owner?)
205
- raise('owner must have a removed membership.') unless owner.membership_removed?
206
205
 
207
- history = owner.reinstatement_membership_history
208
- raise('owner must have a reinstatement membership history.') if history.blank?
206
+ history = owner.reinstatement_membership_history || owner.membership_histories.last
207
+ raise('owner must have a removed membership history or some kind of history.') if history.blank?
209
208
 
210
209
  to ||= owner.reinstatement_membership_category
211
210
  raise('expecting a to memberships category') unless to.class.respond_to?(:effective_memberships_category?)
212
211
 
213
- statuses = owner.reinstatement_membership_statuses
212
+ statuses = Array(owner.reinstatement_membership_statuses)
214
213
 
215
214
  # Default Date
216
215
  date ||= Time.zone.now
@@ -9,7 +9,7 @@
9
9
  %p
10
10
  - if applicant.owner.membership&.number_was.present?
11
11
  The member will keep their existing membership number: #{applicant.owner.membership.number}.
12
- - elsif applicant.reinstatement? && reinstatement.number.present?
12
+ - elsif applicant.reinstatement? && reinstatement&.number.present?
13
13
  The member will keep their previous membership number: #{reinstatement.number}.
14
14
  - else
15
15
  - number = EffectiveMemberships.Registrar.next_membership_number(applicant.owner, to: applicant.category)
@@ -19,7 +19,7 @@
19
19
  - else
20
20
  No membership number will be assigned.
21
21
 
22
- - if applicant.reinstatement?
22
+ - if applicant.reinstatement? && reinstatement.present?
23
23
  %p The member will be reinstated with their previous status: #{badges(reinstatement.membership_statuses) || 'None'}.
24
24
 
25
25
  %h3 Fees
@@ -35,6 +35,8 @@
35
35
 
36
36
  - if current_user.membership_removed?
37
37
  %p Your membership was removed on #{current_user.membership_removed_on.strftime('%F')}.
38
+
39
+ - if current_user.reinstatement_membership_history.present?
38
40
  %p You may Apply for Reinstatement to #{current_user.reinstatement_membership_category} by clicking the Apply to Join button below and then complete the wizard.
39
41
 
40
42
  - if membership_organizations.present?
@@ -1,3 +1,3 @@
1
1
  module EffectiveMemberships
2
- VERSION = '0.9.13'
2
+ VERSION = '0.9.15'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: effective_memberships
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.13
4
+ version: 0.9.15
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: 2023-01-12 00:00:00.000000000 Z
11
+ date: 2023-01-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails