Skip to content

Enable card review editing with restricted moderator access - #996

Open
makgit9623 wants to merge 11 commits into
ThronesDB:masterfrom
makgit9623:mak-2026-11-enable-card-review-editing-and-moderation
Open

makgit9623 wants to merge 11 commits into
ThronesDB:masterfrom
makgit9623:mak-2026-11-enable-card-review-editing-and-moderation

Conversation

@makgit9623

Copy link
Copy Markdown
Contributor

Summary

This PR enables users to edit their own card reviews and introduces a restricted review moderator permission for selected users, starting with Miha, mak, Stephen, Stefan.

It reuses the existing Markdown review editor and adds a persistent edit history to preserve the original author and previous versions of modified reviews (history is in database, not on the screen in a card review section).

Changes

Review editing

  • Allow authenticated users to edit their own reviews.
  • Add an "Edit my review" link below reviews owned by the current user.
  • Reuse the existing Markdown editor, preview, card references (#) and symbol shortcuts ($).
  • Support editing historical reviews.
  • Update the displayed review text after a successful edit.

Restricted moderation

  • Add a centralized list of authorized review moderator user IDs.
  • Initially authorize: Miha, mak, Stephen, Stefan.
  • Allow moderators to edit their own reviews and reviews written by other users.
  • Display "Edit review (moderator)" for reviews owned by other users.
  • Preserve the original review author, votes and comments.
  • Grant no additional administrative permissions.

Security

  • Enforce ownership or moderator permissions on the server.
  • Add a private endpoint for retrieving editable review Markdown.
  • Validate permissions before exposing review content.
  • Add CSRF protection for review edits.
  • Keep CSRF tokens out of publicly cached card pages.
  • Preserve existing review creation, commenting and voting behavior.

Audit history

  • Add a dedicated review_edit_history table.
  • Record the review ID, original author ID, editing user ID and edit timestamp.
  • Preserve the previous and updated Markdown for each edit.
  • Store review changes and their history through the same Doctrine flush.

Translations

  • Add editing labels and success messages in English, German and Spanish.

Expected behavior

  • Anonymous visitors cannot edit reviews.
  • Regular users can edit only their own reviews.
  • Miha, mak, Stephen, Stefan, can edit any card review.
  • Additional moderator IDs can be added to the centralized list.
  • Moderators can update historical reviews without changing their original authors.
  • Editing an existing review loads its saved Markdown.
  • Markdown preview and card/symbol shortcuts remain functional.
  • Successful edits update the displayed review text.
  • Standard review creation, voting and comments remain unchanged.
  • Unauthorized edit requests are rejected by the server.

Scope

New files:

  • src/Services/ReviewPermissions.php
  • src/Entity/ReviewEditHistory.php
  • migrations/Version20261119000000.php

Modified files:

  • src/Controller/ReviewController.php
  • src/Controller/UserController.php
  • assets/js/ui.card.js
  • templates/Search/display-card.html.twig
  • templates/Search/display-card-reviews.html.twig
  • translations/messages.en.yml
  • translations/messages.de.yml
  • translations/messages.es.yml

Deployment considerations

  • Run the Doctrine migration before enabling review editing.
  • Rebuild frontend assets and JavaScript translations as required.
  • Ensure edit history is retained and accessible only to authorized administrators.
  • Review database backup and retention procedures for historical Markdown.
  • No existing review data is migrated or deleted.

Testing

Maintainer validation is requested before merging, particularly for permissions, CSRF handling, audit persistence and the existing review editor workflow. Full Symfony, Doctrine, browser and database integration tests have not been performed.

@stopfstedt stopfstedt self-assigned this Nov 21, 2026
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