mihdan / ajax-edit-comments

Ajax Edit Comments. Allow users to edit comments for a limited time, while admins can edit all comments.
https://wordpress.org/plugins/wp-ajax-edit-comments/
7 stars 6 forks source link

"Undo" after "Moderate" for a comment is broken #9

Open geyerbri opened 7 years ago

geyerbri commented 7 years ago

I'm using the most recent version, 5.0.37, and this issue pertains to the buttons/links created by the plugin on any displayed comment under a post or page, or for a comment found in the "Comments" section of the dashboard.

Here is what I've found after extensive testing. After clicking "Moderate" on a comment (Comment 1) and then clicking "Undo," the comment completely replaces all of its info with that from another, previously moderated comment (Comment 0). It changes Comment 1's content, timestamp, author, and location (and probably everything else) into whatever those are for Comment 0, basically making it look as though Comment 1 no longer exists and that there are two Comment 0s. If tested with multiple accounts, by keeping the original Comment 1 loaded and then clicking "Edit" after using another account to witness the change into Comment 0, the editor modal loads the Comment 0 data, despite the not-refreshed browser window still displaying Comment 1.

This also means that, if Comment 0 is on Page 1 and Comment 1 is on Post 1, Comment 1 disappears from Post 1 and there will be two Comment 0s on Page 1.

This problem only occurs if comments are set to be automatically approved, rather than automatically sent to await moderation, and it appears to be limited to only the "Undo" function available immediately after clicking "Moderate." None of the other "Undo" functions that I could find while testing caused this problem.

I reproduced the problem on multiple machines and multiple browsers (and multiple accounts), and with one machine posting the comment and then another clicking "Moderate" and "Undo," so this isn't something specific to my browser or anything.

You can see the behavior in the linked video below video (zipped). Apologies for how terrible it is, but you should be able to see most of the above-described behavior in action. The censored area contains sensitive information, but is not at all important to this issue.

error-video.zip

seredniy commented 12 months ago

https://github.com/mihdan/ajax-edit-comments/assets/11270429/de063a82-c01f-478b-b4ed-85fab0a30a05