summaryrefslogtreecommitdiff
path: root/app/models/namespace.rb
diff options
context:
space:
mode:
authorDouglas Barbosa Alexandre <dbalexandre@gmail.com>2019-08-15 17:37:36 +0000
committerDouglas Barbosa Alexandre <dbalexandre@gmail.com>2019-08-15 17:37:36 +0000
commit1985bafe2be33f03bccefaadfa9173fca49c33b9 (patch)
tree896dc6ef08d8347e992365594ce7c4b0d49e6ee4 /app/models/namespace.rb
parent23754943a7ec119f123694a93c79fc07c32b7ba5 (diff)
parent3489dc3d7277bf478f68e1b3e0353b702f652acc (diff)
downloadgitlab-ce-1985bafe2be33f03bccefaadfa9173fca49c33b9.tar.gz
Merge branch '50020-allow-email-notifications-to-be-disabled-for-all-users-of-a-group' into 'master'
Allow email notifications to be disabled for all users of a group See merge request gitlab-org/gitlab-ce!30755
Diffstat (limited to 'app/models/namespace.rb')
-rw-r--r--app/models/namespace.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/app/models/namespace.rb b/app/models/namespace.rb
index 058350b16ce..9f9c4288667 100644
--- a/app/models/namespace.rb
+++ b/app/models/namespace.rb
@@ -172,6 +172,13 @@ class Namespace < ApplicationRecord
end
end
+ # any ancestor can disable emails for all descendants
+ def emails_disabled?
+ strong_memoize(:emails_disabled) do
+ Feature.enabled?(:emails_disabled, self, default_enabled: true) && self_and_ancestors.where(emails_disabled: true).exists?
+ end
+ end
+
def lfs_enabled?
# User namespace will always default to the global setting
Gitlab.config.lfs.enabled