From 6e5f56734653b9e6e563b299ff1d20ce6ffcf036 Mon Sep 17 00:00:00 2001 From: Eric Davis Date: Thu, 19 Aug 2010 04:33:29 +0000 Subject: [PATCH] Merged r3938 from trunk. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/1.0-stable@3988 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/controllers/application_controller.rb | 18 +++++++++++++++++- app/controllers/issue_moves_controller.rb | 17 ----------------- app/controllers/issues_controller.rb | 16 ---------------- 3 files changed, 17 insertions(+), 34 deletions(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index c00b6ba42..3e482cf4b 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -201,7 +201,23 @@ class ApplicationController < ActionController::Base def self.model_object(model) write_inheritable_attribute('model_object', model) end - + + # Filter for bulk issue operations + def find_issues + @issues = Issue.find_all_by_id(params[:id] || params[:ids]) + raise ActiveRecord::RecordNotFound if @issues.empty? + projects = @issues.collect(&:project).compact.uniq + if projects.size == 1 + @project = projects.first + else + # TODO: let users bulk edit/move/destroy issues from different projects + render_error 'Can not bulk edit/move/destroy issues from different projects' + return false + end + rescue ActiveRecord::RecordNotFound + render_404 + end + # make sure that the user is a member of the project (or admin) if project is private # used as a before_filter for actions that do not require any particular permission on the project def check_project_privacy diff --git a/app/controllers/issue_moves_controller.rb b/app/controllers/issue_moves_controller.rb index 1999930df..37068fad5 100644 --- a/app/controllers/issue_moves_controller.rb +++ b/app/controllers/issue_moves_controller.rb @@ -52,23 +52,6 @@ class IssueMovesController < ApplicationController @available_statuses = Workflow.available_statuses(@project) end - # Filter for bulk operations - # TODO: duplicated in IssuesController - def find_issues - @issues = Issue.find_all_by_id(params[:id] || params[:ids]) - raise ActiveRecord::RecordNotFound if @issues.empty? - projects = @issues.collect(&:project).compact.uniq - if projects.size == 1 - @project = projects.first - else - # TODO: let users bulk edit/move/destroy issues from different projects - render_error 'Can not bulk edit/move/destroy issues from different projects' - return false - end - rescue ActiveRecord::RecordNotFound - render_404 - end - # TODO: duplicated in IssuesController def set_flash_from_bulk_issue_save(issues, unsaved_issue_ids) if unsaved_issue_ids.empty? diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb index 50a6f08e7..e05d19390 100644 --- a/app/controllers/issues_controller.rb +++ b/app/controllers/issues_controller.rb @@ -359,22 +359,6 @@ private render_404 end - # Filter for bulk operations - def find_issues - @issues = Issue.find_all_by_id(params[:id] || params[:ids]) - raise ActiveRecord::RecordNotFound if @issues.empty? - projects = @issues.collect(&:project).compact.uniq - if projects.size == 1 - @project = projects.first - else - # TODO: let users bulk edit/move/destroy issues from different projects - render_error 'Can not bulk edit/move/destroy issues from different projects' - return false - end - rescue ActiveRecord::RecordNotFound - render_404 - end - def find_project project_id = (params[:issue] && params[:issue][:project_id]) || params[:project_id] @project = Project.find(project_id)