Skip to content

Add a webhook and settings when comments get reported above a certain threshold #4865

Open
helderdb wants to merge 4 commits into
coralproject:developfrom
helderdb:feature/report-webhook
Open

Add a webhook and settings when comments get reported above a certain threshold #4865
helderdb wants to merge 4 commits into
coralproject:developfrom
helderdb:feature/report-webhook

Conversation

@helderdb

@helderdb helderdb commented Apr 17, 2026

Copy link
Copy Markdown

What does this PR do?

Adds a new webhook event COMMENT_REPORTED_THRESHOLD_REACHED emitted when a comment reaches a configurable report threshold. Includes:

  • New event type & data schema (storyID, siteID, commentID, reportCount).
  • Webhook listener dispatches to configured endpoints.
  • Admin UI settings (in DSAConfigContainer) to configure reportedThreshold per tenant.
  • GraphQL schema/resolvers for DSA configuration (dsa.reportedThreshold).
  • Logic in comment services/actions to check & emit event on report addition.
  • Updated WEBHOOKS.md docs.
  • Test fixtures update.
  • Updated translations for DSA reporting in admin (with the help of AI)

No related issues.

These changes will impact:

  • commenters
  • moderators
  • admins (new DSA config section for report threshold)
  • developers (new webhook event)

What changes to the GraphQL/Database Schema does this PR introduce?

  • GraphQL: New DSAConfiguration input/output types with reportedThreshold: Int field. Mutations/queries updated in resolvers/DSAConfiguration.ts.
  • DB: Added dsa.reportedThreshold to TenantSettings model (default 5).

Does this PR introduce any new environment variables or feature flags?

None.

If any indexes were added, were they added to INDEXES.md?

No indexes added.

How do I test this PR?

  1. Run dev server with jobs: pnpm run start:development:withJobs (server/).
  2. docker-compose up redis mongo.
  3. Admin → Configure → General → DSA: set reportedThreshold (e.g., 3).
  4. Create story/comment, report it 3+ times → server logs event, webhook POST sent.
  5. Check WEBHOOKS.md for new event schema.

Were any tests migrated to React Testing Library?

None migrated (no RTL changes).

How do we deploy this PR?

No special steps: standard deploy. Purge admin caches if needed. New config available in tenant settings.

@netlify

netlify Bot commented Apr 17, 2026

Copy link
Copy Markdown

Deploy Preview for gallant-galileo-14878c canceled.

Name Link
🔨 Latest commit cec9b32
🔍 Latest deploy log https://app.netlify.com/projects/gallant-galileo-14878c/deploys/6a1d34c26581a30008ab636f

@helderdb helderdb changed the title Add a webhook and settings when comments get reported above a certain… Add a webhook and settings when comments get reported above a certain threshold Apr 17, 2026
@helderdb

Copy link
Copy Markdown
Author

@kabeaty Do I need to do anything else in order to get this merged?

@tessalt

tessalt commented Apr 21, 2026

Copy link
Copy Markdown
Contributor

Hi there, interesting feature, I have a few notes:

  • is there a strong reason to group this setting under DSA settings? It doesn't seem to be related to EU Digital Services Act features, and maybe should be grouped with other webhook settings.
  • we have generally avoided including computer generated translation files, preferring to allow a fluent speaker to contribute translations as they require them, falling back to en-us

@helderdb

helderdb commented Apr 22, 2026

Copy link
Copy Markdown
Author

Thank you for the reply @tessalt !

  • No particular reason, I figured it would be the best place to do it. Should I show the threshold setting in the webhook settings details when the COMMENT_REPORTED_THRESHOLD_REACHED is selected? Then we might also move that setting from tenant level to webhook level instead?
  • Shall I revert the translation files I do not know the language of? I can do English and Dutch.

@helderdb helderdb force-pushed the feature/report-webhook branch from ce038fd to 670df7a Compare April 23, 2026 08:45
@helderdb

Copy link
Copy Markdown
Author

@tessalt Updated the translations & moved the setting for the threshold to the webhook itself. The input field appears when you select the COMMENT_REPORTED_THRESHOLD_REACHED webhook.

@helderdb

helderdb commented May 5, 2026

Copy link
Copy Markdown
Author

@kabeaty @tessalt anything left to do for this?

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants