Commit f933ebfde75b0bd56dc2fc7056430a92739b0096
1 parent
a0b02c3d
Exists in
forum_topic_creation
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>
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,7 +32,8 @@ class CmsController < MyProfileController | ||
32 | end | 32 | end |
33 | 33 | ||
34 | protect_if :only => [:new, :upload_files] do |c, user, profile| | 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 | user && user.can_post_content?(profile, parent) | 37 | user && user.can_post_content?(profile, parent) |
37 | end | 38 | end |
38 | 39 |