##// END OF EJS Templates
Fixed that preview doesn't show notes when issue project is changed (#17959)....
Jean-Philippe Lang -
r13064:74cd72a2d969
parent child
Show More
@@ -19,7 +19,7 class PreviewsController < ApplicationController
19 before_filter :find_project, :find_attachments
19 before_filter :find_project, :find_attachments
20
20
21 def issue
21 def issue
22 @issue = @project.issues.find_by_id(params[:id]) unless params[:id].blank?
22 @issue = Issue.visible.find_by_id(params[:id]) unless params[:id].blank?
23 if @issue
23 if @issue
24 @description = params[:issue] && params[:issue][:description]
24 @description = params[:issue] && params[:issue][:description]
25 if @description && @description.gsub(/(\r?\n|\n\r?)/, "\n") == @issue.description.to_s.gsub(/(\r?\n|\n\r?)/, "\n")
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 def find_project
46 def find_project
47 project_id = (params[:issue] && params[:issue][:project_id]) || params[:project_id]
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 rescue ActiveRecord::RecordNotFound
49 rescue ActiveRecord::RecordNotFound
50 render_404
50 render_404
51 end
51 end
@@ -62,6 +62,14 class PreviewsControllerTest < ActionController::TestCase
62 assert_select 'a.attachment', :text => 'foo.bar'
62 assert_select 'a.attachment', :text => 'foo.bar'
63 end
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 def test_preview_new_news
73 def test_preview_new_news
66 get :news, :project_id => 1,
74 get :news, :project_id => 1,
67 :news => {:title => '',
75 :news => {:title => '',
General Comments 0
You need to be logged in to leave comments. Login now