diff options
author | Eric Davis <edavis@littlestreamsoftware.com> | 2010-09-28 22:13:11 +0000 |
---|---|---|
committer | Eric Davis <edavis@littlestreamsoftware.com> | 2010-09-28 22:13:11 +0000 |
commit | 747b9ec5683ff8ae96f96c09ea709376db50b910 (patch) | |
tree | 575d698b120dbb947fa907e1230e5d5309efa3f6 /app/models/user.rb | |
parent | 437690119b0b1bd462d45f2367c1fe805e529972 (diff) | |
download | redmine-747b9ec5683ff8ae96f96c09ea709376db50b910.tar.gz redmine-747b9ec5683ff8ae96f96c09ea709376db50b910.zip |
Refactor: move method to model
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4224 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/user.rb')
-rw-r--r-- | app/models/user.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/app/models/user.rb b/app/models/user.rb index 481c832b4..638e5f7bd 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -259,6 +259,17 @@ 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 + # Note that @user.membership.size would fail since AR ignores + # :include association option when doing a count + if memberships.length < 1 + MAIL_NOTIFICATION_OPTIONS.delete_if {|option| option.first == :selected} + else + MAIL_NOTIFICATION_OPTIONS + end + end + # Find a user account by matching the exact login and then a case-insensitive # version. Exact matches will be given priority. def self.find_by_login(login) |