Opened 9 years ago
Closed 8 years ago
#36742 closed defect (bug) (fixed)
Comments List Table: Comment date doesn't get linked on status change via Ajax
Reported by: | ocean90 | Owned by: | ocean90 |
---|---|---|---|
Milestone: | 4.6 | Priority: | normal |
Severity: | normal | Version: | 4.5 |
Component: | Comments | Keywords: | has-patch |
Focuses: | Cc: |
Description
Since [36521] the comment date gets only linked if the comment status is initially approved.
If you update the comment status via the Approve action link the date remains unlinked, means you don't have a way to view the comment on the front end.
Attachments (4)
Change History (16)
#2
@
9 years ago
- Keywords has-patch added; needs-patch removed
If you update the comment status via the Approve action link the date remains unlinked, means you don't have a way to view the comment on the front end.
The opposite is also happening, if you unapprove a comment, the link stays..
I suggest 36742.patch to fix the issue.
#3
@
8 years ago
I tested the 36742.patch and verified it works as expected. when the ajax request is sent, an approved message will return with the correct comment link as part of the data. The JS then recognizes the presence of the returned link and properly links the date field in the corresponding row.
Here is a screencast of the fix in action:
I can see a little room for cleanup in the patch, update incoming.
#4
@
8 years ago
@imath thanks for your patch, this works well in my testing.
In 36742.2.patch I did a tiny bit of cleanup: adding a training comma in the array structure as per WP coding standards, adding periods at the end of inline comment statements and also I switched from .html() to .text() where possible because I consider .html() as a possible security vector because it evaluates passed scripts. For this reason I try to use .text whenever possible as a matter of course (even though here I don't think there was a risk).
I'm a little surprised and disgruntled that we have to add the JS to wp-lists.js, but this does appear to be the appropriate spot . Nice work!
#6
@
8 years ago
yw @adamsilverstein i just tested 36742.2.patch and i confirm it's fixing the issue, many thanks for your improvements.
#9
@
8 years ago
While testing a patch for #35501, I found I kept getting the following error in my console log:
wp-lists.js?ver=4.6-beta2-37993-src:310 Uncaught TypeError: Cannot read property '0' of undefined
which was happening because line 300 of wp-lists.js has this conditional:
if ( 'undefined' !== typeof res.responses[0].supplemental.comment_link ) {
where somehow I was able to trigger a condition where res = true
.
We should, at least, check that res.responses
isn't 'undefined'
in the same conditional.
Something like this:
if ( 'undefined' !== typeof res.responses && 'undefined' !== typeof res.responses[0].supplemental.comment_link ) {
#11
@
8 years ago
- Owner changed from rachelbaker to ocean90
- Status changed from reopened to assigned
@ocean90 can you check my logic in 36742.3.diff, I don't have enough of a grasp on the logic in source:trunk/src/wp-includes/js/wp-lists.js to know if this patch covers all the use-cases.
Unless you refresh... but yes should be fixed.