diff options
author | Michael Kozono <mkozono@gmail.com> | 2017-09-06 03:10:30 +0300 |
---|---|---|
committer | Michael Kozono <mkozono@gmail.com> | 2017-09-06 22:07:21 +0300 |
commit | a4b564b6200582b6d3700a5e77e0c11fc5cac011 (patch) | |
tree | 0916319c37ebdaaea9b74c95c99b733bfad5336a /app/models/namespace.rb | |
parent | f25b5b7f8db05ec441574429e024c71893fa7c11 (diff) |
Refactor based on code review
Diffstat (limited to 'app/models/namespace.rb')
-rw-r--r-- | app/models/namespace.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/app/models/namespace.rb b/app/models/namespace.rb index aeda829415a..4a9a23fea1f 100644 --- a/app/models/namespace.rb +++ b/app/models/namespace.rb @@ -46,7 +46,7 @@ class Namespace < ActiveRecord::Base before_create :sync_share_with_group_lock_with_parent before_update :sync_share_with_group_lock_with_parent, if: :parent_changed? - after_commit :force_share_with_group_lock_on_descendants, on: :update, if: -> { previous_changes.key?('share_with_group_lock') && share_with_group_lock? } + after_update :force_share_with_group_lock_on_descendants, if: -> { share_with_group_lock_changed? && share_with_group_lock? } # Legacy Storage specific hooks @@ -225,7 +225,7 @@ class Namespace < ActiveRecord::Base end def sync_share_with_group_lock_with_parent - if has_parent? && parent.share_with_group_lock? + if parent&.share_with_group_lock? self.share_with_group_lock = true end end |