Permissions based on comment type

Created on 16 October 2024, 6 months ago

Problem/Motivation

How do I set permissions based on comment type? It's ok for normal comment type(comment on article) but a member shouldn't have this permission in forum( for comment_forum type ).It might be better to set this in the node type settings.

Any idea, please ? Thanks

💬 Support request
Status

Active

Version

1.0

Component

Code

Created by

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

Merge Requests

Comments & Activities

  • Issue created by @pearls
  • 🇧🇪Belgium swentel

    That's not possible yet, but it's an interesting feature request though!

  • 🇮🇳India nidhi27

    Hi @swentel,

    It's an interesting feature. If you agree I can create MR for this.

  • 🇧🇪Belgium swentel

    Patches always welcome!

  • Merge request !2Added permission comment type wise. → (Merged) created by nidhi27
  • 🇮🇳India nidhi27

    Hi @swentel,

    I have created MR #2 for this particular feature request where we can add the permission based on the comment type individually.
    view overview of comments on own content - This permission I have kept as it is and added comment type for other permissions.

    Please review the MR and let me know if anything else has to be done.
    Attaching screenshot for the reference. I have checked that functionality is working properly after this.

  • 🇧🇪Belgium swentel

    Looks good!

    One thing that I have to think about is the removal of the original permissions (e.g. 'view unpublished comments on own content'). This means that projects updating to the new code will have to reconfigure their permissions (and probably crash as well I think because Drupal doesn't like non existing permissions anymore iirc). So either, we also keep those, or we'll need an update script.

    My personal preference at the moment is to keep the original permissions too, no ?

  • 🇮🇳India nidhi27

    Hi @swentel,

    Thats a good point.
    I think we can run the update script where we can check if the permission is given on existing site, if yes than we will add that permission to all the comment type initially to run the site. Later on, it depends on the owner to change the permission.
    Let me know your view on this. Thanks!

  • 🇧🇪Belgium swentel

    Hey nidhi27,

    Update script is fine for me!

  • Thanks all. I just tested MR!2 now. It works fine with custom/default comment types.
    Just started a new little problem;
    There's a warning as "/history/get_node read timestamps" in recent dblogs when a member replies a comment.

  • 🇧🇪Belgium swentel

    @pearls: what's the warning? is it a PHP error or notice? And it doesn't happen when this module is turned off?

  • I guess your tests don't show anything like that. Then we can think that it's related to my test environment. Ignore it.

  • 🇧🇪Belgium swentel

    Aha, page not found, I'll double check, because you never know our access checks interfere when loading the comment in that route.

  • 🇮🇳India nidhi27

    Hi @swentel,

    I have added the update script to remove the permission and add the newer one. I have tested locally and its working as expected.
    Thanks!

  • 🇮🇳India nidhi27

    Hi,

    Is there any update on this?

  • @nidhi27 , It's ok for me. +1 for RTBC

  • Pipeline finished with Skipped
    2 months ago
    #407262
  • 🇧🇪Belgium swentel

    Merged, will push a new release in a couple of minutes.

    I can't reproduce the history page not found error so far, and I don't think it's a problem with this module afaics.

    Thanks!

Production build 0.71.5 2024