Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Turn this into a core addon #211

Merged
merged 38 commits into from
Sep 2, 2024
Merged
Show file tree
Hide file tree
Changes from 35 commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
a3f9160
Turn this into a core addon, sync with CMFPlone, make installable and…
jensens May 17, 2023
82328be
move behavior here
jensens Jun 6, 2023
ae0e9a1
tune behavior and install it
jensens Jun 6, 2023
b499f9b
fix behavior name usage
jensens Jun 6, 2023
6378dce
fix one test and finetuning
jensens Jun 6, 2023
798e2dc
fix after merge of master
jensens Jul 13, 2023
018689d
add change log
jensens Jul 14, 2023
1e74750
move check for 'Reply to item' permission from Products.CMFPlone here.
jensens Jul 14, 2023
8b09087
pre-commit fixes
jensens May 15, 2024
63e6fbc
move test from pa.dexterity to here
jensens May 20, 2024
2a4b393
fix requirements
jensens May 20, 2024
9ab3065
add uninstall
jensens May 22, 2024
7a806ba
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] May 27, 2024
f2f1602
move cpanel to content section as this is not core any more
jensens May 30, 2024
8217f26
README overhaul
jensens May 30, 2024
e416b70
typo
jensens May 30, 2024
a2f6c85
move test from CMFPlone here
jensens May 31, 2024
9981145
Fix redirection after comment edit to main content, preventing NotFound.
jensens May 31, 2024
99d0d0c
Merge branch 'main' into core-addon
jensens Jun 10, 2024
a6d7a4d
[pre-commit.ci] pre-commit autoupdate
pre-commit-ci[bot] Jul 1, 2024
c8e7340
Test drop five:registerPackage
gforcada May 3, 2023
ae39d59
[pre-commit.ci] pre-commit autoupdate
pre-commit-ci[bot] Aug 5, 2024
e66c836
Uninstall profile: remove Discussion Item from portal_types tool.
mauritsvanrees Aug 13, 2024
f9c6469
Uninstall profile: remove our workflow definitions.
mauritsvanrees Aug 13, 2024
c5711cf
Merge branch 'main' into core-addon
mauritsvanrees Aug 13, 2024
f896cb4
Configuring with plone/meta
mauritsvanrees Aug 13, 2024
603c903
Robot tests: install our GS profile.
mauritsvanrees Aug 13, 2024
5ed2438
Robot tests: we have no own keywords.robot file.
mauritsvanrees Aug 13, 2024
121a256
Removed tests/dexterity_discussion.rst
mauritsvanrees Aug 19, 2024
da5b2f5
Remove unused content_icon and content_meta_type properties from FTI.
mauritsvanrees Aug 19, 2024
a8f000d
FTI: use @@view alias instead non-existing discussionitem_view.
mauritsvanrees Aug 19, 2024
95d5399
Revert "Remove unused content_icon and content_meta_type properties f…
mauritsvanrees Aug 19, 2024
473224a
Add missing icon
gforcada Feb 6, 2024
840a445
Add news entry
gforcada Feb 6, 2024
ebd965c
Register contenttype icon. Add upgrade step for updating the icons.
mauritsvanrees Aug 19, 2024
aa64bd1
Removed reference to unneeded test file that I removed yesterday.
mauritsvanrees Aug 20, 2024
7e32976
Fix hidden profile id.
mauritsvanrees Aug 20, 2024
98aee4a
Rename profiles/to_2002 to profiles/to_3000.
mauritsvanrees Aug 20, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .meta.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
# See the inline comments on how to expand/tweak this configuration file
[meta]
template = "default"
commit-id = "a89af8f2"
commit-id = "7a017355"

[pyproject]
dependencies_ignores = "['Products.LinguaPlone.interfaces.ITranslatable', 'collective.akismet', 'collective.z3cform.norobots', 'plone.formwidget.captcha', 'plone.formwidget.recaptcha', 'plone.formwidget.hcaptcha', 'plone.contentrules', 'plone.app.contentrules', 'plone.stringinterp', 'plone.app.collection']"

[tox]
constraints_file = "https://dist.plone.org/release/6.1-dev/constraints.txt"
33 changes: 14 additions & 19 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
Introduction
============

plone.app.discussion is the commenting add-on for Plone.
It is part of the maintained Plone core.

plone.app.discussion is the commenting system used since Plone 4.1.
It was initially developed as part of the Google Summer of Code 2009 by Timo Stollenwerk (student) and Martin Aspeli (mentor).
Installation
============

If your installation depends on the `Plone <https://pypi.org/project/Plone/>`_ package, you can install it via the Plone control panel.
In case you do only depend on either the `plone.volto`, `plone.classicui` or `Products.CMFPlone` package, you need to add it to your requirements file.
After adding it and installing the requirement, you can install it via the Plone control panel.


Add-on Products
Spam protection
===============

- `collective.autoresizetextarea
<https://pypi.org/project/collective.autoresizetextarea/>`_
(for auto-resizing the comment textarea while typing)
These days it is essential to protect your site from commenting spam.
The following add-ons can help to protect your site:

- `plone.formwidget.captcha
<https://pypi.org/project/plone.formwidget.captcha/>`_
Expand All @@ -22,33 +26,24 @@ Add-on Products
<https://pypi.org/project/plone.formwidget.recaptcha/>`_
(for ReCaptcha spam protection)

- `collective.akismet
<https://pypi.org/project/collective.akismet/>`_
(for Akismet spam protection)

- `collective.z3cform.norobots
<https://pypi.org/project/collective.z3cform.norobots/1.1/>`_
<https://pypi.org/project/collective.z3cform.norobots/>`_
(provides a "human" captcha widget based on a list of questions/answers)

- `plone.formwidget.hcaptcha
<https://pypi.org/project/plone.formwidget.hcaptcha/>`_
(for spam protection by `HCaptcha <https://www.hcaptcha.com/>`_ )

Note: not all of these may be compatible with the current version of ``plone.app.discussion`` and ``Plone`` itself.


Documentation
=============

There is initial `documentation <https://pythonhosted.org/plone.app.discussion/>`_ but it is outdated.
You will still get a feel for how the package is structured though.

For further information, please refer to the `official Plone documentation <https://docs.plone.org/>`_.

Credits
=======

- Timo Stollenwerk
- Martin Aspeli
This package was initially developed as part of the Google Summer of Code 2009 by Timo Stollenwerk (student) and Martin Aspeli (mentor).

Many thanks to:

Expand All @@ -59,4 +54,4 @@ Many thanks to:
- Hanno Schlichting (for making p.a.d work with Zope 2.12)
- Alan Hoey (for providing fixes)
- Maik Roeder (for providing and setting up a buildbot)

- Jens Klein (for ripping it out of core and making it a separate core-addon for Plone 6.1)
4 changes: 4 additions & 0 deletions news/211.breaking
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Move this package in the space of Plone Core add-ons.
It now depends on Products.CMFPlone and is no longer installed by default.
It is still available in the default Plone distribution, but can be omitted in customizations.
[jensens]
1 change: 1 addition & 0 deletions news/211.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix redirection after comment edit to main content, preventing NotFound. [@jensens]
3 changes: 3 additions & 0 deletions news/222.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Add missing icon on comments' `view` action
Register contenttype icon for comments.
[gforcada, maurits]
100 changes: 0 additions & 100 deletions plone/app/discussion/TODO.txt

This file was deleted.

10 changes: 5 additions & 5 deletions plone/app/discussion/architecture.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ plone.app.discussion.
content.

**Discussion items are subject to workflow and permission**
Moderation, anonymous commenting, and auto approve/reject should be
Moderation, anonymous commenting, and auto-approve/reject should be
handled using workflow states, automatic and manual transitions, and
permissions.

**Discussion items are light weight objects**
Discussion item objects are as light weight as possible. Ideally, a
**Discussion items are lightweight objects**
Discussion item objects are as lightweight as possible. Ideally, a
discussion item should be as lightweight as a catalog brain. This may mean
that we forego convenience base classes and re-implement certain interfaces.
Comments should not provide the full set of dublin core metadata, though
Comments should not provide the full set of Dublin Core metadata, though
custom indexers can be used to provide values for standard catalog indexes.

**Optimise for retrieval speed**
Expand All @@ -49,7 +49,7 @@ plone.app.discussion.
**Discussion items are retrieved in reverse creation date order**
Discussion items do not need to support explicit ordering. They should
always be retrieved in reverse creation date order (most recent for).
They can be stored with keys so that this is always true.
They can be stored with keys so this is always true.

**Discussion items do not need readable ids**
Ids can be based on the creation date.
Expand Down
39 changes: 39 additions & 0 deletions plone/app/discussion/behavior.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
from plone.autoform import directives
from plone.autoform.interfaces import IFormFieldProvider
from plone.base import PloneMessageFactory as _
from plone.supermodel import model
from z3c.form.interfaces import IAddForm
from z3c.form.interfaces import IEditForm
from zope import schema
from zope.interface import provider
from zope.schema.vocabulary import SimpleTerm
from zope.schema.vocabulary import SimpleVocabulary


options = SimpleVocabulary(
[
SimpleTerm(value=True, title=_("Yes")),
SimpleTerm(value=False, title=_("No")),
]
)


@provider(IFormFieldProvider)
class IAllowDiscussion(model.Schema):
model.fieldset(
"settings",
label=_("Settings"),
fields=["allow_discussion"],
)

allow_discussion = schema.Choice(
title=_("Allow discussion"),
description=_("Allow discussion for this content object."),
vocabulary=options,
required=False,
default=None,
)

directives.omitted("allow_discussion")
directives.no_omit(IEditForm, "allow_discussion")
directives.no_omit(IAddForm, "allow_discussion")
23 changes: 23 additions & 0 deletions plone/app/discussion/behavior.zcml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<configure
xmlns="http://namespaces.zope.org/zope"
xmlns:plone="http://namespaces.plone.org/plone"
xmlns:zcml="http://namespaces.zope.org/zcml"
i18n_domain="plone"
>

<include
package="plone.behavior"
file="meta.zcml"
/>

<!--Allow discussion -->
<plone:behavior
name="plone.allowdiscussion"
title="Allow discussion"
description="Allow discussion on this item"
provides=".behavior.IAllowDiscussion"
name_only="yes"
former_dotted_names="plone.app.dexterity.behaviors.discussion.IAllowDiscussion"
/>

</configure>
3 changes: 2 additions & 1 deletion plone/app/discussion/browser/comment.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,8 @@ def handle_cancel(self, action):
_("comment_edit_cancel_notification", default="Edit comment cancelled"),
type="info",
)
return self._redirect(target=self.context.absolute_url())
main_content = aq_parent(aq_parent(self.context))
return self._redirect(target=main_content.absolute_url())


EditComment = wrap_form(EditCommentForm)
18 changes: 17 additions & 1 deletion plone/app/discussion/configure.zcml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
<include package="plone.uuid" />
<include package="plone.app.uuid" />

<include file="behavior.zcml" />
<include file="contentrules.zcml" />
<include file="permissions.zcml" />
<include file="notifications.zcml" />
Expand All @@ -38,11 +39,26 @@
<!-- Register the installation GenericSetup extension profile -->
<genericsetup:registerProfile
name="default"
title="Plone Discussions"
title="Discussion Support"
description="Commenting infrastructure for Plone"
provides="Products.GenericSetup.interfaces.EXTENSION"
for="plone.base.interfaces.IPloneSiteRoot"
directory="profiles/default"
post_handler=".setuphandlers.post_install"
/>
<genericsetup:registerProfile
name="uninstall"
title="Uninstall Discussion Support"
description="Uninstall Commenting infrastructure for Plone"
provides="Products.GenericSetup.interfaces.EXTENSION"
for="plone.base.interfaces.IPloneSiteRoot"
directory="profiles/uninstall"
post_handler=".setuphandlers.post_uninstall"
/>
<utility
factory=".setuphandlers.HiddenProfiles"
provides="plone.base.interfaces.INonInstallable"
name="plone.app.discussion"
/>
<!-- For upgrade steps see upgrades.zcml. -->

Expand Down
Loading
Loading