Skip to content

Commit

Permalink
Solve updating mail notification values on sqlite, too much users fro…
Browse files Browse the repository at this point in the history
…m Project#notified_users. #6541

Contributed by Felix Schäfer
  • Loading branch information
thegcat committed Sep 30, 2010
1 parent d06a1a7 commit ea2642f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions app/models/project.rb
Original file line number Diff line number Diff line change
Expand Up @@ -382,12 +382,12 @@ def assignable_users

# Returns the mail adresses of users that should be always notified on project events
def recipients
members.select {|m| m.mail_notification? || m.user.mail_notification == 'all'}.collect {|m| m.user.mail}
notified_users.collect {|u| u.mail}
end

# Returns the users that should be notified on project events
def notified_users
members.select {|m| m.mail_notification? || m.user.mail_notification?}.collect {|m| m.user}
members.select {|m| m.mail_notification? || m.user.mail_notification == 'all'}.collect {|m| m.user}
end

# Returns an array of all custom fields enabled for project issues
Expand Down
4 changes: 2 additions & 2 deletions db/migrate/20100129193813_update_mail_notification_values.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Patch the data from a boolean change.
class UpdateMailNotificationValues < ActiveRecord::Migration
def self.up
User.update_all("mail_notification = 'all'", "mail_notification = '1'")
User.update_all("mail_notification = 'only_my_events'", "mail_notification = '0'")
User.update_all("mail_notification = 'all'", "mail_notification IN ('1', 't')")
User.update_all("mail_notification = 'only_my_events'", "mail_notification IN ('0', 'f')")
end

def self.down
Expand Down

0 comments on commit ea2642f

Please sign in to comment.