Patch #8009 » watchers.patch
| app/models/mail_handler.rb Fri Mar 25 13:36:42 2011 +0600 → app/models/mail_handler.rb Tue Mar 29 13:36:24 2011 +0700 | ||
|---|---|---|
|
@@handler_options[:allow_override] << 'project' unless @@handler_options[:issue].has_key?(:project)
|
||
|
# Status overridable by default
|
||
|
@@handler_options[:allow_override] << 'status' unless @@handler_options[:issue].has_key?(:status)
|
||
|
@@handler_options[:watchers] = @@handler_options[:watchers].split(',').collect(&:strip) if @@handler_options[:watchers].is_a?(String)
|
||
|
@@handler_options[:watchers] ||= []
|
||
|
|
||
|
@@handler_options[:no_permission_check] = (@@handler_options[:no_permission_check].to_s == '1' ? true : false)
|
||
|
super email
|
||
| ... | ... | |
|
# appropriate permission
|
||
|
def add_watchers(obj)
|
||
|
if user.allowed_to?("add_#{obj.class.name.underscore}_watchers".to_sym, obj.project)
|
||
|
addresses = [email.to, email.cc].flatten.compact.uniq.collect {|a| a.strip.downcase}
|
||
|
addresses = ([email.to, email.cc] + @@handler_options[:watchers]).flatten.compact.uniq.collect {|a| a.strip.downcase}
|
||
|
unless addresses.empty?
|
||
|
watchers = User.active.find(:all, :conditions => ['LOWER(mail) IN (?)', addresses])
|
||
|
watchers.each {|w| obj.add_watcher(w)}
|
||
| lib/tasks/email.rake Fri Mar 25 13:36:42 2011 +0600 → lib/tasks/email.rake Tue Mar 29 13:36:24 2011 +0700 | ||
|---|---|---|
|
allow_override=ATTRS allow email content to override attributes
|
||
|
specified by previous options
|
||
|
ATTRS is a comma separated list of attributes
|
||
|
watchers=WATCHERS comma separated list of watcher emails
|
||
|
Examples:
|
||
|
# No project specified. Emails MUST contain the 'Project' keyword:
|
||
| ... | ... | |
|
options[:allow_override] = ENV['allow_override'] if ENV['allow_override']
|
||
|
options[:unknown_user] = ENV['unknown_user'] if ENV['unknown_user']
|
||
|
options[:no_permission_check] = ENV['no_permission_check'] if ENV['no_permission_check']
|
||
|
options[:watchers] = ENV['watchers'] if ENV['watchers']
|
||
|
|
||
|
MailHandler.receive(STDIN.read, options)
|
||
|
end
|
||
| ... | ... | |
|
allow_override=ATTRS allow email content to override attributes
|
||
|
specified by previous options
|
||
|
ATTRS is a comma separated list of attributes
|
||
|
watchers=WATCHERS comma separated list of watcher emails
|
||
|
|
||
|
Processed emails control options:
|
||
|
move_on_success=MAILBOX move emails that were successfully received
|
||
| ... | ... | |
|
options[:allow_override] = ENV['allow_override'] if ENV['allow_override']
|
||
|
options[:unknown_user] = ENV['unknown_user'] if ENV['unknown_user']
|
||
|
options[:no_permission_check] = ENV['no_permission_check'] if ENV['no_permission_check']
|
||
|
options[:watchers] = ENV['watchers'] if ENV['watchers']
|
||
|
Redmine::IMAP.check(imap_options, options)
|
||
|
end
|
||
| ... | ... | |
|
options[:allow_override] = ENV['allow_override'] if ENV['allow_override']
|
||
|
options[:unknown_user] = ENV['unknown_user'] if ENV['unknown_user']
|
||
|
options[:no_permission_check] = ENV['no_permission_check'] if ENV['no_permission_check']
|
||
|
options[:watchers] = ENV['watchers'] if ENV['watchers']
|
||
|
|
||
|
Redmine::POP3.check(pop_options, options)
|
||
|
end
|
||