Commit 19be5f1ae7cd1b6bda3b8e7c5fb5e699710a0cea
Committed by
Antonio Terceiro
1 parent
e3b74f50
Exists in
master
and in
29 other branches
Fixing problem of duplicated comments when hitting reload
(ActionItem1791)
Showing
2 changed files
with
8 additions
and
0 deletions
Show diff stats
app/controllers/public/content_viewer_controller.rb
... | ... | @@ -114,6 +114,7 @@ class ContentViewerController < ApplicationController |
114 | 114 | if @comment.save |
115 | 115 | @page.touch |
116 | 116 | @comment = nil # clear the comment form |
117 | + redirect_to :action => 'view_page', :profile => params[:profile], :page => @page.explode_path, :view => params[:view] | |
117 | 118 | else |
118 | 119 | @form_div = 'opened' |
119 | 120 | end | ... | ... |
test/functional/content_viewer_controller_test.rb
... | ... | @@ -1238,4 +1238,11 @@ class ContentViewerControllerTest < Test::Unit::TestCase |
1238 | 1238 | assert_equal [es_article], assigns(:posts) |
1239 | 1239 | end |
1240 | 1240 | |
1241 | + should 'be redirect after posting a comment' do | |
1242 | + login_as @profile.identifier | |
1243 | + page = profile.articles.create!(:name => 'myarticle', :body => 'the body of the text') | |
1244 | + post :view_page, :profile => @profile.identifier, :page => [ 'myarticle' ], :comment => { :title => 'title', :body => 'body' }, :confirm => 'true' | |
1245 | + assert_redirected_to :profile => @profile.identifier, :page => page.explode_path | |
1246 | + end | |
1247 | + | |
1241 | 1248 | end | ... | ... |