[MGNLCMNT-20] Make the commenting module site aware. Created: 09/Feb/10  Updated: 16/Mar/23  Resolved: 16/Mar/23

Status: Closed
Project: Commenting (closed)
Component/s: None
Affects Version/s: 1.1
Fix Version/s: 1.2.x

Type: Improvement Priority: Major
Reporter: Rico Jansen Assignee: Unassigned
Resolution: Won't Do Votes: 0
Labels: commenting, multisite, patch, vpro
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: File commenting.diff    
Issue Links:
dependency
depends upon MGNLCMNT-27 Akismet spam filtering Closed
depends upon MGNLCMNT-33 Commenting forum(s) should be created... Closed
relation
is related to MGNLCMNT-34 i18n-aware commenting Closed
Template:
Patch included:
Yes
Acceptance criteria:
Empty
Date of First Response:

 Description   

The commenting module does not use the website as information to store comments, so the comments
are global to all sites, this patch adds the option to set a parameter in the paragraph definition (useSiteName)
to make the commenting module use a forum per website. The forum name is made of the forumName specified
in the definition and the website name, retrieved from the root node of the content the paragraph is placed in.

Enabling this does require someone the create the forum called by this, and set the corresponding
acl' s for the users.

Attached is the diff containing:

  • changes to the bootstrap xml's for the paragraphs (default not using the site name).
  • changes to the java code of PageComments.java and LatestComments.java
  • a CommentingUtil class containing the method to determine the forum name


 Comments   
Comment by Jan Haderka [ 31/Mar/10 ]

Hey Rico,
thanks for the patch and sorry I missed it earlier. I'll look at soon.
Jan

Comment by Rico Jansen [ 31/Mar/10 ]

No problem, the next site which will use commenting where this would be handy will probably be
launched around the beginning of June.

Comment by Jan Haderka [ 31/Mar/10 ]

Few technical comments on the patch itself:

  • in the patch you forgot unused LatestComments.getForumName() method which you have presumably moved to the newly created CommentingUtil class.
  • in the LatestComments class you have also removed getPageLink() method which breaks the latestComments.ftl template at line 13. Was that just an oversight or you forgot to include updated template in the patch?

The patch hardcodes the forumName-siteName pattern for the comments forum name and introduces new flag (false by default) whether to suffix forumName with site name or not. That on its own is fine. However when enabling the feature, such forum still needs to be created manually and appropriate roles need to be generated and assigned.
It seems more appropriate to have such configuration in the configuration of the commenting module rather then in the paragraph definition and using observation to generate appropriate forum and roles for each site when enabled.
Furthermore, commenting already allows to specify forum name (although it is not automatically site aware) and using extends feature of Magnolia 4.3 you can easily create one paragraph definition per site which would use specific forum for the site (without limiting yourself to any kind of pattern). Then in each <site>/templates/prototype/main/commenting/paragraph configuration node (or in whichever other template you use this paragraph) you can point to the paragraph configuration that is appropriate for given site. This gives you basically same functionality as the one provided by the patch (ability to use one forum per site, with having to create such forum and configure roles manually).

Do you think you can improve the patch along the lines of automatic creation of forums and roles per site when site awareness is turned on?

Comment by Rico Jansen [ 01/Apr/10 ]

Point 1: An oversight definetly
Point 2: That would be a mistake, I haven't touched the ftl's at all.

As for the forum name specifying, yes I became aware of that later, so I didn't consider it when making
this solution. As for the configuration in the module instead of the paragraph, I did that to minimize
the impact, with configuration in the module the setting would be global for all sites. That is a choice
that must be made.

Extending wasn't there yet unfortunately, but creating a paragraph per site is something we try to
avoid.

Auto creation of forums I have considered, but not by observation though, that is an area I haven't
looked at much. You are suggesting, that when someone turns on site awareness, that the module
creates the appropiate forum for all websites and when websites are created. That is possible but
I am strapped for time the coming month or so.

Comment by Magnolia International [ 29/Nov/10 ]

Finally applied this patch!
Well, an adapted version of it. Combined with MGNLCMNT-34, we now have site-aware and i18n-commenting. Forums are created "on demand", i.e when a comment is added.

Do you guys have any use for this "useSiteName" parameter you introduced, or is it just to avoid breaking existing installs ? In MGNLCMNT-35, I question the need for the forumName to even be configured in the various paragraphs, since it is now "generated" with site/locale information (i tried and failed to come up with a solution to generate those from the config object, based on a pattern, so the name pattern itself is now hardcoded)

Comment by Rico Jansen [ 29/Nov/10 ]

It was purely for protection against breaking existing installs. So you could keep the old
behaviour. That was born out of the inability to rename the forum after creation, otherwise
you could just rename it to the new name.

Comment by Eric Hechinger [ 14/Mar/12 ]

Currently with EE, this is not working, simply because we still have the property forumName (= pagecomments) defined under
commenting/templates/components/comments/parameters

In PageComments.determineForumToUse() the forumName = the property defined prefiously. If it's not defined, this value will be pagecomments-demo-project_en.

It seems for me that we have with EE the simple site behavior of CE (we could simply remove the commenting/templates/components/comments/parameters property when installing EE).

Comment by Adam Jones [ 16/Mar/23 ]

Closing due to project being archived.

Generated at Mon Feb 12 00:02:23 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.