Skip to content

Commit e08c5d8

Browse files
Merge pull request #244 from plone/maurits-globally-enable-comments
Globally enable comments on install
2 parents 9648d82 + 5129fb9 commit e08c5d8

File tree

5 files changed

+16
-39
lines changed

5 files changed

+16
-39
lines changed

news/211.breaking

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
Move this package in the space of Plone Core add-ons.
22
It now depends on Products.CMFPlone and is no longer installed by default.
33
It is still available in the default Plone distribution, but can be omitted in customizations.
4-
[jensens]
4+
Installing this in the Add-ons control panel will enable comments globally.
5+
[jensens]

plone/app/discussion/interfaces.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ class IDiscussionSettings(Interface):
216216
"objects before users will be able to post comments.",
217217
),
218218
required=False,
219-
default=False,
219+
default=True,
220220
)
221221

222222
anonymous_comments = schema.Bool(

plone/app/discussion/testing.py

-17
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
from plone.app.contenttypes.testing import PLONE_APP_CONTENTTYPES_FIXTURE
2-
from plone.app.discussion.interfaces import IDiscussionSettings
32
from plone.app.robotframework.testing import REMOTE_LIBRARY_ROBOT_TESTING
43
from plone.app.testing import applyProfile
54
from plone.app.testing import FunctionalTesting
@@ -8,17 +7,7 @@
87
from plone.app.testing import setRoles
98
from plone.app.testing import TEST_USER_ID
109
from plone.app.testing import TEST_USER_PASSWORD
11-
from plone.registry.interfaces import IRegistry
1210
from Products.CMFCore.utils import getToolByName
13-
from zope.component import queryUtility
14-
15-
16-
try:
17-
import plone.app.collection # noqa
18-
19-
COLLECTION_TYPE = "Collection"
20-
except ImportError:
21-
COLLECTION_TYPE = "Topic"
2211

2312

2413
class PloneAppDiscussion(PloneSandboxLayer):
@@ -105,12 +94,6 @@ class PloneAppDiscussionRobot(PloneAppDiscussion):
10594
REMOTE_LIBRARY_ROBOT_TESTING,
10695
)
10796

108-
def setUpPloneSite(self, portal):
109-
applyProfile(portal, "plone.app.discussion:default")
110-
registry = queryUtility(IRegistry)
111-
settings = registry.forInterface(IDiscussionSettings)
112-
settings.globally_enabled = True
113-
11497

11598
PLONE_APP_DISCUSSION_ROBOT_FIXTURE = PloneAppDiscussionRobot()
11699
PLONE_APP_DISCUSSION_FIXTURE = PloneAppDiscussion()

plone/app/discussion/tests/collection-integration-test.txt

+12-19
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ XXX: This functional test part has been removed due to the removal of
22
ATContentTypes from PLONE_FIXTURE. We have to rewrite this test as a robot
33
test because the dexterity collections do not work without js.
44

5+
XXX To put this more plainly: this file is currently NOT tested.
6+
57

68
List comments in a collection
79
-----------------------------
@@ -12,33 +14,24 @@ Create a collection.
1214
>>> from plone.app.testing import TEST_USER_NAME
1315
>>> setRoles(portal, 'manager', ['Manager'])
1416
>>> browser.open(portal.absolute_url())
15-
>>> from plone.app.discussion.testing import COLLECTION_TYPE
16-
>>> browser.getLink(url='++add++' + COLLECTION_TYPE).click()
17+
>>> browser.getLink(url='++add++Collection').click()
1718
>>> open('/tmp/testbrowser.html', 'w').write(browser.contents)
1819
>>> browser.getControl('form.widgets.IDublinCore.title').value = 'Foo Comment Collection'
1920
>>> browser.getControl('Save').click()
2021
>>> print(browser.contents)
2122
<...Changes saved...
22-
>>> topic_url = browser.url
23+
>>> collection_url = browser.url
2324

2425
Set the collection criteria.
2526

26-
>>> browser.open(topic_url + "/edit")
27+
>>> browser.open(collection_url + "/edit")
2728

28-
>>> if COLLECTION_TYPE == "Collection":
29-
... browser.getControl(name="addindex").value = ['portal_type']
30-
... browser.getControl(name="form.button.addcriteria").click()
31-
... browser.getControl(name="addoperator").value = ['plone.app.querystring.operation.selection.any']
32-
... browser.getControl(name="form.button.addcriteria").click()
33-
... browser.getControl(name="query.v:records:list").value = ["Discussion Item"]
34-
... browser.getControl(name="form.button.save").click()
35-
... else:
36-
... browser.getLink('Criteria').click()
37-
... browser.getControl('Item Type', index=0).selected = True
38-
... browser.getControl('Select content types').selected = True
39-
... browser.getControl('Add criteria').click()
40-
... browser.getControl('Comment').selected = True
41-
... browser.getControl('Save', index=0).click()
29+
>>> browser.getControl(name="addindex").value = ['portal_type']
30+
... browser.getControl(name="form.button.addcriteria").click()
31+
... browser.getControl(name="addoperator").value = ['plone.app.querystring.operation.selection.any']
32+
... browser.getControl(name="form.button.addcriteria").click()
33+
... browser.getControl(name="query.v:records:list").value = ["Discussion Item"]
34+
... browser.getControl(name="form.button.save").click()
4235
>>> print(browser.contents)
4336
<...Changes saved...
4437

@@ -71,7 +64,7 @@ Delete the commented content.
7164

7265
The comments are no longer in the catalog.
7366

74-
>>> browser.open(topic_url)
67+
>>> browser.open(collection_url)
7568
>>> browser.getLink('admin on Doc1', index=0)
7669
Traceback (most recent call last):
7770
LinkNotFoundError

plone/app/discussion/tests/test_controlpanel.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def test_globally_enabled(self):
4949
"plone.app.discussion.interfaces."
5050
+ "IDiscussionSettings.globally_enabled"
5151
],
52-
False,
52+
True,
5353
)
5454

5555
def test_anonymous_comments(self):

0 commit comments

Comments
 (0)