WordPress.org

Make WordPress Core

Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#27329 closed defect (bug) (fixed)

js errors while moderating comments

Reported by: iseulde Owned by: wonderboymusic
Milestone: 3.9 Priority: normal
Severity: normal Version: 3.8
Component: Comments Keywords: has-patch commit
Focuses: javascript, administration Cc:

Description

When trashing or marking as spam in edit-comments.php:

[Error] Error: Syntax error, unrecognized expression: [object Object]
	error (jquery.js, line 2)
	ob (jquery.js, line 2)
	xb (jquery.js, line 2)
	db (jquery.js, line 2)
	find (jquery.js, line 2)
	init (jquery.js, line 2)
	init (jquery-migrate.js, line 225)
	n (jquery.js, line 2)
	add (wp-lists.js, line 312)
	ajaxAdd (wp-lists.js, line 83)
	(anonymous function) (wp-lists.js, line 455)
	delAfter (edit-comments.js, line 240)
	(anonymous function) (wp-lists.js, line 209)
	dequeue (jquery.js, line 3)
	(anonymous function) (jquery.js, line 3)
	each (jquery.js, line 2)
	each (jquery.js, line 2)
	queue (jquery.js, line 3)
	complete (wp-lists.js, line 207)
	j (jquery.js, line 2)
	fireWith (jquery.js, line 2)
	x (jquery.js, line 4)
	b (jquery.js, line 4)

Visual behaviour: the undo message has two avatars.

When trashing, (un)approving or marking as spam in index.php:

[Error] TypeError: 'undefined' is not an object (evaluating 'el.html().replace')
	getCount (edit-comments.js, line 127)
	dashboardTotals (edit-comments.js, line 118)
	delAfter (edit-comments.js, line 210)
	(anonymous function) (wp-lists.js, line 209)
	dequeue (jquery.js, line 3)
	(anonymous function) (jquery.js, line 3)
	each (jquery.js, line 2)
	each (jquery.js, line 2)
	dequeue (jquery.js, line 3)
	complete (wp-lists.js, line 210)
	j (jquery.js, line 2)
	fireWith (jquery.js, line 2)
	x (jquery.js, line 4)
	b (jquery.js, line 4)

Visual behaviour: comment disappears after trashing, but doesn't reappear after undoing it.

Tested in trunk and 3.8.1.

Attachments (6)

Screen Shot 2014-03-08 at 19.40.54.png (11.6 KB) - added by iseulde 5 years ago.
Double avatars.
27329.patch (1.8 KB) - added by SergeyBiryukov 5 years ago.
27329.2.patch (2.3 KB) - added by SergeyBiryukov 5 years ago.
27329.3.patch (2.6 KB) - added by iseulde 5 years ago.
27329.4.patch (3.1 KB) - added by SergeyBiryukov 5 years ago.
27329.5.patch (3.1 KB) - added by iseulde 5 years ago.

Download all attachments as: .zip

Change History (25)

@iseulde
5 years ago

Double avatars.

#1 @iseulde
5 years ago

It appears that the last error has to do with the fact that there's no span with a total-count class anywhere.
Line 116 of edit-comments.js: total = $('span.total-count', dash);.

Last edited 5 years ago by iseulde (previous) (diff)

#2 @SergeyBiryukov
5 years ago

  • Milestone changed from Awaiting Review to 3.9

Confirmed both issues. <span class="total-count"> was removed in [26144].

#3 @SergeyBiryukov
5 years ago

So, the dashboardTotals() function is broken since [26144].

I'd suggest removing it completely, as it can show "1 Comments" or "2 Comment", and we can't properly localize this (as previously noted in #18809). We still have live-updating counts at the bottom of the Activity meta box, and they work fine.

27329.patch fixes the dashboard issue for me.

The Edit Comments screen issue appears to be caused by wpList.add() in lines 239 and 282:
tags/3.8.1/src/wp-admin/js/edit-comments.js#L239

#4 @SergeyBiryukov
5 years ago

  • Keywords has-patch commit added

The Edit Comments screen issue was introduced in [25546].

We're calling $.trim( e ) without first verifying that e is a string (it can also be a jQuery object).

27329.2.patch fixes both issues for me.

#5 @SergeyBiryukov
5 years ago

  • Milestone changed from 3.9 to 3.8.2
  • Version changed from 3.8.1 to 3.8

It's a regression, moving to 3.8.2.

#6 follow-up: @iseulde
5 years ago

The errors are gone with Sergey's patch, however, undoing marking a comment as spam on the dashboard still doesn't make the comment reappear. In edit comments, I still get the double avatars when trashing a comment.

@iseulde
5 years ago

#7 @iseulde
5 years ago

Patch just removes an unused variable.

#8 in reply to: ↑ 6 @SergeyBiryukov
5 years ago

  • Keywords commit removed

Replying to avryl:

The errors are gone with Sergey's patch, however, undoing marking a comment as spam on the dashboard still doesn't make the comment reappear. In edit comments, I still get the double avatars when trashing a comment.

Hmm, undoing marking a comment as spam on dashboard always makes the comment reappear for me with the patch. I can reproduce the double avatars issue though.

#9 @iseulde
5 years ago

Okay, works fine for me now too. Not sure what caused it.

@iseulde
5 years ago

#10 @iseulde
5 years ago

$('.avatar', el) gives you two elements, not sure why, but using first()solves the problem.

#11 @SergeyBiryukov
5 years ago

  • Keywords commit added

The double avatars issue was introduced in [26961], where we added hidden comment author info, only visible at narrow screen sizes.

#12 @iseulde
5 years ago

Oh, sorry Sergey, didn't see your patch.

#13 @SergeyBiryukov
5 years ago

No worries :) I was contemplating between adjusting the selector and using first(). The latter seems more future-proof.

#14 @wonderboymusic
5 years ago

  • Owner set to wonderboymusic
  • Resolution set to fixed
  • Status changed from new to closed

In 27759:

Fix double avatars and JS errors when spamming/trashing comments.

Props avryl, SergeyBiryukov.
Fixes #27329.

#15 @wonderboymusic
5 years ago

  • Keywords fixed-major added
  • Resolution fixed deleted
  • Status changed from closed to reopened

This ticket was mentioned in IRC in #wordpress-dev by nacin. View the logs.


5 years ago

This ticket was mentioned in IRC in #wordpress-dev by SergeyBiryukov. View the logs.


5 years ago

#18 @nacin
5 years ago

  • Keywords fixed-major removed
  • Milestone changed from 3.8.2 to 3.9
  • Resolution set to fixed
  • Status changed from reopened to closed

We've lived with this for a while and basically no one has noticed. I think we can probably wait another week on this.

#19 @iseulde
5 years ago

#25627 was marked as a duplicate.

Note: See TracTickets for help on using tickets.