effective_memberships 0.9.12 → 0.9.14

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: 15f5e9cd43c2d3b621ed97fc489d5788b4229429413ceabba43f37db3ebf1970
4
- data.tar.gz: f689fa7f2eff3da54e3561bf805321025362a066665cfd95aac22c1a14cae3bc
3
+ metadata.gz: 813c2bf0f2491dd88f28e0deb9b66353c5fce7e08bbd60facdcadc4df29f3c63
4
+ data.tar.gz: e856e0600b5e5943565509c20ad06e7a1da807546169b1058b9d5e7b784e3fb2
5
5
  SHA512:
6
- metadata.gz: f6968aa46d7af212a8e9442d2e36ec98effb38850245f1a4c2eb6623c640237339206a1e961dbf93b15e1f8c95788f2489a3ec0e233ef2b8bc278ec54a72311d
7
- data.tar.gz: 0c05c78a59022bcedc203b2060af8d9fdc03a7caeba3b6e981da447002d488fa49a2ae639e89dcad1af83b5804a3a95c56c0197e19acf9497b4a2cfac276be50
6
+ metadata.gz: 0a54c8464c3547b7040f987e06abaca0100c31d5ccd8e976c68fc432dce308ec555b3050cf618f58ac3d54e8fefa743cee91eb8134c400be05cc13a628d08603
7
+ data.tar.gz: 6e8363b016b80e3dfd3e9930586cb8bd57f957dcf0d11d0687b5f049445fb2c0964615a027f12fdb60982f7ab63318d4740b7d61a8ba6c692307a1b65baf9405
@@ -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
@@ -27,9 +27,11 @@ module Effective
27
27
  user.password ||= SecureRandom.base64(12) + '!@#123abcABC-'
28
28
  end
29
29
 
30
- after_commit(on: [:create, :destroy], if: -> { user.class.respond_to?(:effective_memberships_owner?) }) do
31
- user.representatives.reload
32
- user.update_member_role!
30
+ after_commit(on: [:create, :destroy], if: -> { user.class.respond_to?(:effective_memberships_owner?) && organization.class.respond_to?(:effective_memberships_owner?) }) do
31
+ if organization.membership_present?
32
+ user.representatives.reload
33
+ user.update_member_role!
34
+ end
33
35
  end
34
36
 
35
37
  validates :organization, presence: true
@@ -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
@@ -1,3 +1,3 @@
1
1
  module EffectiveMemberships
2
- VERSION = '0.9.12'
2
+ VERSION = '0.9.14'
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.12
4
+ version: 0.9.14
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-09 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