verbb / comments

A Craft CMS plugin for managing comments directly within the CMS.
Other
137 stars 33 forks source link

Allow comments to always be replied to, regardless of age #214

Closed jsunsawyer closed 3 years ago

jsunsawyer commented 3 years ago

I couldn't find any documentation on this, but the comment.can('reply') is false for old posts (not sure how old they must be for this).

engram-design commented 3 years ago

There are only a few things that affect reply commenting: https://github.com/verbb/comments/blob/craft-3/src/models/Settings.php#L113

If you're concerned about the age, that only comes into effect with "Auto Close Days" setting set, or if you add a Comment custom field onto the entry element you're commenting on.

jsunsawyer commented 3 years ago

It seems that I may have encounter a bug then. Certain comments aren't allowing replies.

I've switched back to the default template to verify that the issue exists there as well.

jsunsawyer commented 3 years ago

Here are a couple screenshots for reference.

Screen Shot 2021-01-08 at 3 40 01 AM Screen Shot 2021-01-08 at 3 40 31 AM

engram-design commented 3 years ago

Anything you can share about a comment that cannot be replied to? It might be an age issue, so if so, how old are these posts? Anything else worth noting, like the comment author, guest status, etc?

Just saw your reply, that seems odd...

jsunsawyer commented 3 years ago

These do seem to all be top level comments. Not sure if that helps.

I tried logging in as different users and roles. No change there.

Nothing looked specifically odd about the times these were posted, and settings seem to be set appropriately. I can try to check these out in the database and see if there's anything weird.

jsunsawyer commented 3 years ago

Everything looks fine in the database. At least nothing looks out of the ordinary.

jsunsawyer commented 3 years ago

I'm was working on allowing trashed comments to show up by updating my comments query to include anyStatus() so I could keep children of deleted comments.

I've attached a video showing how one of the affected comments (that doesn't allow replies) behaves when being deleted. Please note that I am refreshing the page to show the deleted content since javascript is removing the section from the DOM based on existing functionality.

https://user-images.githubusercontent.com/1007191/104053500-38883580-51a0-11eb-9de3-4512e0d16b8d.mov

And here's a screenshot of this section in the backend after deleting the parent, then its child comment. Screen Shot 2021-01-08 at 10 54 49 AM

I experience this behavior when simply trashing any of the comments that are nested in the comment that can't be replied to (from all comments being enabled). It doesn't matter if the comment itself has children or not. If it does have children, it, and all its children remain removed.

Hopefully this gives you some more information to troubleshoot from.

Update! Looks like this wasn't directly related.

I had to update the nested comment logic:

engram-design commented 3 years ago

Ah, yes that video does help. I'm not quite sure how I want to handle that, I think it's expected behaviour to deny replying to a comment that has been trashed - what do you think?

As for the JS node being deleted, I'll get that sorted.

jsunsawyer commented 3 years ago

I agree about reply being disabled on trashed comments.

The main issue I'm left with is top level comments on a thread for one of our products isn't allowing any replies, regardless of their status.

engram-design commented 3 years ago

So I've improved a few things here, like comment.children | length to comment.hasDescendants(). As for modifying the query for nested comments, you can do this on the render() call, thanks to children being eager-loaded.

See 1.8.0 for these changes.

{{ craft.comments.render(entry.id, {
    status: null,
    with: [
        ['children', { status: null, }],
    ],
}) }}

However, I still can't figure out how you're getting some comments where you can't reply to. Wondering if it's possible to get a database dump of your project. Feel free to get in touch via Craft Discord (crawf) or web@verbb.io

jsunsawyer commented 3 years ago

@engram-design I might just purge the test comments and see if it's something we run into again.

jsunsawyer commented 3 years ago

This seems to have been resolved from either a plugin or Craft update!