Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot delete/edit comment with replies even if they're removed #1481

Closed
daniloarcidiacono opened this issue Sep 11, 2022 · 1 comment · Fixed by #1507
Closed

Cannot delete/edit comment with replies even if they're removed #1481

daniloarcidiacono opened this issue Sep 11, 2022 · 1 comment · Fixed by #1507
Assignees
Milestone

Comments

@daniloarcidiacono
Copy link

Steps to reproduce:

  1. Login as a non-administrator;
  2. Post one comment "a";
  3. Reply to that comment with another comment "b";
  4. Delete the "b" comment;
  5. Delete the "a" comment;

An error occurs on the last step: "parent comment with reply can't be edited"... but this shouldn't be thrown because the child comment "b" is no longer visible. Furthermore, the "Edit" action is not restored on the parent comment once the child comment has been deleted.

No errors are thrown if the user is an administrator instead, and also the "Edit" is restored after refreshing the page.
I noticed that the "Delete" button calls two different APIs depending if the user is an administrator or not:

  • Administrator: DELETE /admin/comment/{id}
  • Non administrator: PUT /comment/{id}

The problem seems related to the repliesCache used by HasReplies() method that is not updated when the child comment is removed.

@paskal paskal self-assigned this Sep 12, 2022
paskal added a commit that referenced this issue Oct 2, 2022
Previously, the cache kept the entry and deletion of the parent comment
after child deletion was not possible for the rest
of cache life (5m) duration. Now it's possible to delete
a parent comment after the deletion of the child comment
by a user or admin.

Resolves #1481
@paskal
Copy link
Sponsor Collaborator

paskal commented Oct 2, 2022

Thanks for the good bug reports!

paskal added a commit that referenced this issue Oct 3, 2022
Previously, the cache kept the entry and deletion of the parent comment
after child deletion was not possible for the rest
of cache life (5m) duration. Now it's possible to delete
a parent comment after the deletion of the child comment
by a user or admin.

Resolves #1481
paskal added a commit that referenced this issue Oct 3, 2022
Previously, the cache kept the entry and deletion of the parent comment
after child deletion was not possible for the rest
of cache life (5m) duration. Now it's possible to delete
a parent comment after the deletion of the child comment
by a user or admin.

Resolves #1481
umputun pushed a commit that referenced this issue Oct 3, 2022
Previously, the cache kept the entry and deletion of the parent comment
after child deletion was not possible for the rest
of cache life (5m) duration. Now it's possible to delete
a parent comment after the deletion of the child comment
by a user or admin.

Resolves #1481
@paskal paskal added this to the v1.11.0 milestone Jan 15, 2023
itzomen pushed a commit to traleor/comments that referenced this issue Apr 16, 2023
Previously, the cache kept the entry and deletion of the parent comment
after child deletion was not possible for the rest
of cache life (5m) duration. Now it's possible to delete
a parent comment after the deletion of the child comment
by a user or admin.

Resolves umputun#1481
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants