Convert comments to be revisionable

Created on 21 May 2017, almost 8 years ago
Updated 17 March 2023, about 2 years ago

Problem/Motivation

As decided in #2745619: [policy, no patch] Which core entities get revisions? โ†’ , comments should be converted to be revisionable.

Quoting @webchick from #2745619-9: [policy, no patch] Which core entities get revisions? โ†’ :

Would allow some recourse for content administrators to go after a malicious user who filled their comment with a bunch of racist garbage to which other users reacted, and then later went back and edited their comment to something more innocent, to dodge being banned.

Proposed resolution

Do it.

Remaining tasks

Review.

User interface changes

None yet, revision support is only enabled at the API level.

API changes

Nope.

Data model changes

Comments are now revisionable.

๐Ÿ“Œ Task
Status

Needs review

Version

10.1 โœจ

Component
Commentย  โ†’

Last updated 14 days ago

Created by

๐Ÿ‡ท๐Ÿ‡ดRomania amateescu

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • ๐Ÿ‡ง๐Ÿ‡ชBelgium dieterholvoet Brussels
  • Status changed to Needs work about 2 years ago
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States smustgrave

    Seems to be some failures in the MR2872

    Also the update hook will need upgrade tests.

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States robphillips

    Probably should update comment_user_cancel() so that revision_uid is re-assigned to zero (0) when the author's account is cancelled. I recently ran into an issue where the comment was re-assigned but not the revision. See node_user_cancel() as an example:

    node_mass_update($vids, [
      'uid' => 0,
      'revision_uid' => 0,
    ], NULL, TRUE, TRUE);
    
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States robphillips

    Re-rolled for 10.3.x

  • ๐Ÿ‡ฌ๐Ÿ‡งUnited Kingdom jacobupal Leeds

    Hey @robbiehobby does your re-roll in #79 include your proposed change in #78?

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States robphillips

    robbiehobby โ†’ changed the visibility of the branch 11.x to hidden.

  • Merge request !11441Resolve #2880154 "Revisionable comments" โ†’ (Open) created by robphillips
  • Pipeline finished with Failed
    25 days ago
    Total: 137s
    #445781
  • Pipeline finished with Failed
    24 days ago
    Total: 128s
    #445890
  • Pipeline finished with Failed
    24 days ago
    Total: 493s
    #445913
  • Pipeline finished with Failed
    24 days ago
    Total: 644s
    #446125
  • Pipeline finished with Failed
    22 days ago
    Total: 523s
    #447811
  • Pipeline finished with Failed
    22 days ago
    #448047
  • Pipeline finished with Failed
    22 days ago
    Total: 727s
    #448049
  • Pipeline finished with Failed
    21 days ago
    Total: 203s
    #448679
  • Pipeline finished with Failed
    21 days ago
    Total: 303s
    #448845
  • Pipeline finished with Failed
    21 days ago
    #448849
  • Pipeline finished with Failed
    21 days ago
    Total: 726s
    #448855
  • Pipeline finished with Failed
    21 days ago
    Total: 877s
    #448867
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States robphillips

    Opened a new merge request for version 11.x. It includes several bug fixes, improvements, and test adjustments. I did my best to model all changes based on pre-existing solutions in the node revisions implementation.

    I havenโ€™t figured out how to resolve the core/modules/jsonapi/tests/src/Functional/CommentTest.php test. Maybe someone who is familiar with that test can jump in? The other failing tests do not seem related to these changes, but I could be wrong.

    There probably needs to be new tests created for comment content moderation and for the user cancel changes. Unfortunately, I wonโ€™t have time to work on these immediately. Please feel free to jump in if you'd like.

    1. Added the missing revision keys to the config and tests.
    2. Added the revision UI, links, and access control.
    3. Kept the existing comment permission structure with administer comments being the permission that can perform revision CRUD operations.
    4. Removed the base field alter hook because this should be configured in the content moderation workflow rather than in the code.
    5. Added shared table indexes for the comment_revision table.
    6. Created comment_mass_update, a carbon copy of node_mass_update, to primarily handle hook_user_cancel operations gracefully. It includes a new $syncing option to prevent the creation of new revisions when reassigning comments to the anonymous user account. A similar issue for nodes exists at [ https://www.drupal.org/project/drupal/issues/3062900] โ†’ ( https://www.drupal.org/project/drupal/issues/3062900 โ†’ ).
    7. Added a comment moderation handler.
    8. Updated the comment links renderer to be aware of revisions.
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States robphillips
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States robphillips
  • Pipeline finished with Failed
    21 days ago
    Total: 658s
    #449152
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States smustgrave

    not reviewed yet but pipeline appears to have test failures.

Production build 0.71.5 2024