Mail notification options restored (default is: issue_added and issue_updated).

Added mail notification when adding a news (disabled by default).

git-svn-id: http://redmine.rubyforge.org/svn/trunk@728 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang committed 2007-09-14 15:30:46 +00:00
1 parent 1fa1f62018
commit 23264ec3eb
10 files changed
+65 -15

No files matched your search

+8
View File
@@ -90,6 +90,14 @@ class Mailer < ActionMailer::Base
@body['url'] = url
@body['added_to'] = added_to
end
def news_added(news)
set_language_if_valid(Setting.default_language)
@recipients = news.project.users.collect { |u| u.mail if u.mail_notification }.compact
@from = Setting.mail_from
@subject = "[#{news.project.name}] #{l(:label_news)}: #{news.title}"
@body['news'] = news
end
def lost_password(token)
set_language_if_valid(token.user.language)
+1 -1
View File
@@ -22,6 +22,6 @@ class MessageObserver < ActiveRecord::Observer
# send notification to the board watchers
recipients += message.board.watcher_recipients
recipients = recipients.compact.uniq
Mailer.deliver_message_posted(message, recipients) unless recipients.empty?
Mailer.deliver_message_posted(message, recipients) if !recipients.empty? && Setting.notified_events.include?('message_posted')
end
end
+14 -7
View File
@@ -27,16 +27,23 @@ class Setting < ActiveRecord::Base
# Hash used to cache setting values
@cached_settings = {}
@cached_cleared_on = Time.now
# Returns the value of the setting named name
def self.[](name)
value = @cached_settings[name]
value ? value : (@cached_settings[name] = find_or_default(name).value)
def value
v = read_attribute(:value)
# Unserialize serialized settings
v = YAML::load(v) if @@available_settings[name]['serialized'] && v.is_a?(String)
v
end
def self.[]=(name, value)
# Returns the value of the setting named name
def self.[](name)
v = @cached_settings[name]
v ? v : (@cached_settings[name] = find_or_default(name).value)
end
def self.[]=(name, v)
setting = find_or_default(name)
setting.value = (value ? value.to_s : "")
setting.value = (v ? v : "")
@cached_settings[name] = nil
setting.save
setting.value