Skip to content

feat: add support for comments in forms#3329

Open
Chartman123 wants to merge 1 commit into
mainfrom
enh/comments
Open

feat: add support for comments in forms#3329
Chartman123 wants to merge 1 commit into
mainfrom
enh/comments

Conversation

@Chartman123
Copy link
Copy Markdown
Collaborator

This closes #1655 by integrating the comments app.

Signed-off-by: Christian Hartmann chris-hartmann@gmx.de

@Chartman123 Chartman123 added enhancement New feature or request php PHP related ticket javascript Javascript related ticket labels May 11, 2026
@Chartman123 Chartman123 requested a review from pringelmann May 11, 2026 20:57
@Chartman123 Chartman123 added integration Compatibility with other apps/systems 2. developing Work in progress labels May 11, 2026
@Chartman123 Chartman123 added this to the 5.3 milestone May 11, 2026
@Chartman123 Chartman123 added the 3. to review Waiting for reviews label May 11, 2026
@Chartman123 Chartman123 self-assigned this May 11, 2026
@Chartman123 Chartman123 requested a review from susnux May 11, 2026 20:57
@Chartman123 Chartman123 force-pushed the enh/comments branch 7 times, most recently from 12754de to abafef8 Compare May 11, 2026 21:55
@codecov
Copy link
Copy Markdown

codecov Bot commented May 11, 2026

Codecov Report

❌ Patch coverage is 20.00000% with 24 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
lib/Migration/Version050300Date20260511121033.php 0.00% 11 Missing ⚠️
lib/Listener/CommentsEntityListener.php 0.00% 10 Missing ⚠️
lib/Controller/PageController.php 0.00% 2 Missing ⚠️
lib/AppInfo/Application.php 0.00% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@Chartman123 Chartman123 force-pushed the enh/comments branch 2 times, most recently from b1cd4d0 to d93d465 Compare May 11, 2026 22:18
Signed-off-by: Christian Hartmann <chris-hartmann@gmx.de>
@Chartman123 Chartman123 marked this pull request as ready for review May 11, 2026 22:32
@Chartman123
Copy link
Copy Markdown
Collaborator Author

Front-end code was created with assistance by Copilot. There's probably room for improvement.

I'm also facing the problem that sometimes the comments tab loads, but doesn't show existing comments. Probably some kind of race condition.

Comment thread lib/Controller/PageController.php

// Register the 'forms' entity collection so the Comments app can
// check whether a given form id allows comments.
$event->addEntityCollection('forms', function ($formId) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I can tell this callback is the only thing the comments layer checks before letting someone read or write. Checking just allowComments means any logged-in user can hit /comments/forms/<id> and post or read comments on any form with comments enabled, no share access required. Maybe we need the some kind of per-user check here?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes this makes sense, we should check here if the current user:

  1. is the owner
  2. or the form is shared with the user

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We shouldn't limit comments to the owner or shared admins but to all logged in users with access to the form. The use case of the feature request was for allowing communication between respondents.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes that what I meant we still would need the check:

  1. is the form shared with anyone?
  2. otherwise: is the user the owner
  3. otherwise: is the form shared with the user

Because otherwise some user could read comments of a form where he does not have access to

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes that's right. I first thought that you meant only shared edit permissions

@pringelmann
Copy link
Copy Markdown
Collaborator

Should we also clean up comments when a form is deleted? (deleteForm() in FormMapper.php) Otherwise it will likely lead to many of orphan table rows over time

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

2. developing Work in progress 3. to review Waiting for reviews enhancement New feature or request integration Compatibility with other apps/systems javascript Javascript related ticket php PHP related ticket

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Ability to add Comment section for user (like polls)

3 participants