redirect_to :controller => 'admin', :action => 'projects'
end
else
- @project = Project.new(params[:project])
- @project.enabled_module_names = params[:enabled_modules]
- if validate_parent_id && @project.copy(@source_project, :only => params[:only])
- @project.set_allowed_parent!(params[:project]['parent_id']) if params[:project].has_key?('parent_id')
- flash[:notice] = l(:notice_successful_create)
- redirect_to :controller => 'admin', :action => 'projects'
- elsif !@project.new_record?
- # Project was created
- # But some objects were not copied due to validation failures
- # (eg. issues from disabled trackers)
- # TODO: inform about that
- redirect_to :controller => 'admin', :action => 'projects'
+ Mailer.with_deliveries(params[:notifications] == '1') do
+ @project = Project.new(params[:project])
+ @project.enabled_module_names = params[:enabled_modules]
+ if validate_parent_id && @project.copy(@source_project, :only => params[:only])
+ @project.set_allowed_parent!(params[:project]['parent_id']) if params[:project].has_key?('parent_id')
+ flash[:notice] = l(:notice_successful_create)
+ redirect_to :controller => 'admin', :action => 'projects'
+ elsif !@project.new_record?
+ # Project was created
+ # But some objects were not copied due to validation failures
+ # (eg. issues from disabled trackers)
+ # TODO: inform about that
+ redirect_to :controller => 'admin', :action => 'projects'
+ end
end
end
rescue ActiveRecord::RecordNotFound
deliver_reminder(assignee, issues, days) unless assignee.nil?
end
end
+
+ # Activates/desactivates email deliveries during +block+
+ def self.with_deliveries(enabled = true, &block)
+ was_enabled = ActionMailer::Base.perform_deliveries
+ ActionMailer::Base.perform_deliveries = !!enabled
+ yield
+ ensure
+ ActionMailer::Base.perform_deliveries = was_enabled
+ end
private
def initialize_defaults(method_name)
<label class="block"><%= check_box_tag 'only[]', 'boards', true %> <%= l(:label_board_plural) %> (<%= @source_project.boards.count %>)</label>
<label class="block"><%= check_box_tag 'only[]', 'wiki', true %> <%= l(:label_wiki_page_plural) %> (<%= @source_project.wiki.nil? ? 0 : @source_project.wiki.pages.count %>)</label>
<%= hidden_field_tag 'only[]', '' %>
+ <br />
+ <label class="block"><%= check_box_tag 'notifications', 1, params[:notifications] %> <%= l(:label_project_copy_notifications) %></label>
</fieldset>
<%= submit_tag l(:button_copy) %>
permission_export_wiki_pages: Export wiki pages
setting_cache_formatted_text: Cache formatted text
permission_manage_project_activities: Manage project activities
-
\ No newline at end of file
+ label_project_copy_notifications: Send email notifications during the project copy
permission_export_wiki_pages: Export wiki pages
setting_cache_formatted_text: Cache formatted text
permission_manage_project_activities: Manage project activities
+ label_project_copy_notifications: Send email notifications during the project copy
permission_export_wiki_pages: Export wiki pages
setting_cache_formatted_text: Cache formatted text
permission_manage_project_activities: Manage project activities
+ label_project_copy_notifications: Send email notifications during the project copy
permission_export_wiki_pages: Export wiki pages
setting_cache_formatted_text: Cache formatted text
permission_manage_project_activities: Manage project activities
+ label_project_copy_notifications: Send email notifications during the project copy
permission_export_wiki_pages: Export wiki pages
setting_cache_formatted_text: Cache formatted text
permission_manage_project_activities: Manage project activities
+ label_project_copy_notifications: Send email notifications during the project copy
permission_export_wiki_pages: Export wiki pages
setting_cache_formatted_text: Cache formatted text
permission_manage_project_activities: Manage project activities
+ label_project_copy_notifications: Send email notifications during the project copy
permission_export_wiki_pages: Export wiki pages
setting_cache_formatted_text: Cache formatted text
permission_manage_project_activities: Manage project activities
+ label_project_copy_notifications: Send email notifications during the project copy
label_api_access_key: API access key
label_missing_api_access_key: Missing an API access key
label_api_access_key_created_on: "API access key created {{value}} ago"
+ label_project_copy_notifications: Send email notifications during the project copy
button_login: Login
button_submit: Submit
permission_export_wiki_pages: Export wiki pages
setting_cache_formatted_text: Cache formatted text
permission_manage_project_activities: Manage project activities
+ label_project_copy_notifications: Send email notifications during the project copy
permission_export_wiki_pages: Export wiki pages
setting_cache_formatted_text: Cache formatted text
permission_manage_project_activities: Manage project activities
+ label_project_copy_notifications: Send email notifications during the project copy
label_missing_feeds_access_key: Clé d'accès RSS manquante
label_close_versions: Fermer les versions terminées
label_revision_id: Revision {{value}}
+ label_project_copy_notifications: Envoyer les notifications durant la copie du projet
button_login: Connexion
button_submit: Soumettre
permission_export_wiki_pages: Export wiki pages
setting_cache_formatted_text: Cache formatted text
permission_manage_project_activities: Manage project activities
+ label_project_copy_notifications: Send email notifications during the project copy
permission_export_wiki_pages: Export wiki pages
setting_cache_formatted_text: Cache formatted text
permission_manage_project_activities: Manage project activities
+ label_project_copy_notifications: Send email notifications during the project copy
permission_export_wiki_pages: Export wiki pages
setting_cache_formatted_text: Cache formatted text
permission_manage_project_activities: Manage project activities
+ label_project_copy_notifications: Send email notifications during the project copy
permission_export_wiki_pages: Export wiki pages
setting_cache_formatted_text: Cache formatted text
permission_manage_project_activities: Manage project activities
+ label_project_copy_notifications: Send email notifications during the project copy
permission_export_wiki_pages: Export wiki pages
setting_cache_formatted_text: Cache formatted text
permission_manage_project_activities: Manage project activities
+ label_project_copy_notifications: Send email notifications during the project copy
permission_export_wiki_pages: Export wiki pages
setting_cache_formatted_text: Cache formatted text
permission_manage_project_activities: Manage project activities
-
\ No newline at end of file
+ label_project_copy_notifications: Send email notifications during the project copy
enumeration_activities: 作業分類 (時間トラッキング)
enumeration_system_activity: システム作業分類
permission_manage_project_activities: Manage project activities
+ label_project_copy_notifications: Send email notifications during the project copy
permission_export_wiki_pages: Export wiki pages
setting_cache_formatted_text: Cache formatted text
permission_manage_project_activities: Manage project activities
+ label_project_copy_notifications: Send email notifications during the project copy
permission_export_wiki_pages: Export wiki pages
setting_cache_formatted_text: Cache formatted text
permission_manage_project_activities: Manage project activities
+ label_project_copy_notifications: Send email notifications during the project copy
permission_export_wiki_pages: Export wiki pages
setting_cache_formatted_text: Cache formatted text
permission_manage_project_activities: Manage project activities
+ label_project_copy_notifications: Send email notifications during the project copy
permission_export_wiki_pages: Export wiki pages
setting_cache_formatted_text: Cache formatted text
permission_manage_project_activities: Manage project activities
+ label_project_copy_notifications: Send email notifications during the project copy
permission_export_wiki_pages: Eksport stron wiki
permission_manage_project_activities: Zarządzanie aktywnościami projektu
setting_cache_formatted_text: Cache formatted text
+ label_project_copy_notifications: Send email notifications during the project copy
permission_export_wiki_pages: Export wiki pages
setting_cache_formatted_text: Cache formatted text
permission_manage_project_activities: Manage project activities
+ label_project_copy_notifications: Send email notifications during the project copy
permission_export_wiki_pages: Export wiki pages
setting_cache_formatted_text: Cache formatted text
permission_manage_project_activities: Manage project activities
+ label_project_copy_notifications: Send email notifications during the project copy
permission_export_wiki_pages: Export wiki pages
setting_cache_formatted_text: Cache formatted text
permission_manage_project_activities: Manage project activities
+ label_project_copy_notifications: Send email notifications during the project copy
permission_export_wiki_pages: Export wiki pages
setting_cache_formatted_text: Cache formatted text
permission_manage_project_activities: Manage project activities
+ label_project_copy_notifications: Send email notifications during the project copy
permission_export_wiki_pages: Export wiki pages
setting_cache_formatted_text: Cache formatted text
permission_manage_project_activities: Manage project activities
+ label_project_copy_notifications: Send email notifications during the project copy
permission_export_wiki_pages: Export wiki pages
setting_cache_formatted_text: Cache formatted text
permission_manage_project_activities: Manage project activities
+ label_project_copy_notifications: Send email notifications during the project copy
permission_export_wiki_pages: Export wiki pages
setting_cache_formatted_text: Cache formatted text
permission_manage_project_activities: Manage project activities
+ label_project_copy_notifications: Send email notifications during the project copy
permission_export_wiki_pages: Export wiki pages
setting_cache_formatted_text: Cache formatted text
permission_manage_project_activities: Manage project activities
+ label_project_copy_notifications: Send email notifications during the project copy
permission_export_wiki_pages: Export wiki pages
setting_cache_formatted_text: Cache formatted text
permission_manage_project_activities: Manage project activities
+ label_project_copy_notifications: Send email notifications during the project copy
permission_export_wiki_pages: Export wiki pages
setting_cache_formatted_text: Cache formatted text
permission_manage_project_activities: Manage project activities
+ label_project_copy_notifications: Send email notifications during the project copy
permission_export_wiki_pages: Export wiki pages
setting_cache_formatted_text: Cache formatted text
permission_manage_project_activities: Manage project activities
+ label_project_copy_notifications: Send email notifications during the project copy
permission_export_wiki_pages: Export wiki pages
setting_cache_formatted_text: Cache formatted text
permission_manage_project_activities: Manage project activities
+ label_project_copy_notifications: Send email notifications during the project copy
permission_export_wiki_pages: Export wiki pages
setting_cache_formatted_text: Cache formatted text
permission_manage_project_activities: Manage project activities
+ label_project_copy_notifications: Send email notifications during the project copy
permission_export_wiki_pages: Export wiki pages
setting_cache_formatted_text: Cache formatted text
permission_manage_project_activities: Manage project activities
-
\ No newline at end of file
+ label_project_copy_notifications: Send email notifications during the project copy
include Redmine::I18n
include ActionController::Assertions::SelectorAssertions
fixtures :projects, :enabled_modules, :issues, :users, :members, :member_roles, :roles, :documents, :attachments, :news, :tokens, :journals, :journal_details, :changesets, :trackers, :issue_statuses, :enumerations, :messages, :boards, :repositories
+
+ def setup
+ ActionMailer::Base.deliveries.clear
+ Setting.host_name = 'mydomain.foo'
+ Setting.protocol = 'http'
+ end
def test_generated_links_in_emails
ActionMailer::Base.deliveries.clear
end
end
+ def test_test
+ user = User.find(1)
+ valid_languages.each do |lang|
+ user.update_attribute :language, lang.to_s
+ assert Mailer.deliver_test(user)
+ end
+ end
+
def test_reminders
ActionMailer::Base.deliveries.clear
Mailer.reminders(:days => 42)
assert_equal :it, current_language
end
+
+ def test_with_deliveries_off
+ Mailer.with_deliveries false do
+ Mailer.deliver_test(User.find(1))
+ end
+ assert ActionMailer::Base.deliveries.empty?
+ # should restore perform_deliveries
+ assert ActionMailer::Base.perform_deliveries
+ end
end