Commit 27941096d4b182d6d1871e4042fdc42c7007367e
Committed by
Gabriel Silva
1 parent
7d225e95
Exists in
stable-spb-1.3-fixes
Fixes bug on forum topic creation
Closes #167 - When a topic is created in a forum, the parent_id was not being set. Signed-off-by: Tallys Martins <tallysmartins@yahoo.com.br> (cherry picked from commit d85c8a1fe1417e6fd2d8733d5877bb21de2d7526)
Showing
1 changed file
with
2 additions
and
1 deletions
Show diff stats
app/controllers/my_profile/cms_controller.rb
... | ... | @@ -32,7 +32,8 @@ class CmsController < MyProfileController |
32 | 32 | end |
33 | 33 | |
34 | 34 | protect_if :only => [:new, :upload_files] do |c, user, profile| |
35 | - parent = profile.articles.find_by_id(c.params[:parent_id]) | |
35 | + parent_id = c.params[:article].present? ? c.params[:article][:parent_id] : c.params[:parent_id] | |
36 | + parent = profile.articles.find_by_id(parent_id) | |
36 | 37 | user && user.can_post_content?(profile, parent) |
37 | 38 | end |
38 | 39 | ... | ... |