@@ -19,7 +19,7 class PreviewsController < ApplicationController | |||
|
19 | 19 | before_filter :find_project, :find_attachments |
|
20 | 20 | |
|
21 | 21 | def issue |
|
22 |
@issue = |
|
|
22 | @issue = Issue.visible.find_by_id(params[:id]) unless params[:id].blank? | |
|
23 | 23 | if @issue |
|
24 | 24 | @description = params[:issue] && params[:issue][:description] |
|
25 | 25 | if @description && @description.gsub(/(\r?\n|\n\r?)/, "\n") == @issue.description.to_s.gsub(/(\r?\n|\n\r?)/, "\n") |
@@ -45,7 +45,7 class PreviewsController < ApplicationController | |||
|
45 | 45 | |
|
46 | 46 | def find_project |
|
47 | 47 | project_id = (params[:issue] && params[:issue][:project_id]) || params[:project_id] |
|
48 | @project = Project.find(project_id) | |
|
48 | @project = Project.visible.find(project_id) | |
|
49 | 49 | rescue ActiveRecord::RecordNotFound |
|
50 | 50 | render_404 |
|
51 | 51 | end |
@@ -62,6 +62,14 class PreviewsControllerTest < ActionController::TestCase | |||
|
62 | 62 | assert_select 'a.attachment', :text => 'foo.bar' |
|
63 | 63 | end |
|
64 | 64 | |
|
65 | def test_preview_issue_with_project_changed | |
|
66 | @request.session[:user_id] = 2 | |
|
67 | post :issue, :project_id => '1', :id => 1, :issue => {:notes => 'notes', :project_id => 2} | |
|
68 | assert_response :success | |
|
69 | assert_not_nil assigns(:issue) | |
|
70 | assert_not_nil assigns(:notes) | |
|
71 | end | |
|
72 | ||
|
65 | 73 | def test_preview_new_news |
|
66 | 74 | get :news, :project_id => 1, |
|
67 | 75 | :news => {:title => '', |
General Comments 0
You need to be logged in to leave comments.
Login now