diff options
author | James Lopez <james@jameslopez.es> | 2018-11-16 18:09:32 +0300 |
---|---|---|
committer | Yorick Peterse <yorickpeterse@gmail.com> | 2019-01-31 18:52:50 +0300 |
commit | c653921b6f5b1d8b17fa33aa194117ea9446bf28 (patch) | |
tree | 9a57ea8157c19f7dc304e690ace12807beae48da /app/models/members/group_member.rb | |
parent | 645f7ee86b138de29245264fea32057bb6060a93 (diff) |
Add subresources removal to member destroy service
Diffstat (limited to 'app/models/members/group_member.rb')
-rw-r--r-- | app/models/members/group_member.rb | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/app/models/members/group_member.rb b/app/models/members/group_member.rb index fc49ee7ac8c..2c9e1ba1d80 100644 --- a/app/models/members/group_member.rb +++ b/app/models/members/group_member.rb @@ -12,6 +12,8 @@ class GroupMember < Member validates :source_type, format: { with: /\ANamespace\z/ } default_scope { where(source_type: SOURCE_TYPE) } + scope :in_groups, ->(groups) { where(source_id: groups.select(:id)) } + after_create :update_two_factor_requirement, unless: :invite? after_destroy :update_two_factor_requirement, unless: :invite? |