diff lib/tasks/email.rake @ 1464:261b3d9a4903 redmine-2.4

Update to Redmine 2.4 branch rev 12663
author Chris Cannam
date Tue, 14 Jan 2014 14:37:42 +0000
parents 433d4f72a19b
children e248c7af89ec
line wrap: on
line diff
--- a/lib/tasks/email.rake	Fri Jun 14 09:05:06 2013 +0100
+++ b/lib/tasks/email.rake	Tue Jan 14 14:37:42 2014 +0000
@@ -1,5 +1,5 @@
 # Redmine - project management software
-# Copyright (C) 2006-2012  Jean-Philippe Lang
+# Copyright (C) 2006-2013  Jean-Philippe Lang
 #
 # This program is free software; you can redistribute it and/or
 # modify it under the terms of the GNU General Public License
@@ -29,6 +29,8 @@
                            create: create a user account
   no_permission_check=1    disable permission checking when receiving
                            the email
+  no_account_notice=1      disable new user account notification
+  default_group=foo,bar    adds created user to foo and bar groups
 
 Issue attributes control options:
   project=PROJECT          identifier of the target project
@@ -53,13 +55,7 @@
 END_DESC
 
     task :read => :environment do
-      options = { :issue => {} }
-      %w(project status tracker category priority).each { |a| options[:issue][a.to_sym] = ENV[a] if ENV[a] }
-      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']
-
-      MailHandler.receive(STDIN.read, options)
+      MailHandler.receive(STDIN.read, MailHandler.extract_options_from_env(ENV))
     end
 
     desc <<-END_DESC
@@ -73,6 +69,8 @@
                            create: create a user account
   no_permission_check=1    disable permission checking when receiving
                            the email
+  no_account_notice=1      disable new user account notification
+  default_group=foo,bar    adds created user to foo and bar groups
 
 Available IMAP options:
   host=HOST                IMAP server host (default: 127.0.0.1)
@@ -124,13 +122,7 @@
                       :move_on_success => ENV['move_on_success'],
                       :move_on_failure => ENV['move_on_failure']}
 
-      options = { :issue => {} }
-      %w(project status tracker category priority).each { |a| options[:issue][a.to_sym] = ENV[a] if ENV[a] }
-      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']
-
-      Redmine::IMAP.check(imap_options, options)
+      Redmine::IMAP.check(imap_options, MailHandler.extract_options_from_env(ENV))
     end
 
     desc <<-END_DESC
@@ -157,13 +149,7 @@
                       :password => ENV['password'],
                       :delete_unprocessed => ENV['delete_unprocessed']}
 
-      options = { :issue => {} }
-      %w(project status tracker category priority).each { |a| options[:issue][a.to_sym] = ENV[a] if ENV[a] }
-      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']
-
-      Redmine::POP3.check(pop_options, options)
+      Redmine::POP3.check(pop_options, MailHandler.extract_options_from_env(ENV))
     end
 
     desc "Send a test email to the user with the provided login name"