Commit e205320fe50ed74568c2098cc980dfea9286dcc9
1 parent
c2991869
Exists in
master
and in
11 other branches
proposals_discussion: allow creation of discussion with a parent
Showing
2 changed files
with
1 additions
and
7 deletions
Show diff stats
lib/proposals_discussion_plugin.rb
| @@ -17,7 +17,7 @@ class ProposalsDiscussionPlugin < Noosfero::Plugin | @@ -17,7 +17,7 @@ class ProposalsDiscussionPlugin < Noosfero::Plugin | ||
| 17 | types = [] | 17 | types = [] |
| 18 | parent_id = context.params[:parent_id] | 18 | parent_id = context.params[:parent_id] |
| 19 | parent = parent_id ? context.profile.articles.find(parent_id) : nil | 19 | parent = parent_id ? context.profile.articles.find(parent_id) : nil |
| 20 | - types << ProposalsDiscussionPlugin::Discussion unless parent | 20 | + types << ProposalsDiscussionPlugin::Discussion |
| 21 | types << ProposalsDiscussionPlugin::Topic if parent.kind_of?(ProposalsDiscussionPlugin::Discussion) | 21 | types << ProposalsDiscussionPlugin::Topic if parent.kind_of?(ProposalsDiscussionPlugin::Discussion) |
| 22 | types << ProposalsDiscussionPlugin::Proposal if parent.kind_of?(ProposalsDiscussionPlugin::Topic) | 22 | types << ProposalsDiscussionPlugin::Proposal if parent.kind_of?(ProposalsDiscussionPlugin::Topic) |
| 23 | types | 23 | types |
test/unit/proposals_discussion_plugin_test.rb
| @@ -20,12 +20,6 @@ class ProposalsDiscussionPluginTest < ActiveSupport::TestCase | @@ -20,12 +20,6 @@ class ProposalsDiscussionPluginTest < ActiveSupport::TestCase | ||
| 20 | assert_includes plugin.content_types, ProposalsDiscussionPlugin::Discussion | 20 | assert_includes plugin.content_types, ProposalsDiscussionPlugin::Discussion |
| 21 | end | 21 | end |
| 22 | 22 | ||
| 23 | - should 'do not return Discussion as a content type if it has a parent' do | ||
| 24 | - parent = fast_create(Folder, :profile_id => @profile.id) | ||
| 25 | - @params[:parent_id] = parent.id | ||
| 26 | - assert_not_includes plugin.content_types, ProposalsDiscussionPlugin::Discussion | ||
| 27 | - end | ||
| 28 | - | ||
| 29 | should 'return Topic as a content type if parent is a Discussion' do | 23 | should 'return Topic as a content type if parent is a Discussion' do |
| 30 | parent = fast_create(ProposalsDiscussionPlugin::Discussion, :profile_id => @profile.id) | 24 | parent = fast_create(ProposalsDiscussionPlugin::Discussion, :profile_id => @profile.id) |
| 31 | @params[:parent_id] = parent.id | 25 | @params[:parent_id] = parent.id |