diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2011-01-16 15:36:42 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2011-01-16 15:36:42 +0000 |
commit | e17fadd07ac34f96a10a8b1e77b9ee06bc4149b2 (patch) | |
tree | 14642fe9523caed2bf41fcd5d1abda8cfef65ebb /app/models/user.rb | |
parent | e9f62d1209bfa81df33bcb390eb67ba4cab90c0a (diff) | |
download | redmine-e17fadd07ac34f96a10a8b1e77b9ee06bc4149b2.tar.gz redmine-e17fadd07ac34f96a10a8b1e77b9ee06bc4149b2.zip |
Do not show "for only project I select" notification option on application settings form (#7294).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4730 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/user.rb')
-rw-r--r-- | app/models/user.rb | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/app/models/user.rb b/app/models/user.rb index 5b107478d..3cc6b8e40 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -262,11 +262,15 @@ class User < Principal notified_projects_ids end - # Only users that belong to more than 1 project can select projects for which they are notified def valid_notification_options + self.class.valid_notification_options(self) + end + + # Only users that belong to more than 1 project can select projects for which they are notified + def self.valid_notification_options(user=nil) # Note that @user.membership.size would fail since AR ignores # :include association option when doing a count - if memberships.length < 1 + if user.nil? || user.memberships.length < 1 MAIL_NOTIFICATION_OPTIONS.reject {|option| option.first == 'selected'} else MAIL_NOTIFICATION_OPTIONS |