Cannot activate discussions on Plone Agility types (folder)

I am working on a dexterity-based plon application. I created a couple of new types. This is what I did to activate comments on a certain type of agility content called "activity_report":

In the control panel Plone

In the Discussion section, I included the following:

  • globally include comments
  • enable anonymous comments

In the Types section, I selected the "Activity Report" type from the drop-down list and enabled the "Allow Comments" option.

In file system

In the FTI activityreport.xml file:

<property name="allow_discussion">True</property> 

I restarted the instance and even reinstalled the product, but I cannot activate the comment section in the agility type.

It should be noted that a standard type (for example, a page) can activate the discussion module.

Is there something I am missing?

+6
source share
4 answers

plone.app.discussion currently disables commenting for all containers (see https://dev.plone.org/ticket/11245 for a discussion).

I used the monkey patch, as shown below, in one project to shorten the normal check and make sure that commenting was turned on for my type of folder contents:

 from Acquisition import aq_inner from Products.highcountrynews.content.interfaces import IHCNNewsArticle from plone.app.discussion.conversation import Conversation old_enabled = Conversation.enabled def enabled(self): parent = aq_inner(self.__parent__) if parent.portal_type == 'my_portal_type': return True return old_enabled(self) Conversation.enabled = enabled 

where 'my_portal_type' is, of course, the portal_type parameter for which commenting is required.

+3
source

David's answer is incorrect. The class to be decontaminated is plone.app.discussion.browser.conversation.ConversationView:

 from Acquisition import aq_inner from plone.app.discussion.browser.conversation import ConversationView old_enabled = ConversationView.enabled def enabled(self): parent = aq_inner(self.__parent__) if parent.portal_type == 'My_type': return True return old_enabled(self) 

It works at least for Plone 4.2. However, thanks to David for the tip.

+2
source

As David and Victor have already pointed out, you can simply redefine the way you enable the conversation class. I would recommend using the following approach, which is slightly cleaner than a monkey correcting a conversation class:

https://github.com/plone/plone.app.discussion/blob/master/docs/source/howtos/howto_override_enable_conversation.txt

I also added dexterity type support for plone.app.discussion recently, so as soon as a new version comes up, you no longer need to set up a conversation class:

https://github.com/plone/plone.app.discussion/commit/0e587a7d8536125acdd3bd385e880b60d6aec28e

Please note that this method supports commenting on ON files. There is no support to enable / disable commenting on INSIDE objects in a folder.

If you want to enable / disable commenting with behavior / widgets:

https://github.com/plone/plone.app.dexterity/commit/0573df4f265a39da9efae44e605e3815729457d7

This, we hope, will do so in the next release of plone.app.dexterity.

+2
source

I decided in configure.zcml:

 <interface interface="Products.CMFPlone.interfaces.INonStructuralFolder" /> <class class="Products.PloneHelpCenter.types.Definition.HelpCenterDefinition"> <implements interface="Products.CMFPlone.interfaces.INonStructuralFolder" /> </class> 

UPDATE: this is not a good idea. I had problems with the lack of an “Add” menu for each type of content that has this fix.

+1
source

Source: https://habr.com/ru/post/914662/


All Articles