Make WordPress Core

Opened 6 years ago

Closed 6 years ago

#11441 closed enhancement (fixed)

Comment moderation AYS should provide feedback on comment's current status

Reported by: nacin Owned by: nacin
Milestone: 3.0 Priority: normal
Severity: normal Version: 2.9
Component: Comments Keywords: has-patch
Focuses: Cc:


If multiple users receive comment moderation e-mails (say, if the admin e-mail goes to multiple people, or if the pluggable wp_notify_moderator() function is replaced), then one moderator should know what the other moderator may have done.

For example, if user A takes an action on a comment, then user B clicks a comment action link from e-mail, the AYS will provide no feedback that the comment is no longer unapproved. If both admins approve the comment, then wp_notify_postauthor will be triggered twice. Or, the admins could have done conflicting actions -- one moved it to trash, and the next approved it -- and the admin taking the second action would not know from the AYS screen that the comment was already in the trash.

Fixing this this will require some new checks in wp-admin/comment.php. Tickets #11432 and #11426 would make some changes to this file, and this ticket is designed to expand in 3.0 on those improvements. Will patch once #11426 is addressed.

  • If a comment is no longer unapproved, the form should clearly reflect what its current status is.
  • In some cases, the new status might need to be prevented or an extra step would be required, if only behind the scenes. (For example, a trashed comment would need to first be untrashed before being approved. This doesn't happen now, which means meta is not cleaned up, etc.)
  • If the form is attempting to change the comment status to the comment's current status, it should return you to edit-comments.php with a message.
  • If the comment ID doesn't exist, instead of wp_die, it should return you to edit-comments.php with a message saying that the ID doesn't exist or that the comment was deleted.

Those are all of the cases I have for now.

Attachments (1)

11441-comment-ays.diff (11.3 KB) - added by nacin 6 years ago.

Download all attachments as: .zip

Change History (12)

comment:1 follow-up: @hakre6 years ago

I do not think that having multiple moderators is an intented feature of WordPress, as it shows with your report this has serious imlications.

comment:2 in reply to: ↑ 1 @caesarsgrunt6 years ago

Replying to hakre:

I do not think that having multiple moderators is an intented feature of WordPress, as it shows with your report this has serious imlications.

The possibility of having multiple moderators has been cited repeatedly as a reason for not fixing all sorts of other things. So to then say that it is not an intended feature doesn't really make sense - it can't be both ways.

comment:3 follow-up: @nacin6 years ago

ceasarsgrunt: Would love to see a ticket or two that you referenced.

hakre: Let's say you have one moderator only, something WP is supposedly designed for, but multiple people with the moderate_comments permission -- all administrators and editors.

If an editor moderates a comment, then the comment moderator should get some feedback that he's either about to (action) a comment already (action)ed, or that he's about to (action) a comment that has since been moderated to a different status.

I've been working on a patch for this and it's pretty far along. Will probably post it tomorrow.

comment:4 in reply to: ↑ 3 @caesarsgrunt6 years ago

Replying to nacin:

ceasarsgrunt: Would love to see a ticket or two that you referenced.

Off the top of my head, I can only think of #11277 specifically, though I'm certain there are others somewhere. Also see #11297, though that is not specifically moderation but rather overall admin.

(Offtopic - it's caesarsgrunt, not ceasarsgrunt - which is also why I didn't actually get cc'd on the ticket you kindly tried to cc me on the other day.)

comment:5 @nacin6 years ago

Thanks for those. Ironically, I'm involved in both.

(OT- sorry about that, I have a friend with the last name spelled the other way. Will get it right!)

comment:6 @hakre6 years ago

  • Keywords 2nd-opinion added

I didn't wanted to speak for or against it. I just wanted to remind that wordpress was just not designed for that and therefore it's pretty hard to implement solidly. That's all. I understand your problem. I flagged this ticket as 2nd-opinion I hope that other have valuable feedback to add because I have no good Idea right now on how to properly implement.

comment:7 @nacin6 years ago

  • Keywords has-patch added; 2nd-opinion removed

First pass on this:

  • When moderating a comment that is not unapproved, you get a message letting you know that the comment is currently approved, in trash, or in spam.
  • If you try to moderate a comment that doesn't exist (such as if it was deleted), you get kicked back out to edit-comments.php with an error. (Currently strands you with wp_die()).
  • If you don't have permissions to moderate comments or edit the particular post, it kicks you back out to edit-comments.php with an error. (Currently strands you with comment_footer_die()).
  • If you try to approve/trash/spam a comment that is already approved/trashed/spammed, it kicks you back out to edit-comments.php with a friendly message.
  • Incidentally, cleans up some repetitive code in comment.php (and standardizes some messages and redirects).
  • Also fixes a notice by adding $hook_suffix as a global in comment_footer_die().

What this doesn't do is bullet point 2 in the ticket description (untrash/unspam a comment that is trashed/spammed before performing another action). This doesn't occur now so I feel it is outside the scope of this enhancement. I will probably open a new ticket for that as suggested by azaozz anyway in #11442.

@nacin6 years ago

comment:8 @nacin6 years ago

  • Owner set to nacin
  • Status changed from new to reviewing

comment:9 @nacin6 years ago

(In [13246]) Comments moderation code cleanup. Dry up some code, add screen icon to AYS, fix notice in comment_footer_die(). Redirect to edit-comments.php on an error, instead of stranding them with dull comment_footer_die() message. See #11441

comment:10 @nacin6 years ago

(In [13247]) Show awareness of comment's current status when moderating via e-mail/AYS. Show message on AYS screen of comment's status if not unapproved. Skip AYS when trying to re-approve (or delete or spam) a comment and show a message. See #11441

comment:11 @nacin6 years ago

  • Resolution set to fixed
  • Status changed from reviewing to closed
Note: See TracTickets for help on using tickets.