@@ -213,16 +213,19 class ApplicationController < ActionController::Base | |||
|
213 | 213 | def find_issues |
|
214 | 214 | @issues = Issue.find_all_by_id(params[:id] || params[:ids]) |
|
215 | 215 | raise ActiveRecord::RecordNotFound if @issues.empty? |
|
216 | projects = @issues.collect(&:project).compact.uniq | |
|
217 | if projects.size == 1 | |
|
218 | @project = projects.first | |
|
219 | else | |
|
216 | @projects = @issues.collect(&:project).compact.uniq | |
|
217 | @project = @projects.first if @projects.size == 1 | |
|
218 | rescue ActiveRecord::RecordNotFound | |
|
219 | render_404 | |
|
220 | end | |
|
221 | ||
|
222 | # Check if project is unique before bulk operations | |
|
223 | def check_project_uniqueness | |
|
224 | unless @project | |
|
220 | 225 | # TODO: let users bulk edit/move/destroy issues from different projects |
|
221 | 226 | render_error 'Can not bulk edit/move/destroy issues from different projects' |
|
222 | 227 | return false |
|
223 | 228 | end |
|
224 | rescue ActiveRecord::RecordNotFound | |
|
225 | render_404 | |
|
226 | 229 | end |
|
227 | 230 | |
|
228 | 231 | # make sure that the user is a member of the project (or admin) if project is private |
@@ -1,6 +1,6 | |||
|
1 | 1 | class IssueMovesController < ApplicationController |
|
2 | 2 | default_search_scope :issues |
|
3 | before_filter :find_issues | |
|
3 | before_filter :find_issues, :check_project_uniqueness | |
|
4 | 4 | before_filter :authorize |
|
5 | 5 | |
|
6 | 6 | def new |
@@ -21,6 +21,7 class IssuesController < ApplicationController | |||
|
21 | 21 | |
|
22 | 22 | before_filter :find_issue, :only => [:show, :edit, :update] |
|
23 | 23 | before_filter :find_issues, :only => [:bulk_edit, :bulk_update, :move, :perform_move, :destroy] |
|
24 | before_filter :check_project_uniqueness, :only => [:bulk_edit, :bulk_update, :move, :perform_move, :destroy] | |
|
24 | 25 | before_filter :find_project, :only => [:new, :create] |
|
25 | 26 | before_filter :authorize, :except => [:index] |
|
26 | 27 | before_filter :find_optional_project, :only => [:index] |
General Comments 0
You need to be logged in to leave comments.
Login now