@@ -201,7 +201,23 class ApplicationController < ActionController::Base | |||
|
201 | 201 | def self.model_object(model) |
|
202 | 202 | write_inheritable_attribute('model_object', model) |
|
203 | 203 | end |
|
204 | ||
|
204 | ||
|
205 | # Filter for bulk issue operations | |
|
206 | def find_issues | |
|
207 | @issues = Issue.find_all_by_id(params[:id] || params[:ids]) | |
|
208 | raise ActiveRecord::RecordNotFound if @issues.empty? | |
|
209 | projects = @issues.collect(&:project).compact.uniq | |
|
210 | if projects.size == 1 | |
|
211 | @project = projects.first | |
|
212 | else | |
|
213 | # TODO: let users bulk edit/move/destroy issues from different projects | |
|
214 | render_error 'Can not bulk edit/move/destroy issues from different projects' | |
|
215 | return false | |
|
216 | end | |
|
217 | rescue ActiveRecord::RecordNotFound | |
|
218 | render_404 | |
|
219 | end | |
|
220 | ||
|
205 | 221 | # make sure that the user is a member of the project (or admin) if project is private |
|
206 | 222 | # used as a before_filter for actions that do not require any particular permission on the project |
|
207 | 223 | def check_project_privacy |
@@ -52,23 +52,6 class IssueMovesController < ApplicationController | |||
|
52 | 52 | @available_statuses = Workflow.available_statuses(@project) |
|
53 | 53 | end |
|
54 | 54 | |
|
55 | # Filter for bulk operations | |
|
56 | # TODO: duplicated in IssuesController | |
|
57 | def find_issues | |
|
58 | @issues = Issue.find_all_by_id(params[:id] || params[:ids]) | |
|
59 | raise ActiveRecord::RecordNotFound if @issues.empty? | |
|
60 | projects = @issues.collect(&:project).compact.uniq | |
|
61 | if projects.size == 1 | |
|
62 | @project = projects.first | |
|
63 | else | |
|
64 | # TODO: let users bulk edit/move/destroy issues from different projects | |
|
65 | render_error 'Can not bulk edit/move/destroy issues from different projects' | |
|
66 | return false | |
|
67 | end | |
|
68 | rescue ActiveRecord::RecordNotFound | |
|
69 | render_404 | |
|
70 | end | |
|
71 | ||
|
72 | 55 | # TODO: duplicated in IssuesController |
|
73 | 56 | def set_flash_from_bulk_issue_save(issues, unsaved_issue_ids) |
|
74 | 57 | if unsaved_issue_ids.empty? |
@@ -359,22 +359,6 private | |||
|
359 | 359 | render_404 |
|
360 | 360 | end |
|
361 | 361 | |
|
362 | # Filter for bulk operations | |
|
363 | def find_issues | |
|
364 | @issues = Issue.find_all_by_id(params[:id] || params[:ids]) | |
|
365 | raise ActiveRecord::RecordNotFound if @issues.empty? | |
|
366 | projects = @issues.collect(&:project).compact.uniq | |
|
367 | if projects.size == 1 | |
|
368 | @project = projects.first | |
|
369 | else | |
|
370 | # TODO: let users bulk edit/move/destroy issues from different projects | |
|
371 | render_error 'Can not bulk edit/move/destroy issues from different projects' | |
|
372 | return false | |
|
373 | end | |
|
374 | rescue ActiveRecord::RecordNotFound | |
|
375 | render_404 | |
|
376 | end | |
|
377 | ||
|
378 | 362 | def find_project |
|
379 | 363 | project_id = (params[:issue] && params[:issue][:project_id]) || params[:project_id] |
|
380 | 364 | @project = Project.find(project_id) |
General Comments 0
You need to be logged in to leave comments.
Login now