#37826 closed defect (bug) (fixed)
Can't manage comments of trashed posts
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 5.5 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Comments | Keywords: | has-screenshots has-patch commit |
Focuses: | Cc: |
Description
I noticed two things when managing trashed posts today and thought I'd mention them here.
If you have a trashed post with at least 1 comment or trackback, the speech bubble is being displayed in the list table (as expected). Screenshot:
Now, there are two problems:
- When clicking on the bubble to manage the comments of this post, an empty list table is being displayed
- The post title above that list table is linked to the post edit screen. When clicking on it, I get a "You can’t edit this item because it is in the Trash" permission error.
Neither of that is expected. Why aren't the comments shown even if they obviously exist (works when restoring)? Why can't I access the edit screen and why does the post title link to it then?
Screenshot:
Attachments (10)
Change History (41)
This ticket was mentioned in Slack in #design by hugobaeta. View the logs.
9 years ago
#3
follow-up:
↓ 4
@
9 years ago
Should we not just disallow editing of trashed posts? It’s simple and clear. OS’s work similarly (at least Mac does): “You can’t open that item, it’s in the trash."
It seems to me there are two good options for a better user experience:
- block the links and give a nice error message.
- re-enable editing.
I'd prefer number one to make sure people don't get confused when working with the content and then find it's gone when the trash is emptied (which is why both Windows and Mac won't let you open or work with content in the trash I believe).
What do others think?
#4
in reply to:
↑ 3
@
9 years ago
Replying to helen:
Huh, that's terrible. What happens to comments of trashed posts that get deleted? They get deleted too?
I'm curious to know this as well.
Replying to FolioVision:
It seems to me there are two good options for a better user experience:
- block the links and give a nice error message.
- re-enable editing.
What do others think?
I'd probably just not link the bubble at all and skip error messages altogether. Just as you can't edit posts in the trash you shouldn't be able to moderate comments of said posts.
Related to that is whether those comments can also (currently) be moderated outside of this interface. If they can, then we should either look at locking those down as well or unifying the experience across the board to making them moderate-able regardless of the trashed status of the parent post.
#5
in reply to:
↑ 1
;
follow-up:
↓ 6
@
9 years ago
Replying to helen:
Huh, that's terrible. What happens to comments of trashed posts that get deleted? They get deleted too?
Comments of trashed posts aren't being displayed when on the comments screen. When deleting the post permanently, comments will be deleted permanently too.
Funnily, when I trash a post and go to the edit screen of a single comment for that post, i.e. /wp-admin/comment.php?action=editcomment&c=6
, I can still "edit" that comment. To be more precise, I can see the edit form and change any information, but when clicking on "Update", I get redirected to the empty comment list table and the comment wasn't updated at all.
#6
in reply to:
↑ 5
@
9 years ago
Funnily, when I trash a post and go to the edit screen of a single comment for that post, i.e.
/wp-admin/comment.php?action=editcomment&c=6
, I can still "edit" that comment. To be more precise, I can see the edit form and change any information, but when clicking on "Update", I get redirected to the empty comment list table and the comment wasn't updated at all.
Good detective work. Is the consensus we should actively delete these comments? I suppose they could be considered detritus in the database. Nothing serious if there's only a few dozen but if someone is cleaning up a site with posts with hundreds of unwanted comments, the cleanup could matter.
For simplicity's sake, we should probably break the comment cleanup out into another ticket if we agree that we want it too. Our priority here is users access to content in the WordPress trash.
My take is that content in the trash shouldn't be accessible and we just need more elegant notifications (preferably with no screen reload, even for users without javascript enabled).
#7
@
9 years ago
Comments should only be deleted when the post is being deleted, otherwise there will be unexpected data loss.
The edit form shouldn't work for comments of trashed posts and the comment bubble shouldn't link to an empty list table.
#8
@
8 years ago
- Keywords needs-patch good-first-bug added
- Milestone changed from Awaiting Review to Future Release
#10
@
8 years ago
Thanks for your patch @stevenlinx! Would you mind uploading a screenshot of the list table with the patch applied so we can easily see the difference?
I'm a bit confused by the Approved comments AND Posts that were trashed. Hyperlinks for editing are removed.
comment there. Based on the ticket description hyperlinks are not removed at all. So that might be the actual bug here.
#11
@
8 years ago
@swissspidy
1.) In the screenshot, you can see the "comments bubble" is highlighted (though the mouse pointer is invisible in the screenshot) and the URL does not appear in the web browser status bar, which means no links are applied.
2.) The code comment "Hyperlinks for editing are removed" means the editing hyperlink for the "comments bubble" is removed.
#12
@
8 years ago
@swissspidy
I know you propose making the link of the "comments bubble" under the "trashed" subtab of the "Post" tab leading to a html table that merely displays the comments and no buttons for editing each comment.
I acknowledge the patch is different from what you've proposed and I could have commented first (After I realized what the problem was, I did the patch and submitted too quickly).
When I was evaluating the problem, I concluded that your proposal was based on the wrong assumption. Even if it were correct, it can't be trivially fixed (possibly need further discussion on a separate ticket).
Your assumption was based on the fact that you clicked the link on the "comments bubble" and the resulting page didn't give you the table that you expected, but the core issue is that the "comments bubble" is not supposed to be linked in the first place. You can deduce this design decision from the fact that the post title of a trashed post is currently not linked (this was tested on the latest v4.6.1).
The bug was caused by comments_bubble()
function not taking into account that "trashed" posts are not suppose to have hyperlinks. The current code in comments_bubble() simply displays html based on the number of approved comments available, irrespective whether the post in question is already trashed.
1)
All properties of a trashed post should be read-only. This was acknowledged by a previous commenter, as akin to a trashed file in the recycle bin of a desktop OS.
2)
If you try to create a test post, add a few comments, and trash the post. Then, go direct to the "Comments" tab on the left panel of WP Admin (which loads "edit-comments.php" page), you'll discover the comments you've just added is not displayed anywhere.
On the "edit-comments.php" page, if a post is trashed, then its properties such as comments will not show. By design, the "edit-comments.php" page only displays the "trashed" comments of "active" posts, and not "trashed" posts.
If you go to the "Post" tab, then the "trashed" subtab, and click on the "comments bubble", it loads the same "edit-comments.php" file.
Hence, if you propose to display "trashed" comments of "trashed" posts, you'll be changing the intended role of "edit-comments.php" page. Not to mention you'll have to change how the buttons are displayed, so they're not hyperlinked.
#13
@
8 years ago
Well, now your new patch makes more sense. $_GET['post_status'] == 'trash'
should be 'trash' === get_post_status( $post_id )
though.
The experience is still not ideal when going to the comments page of that post directly, e.g. /wp-admin/comment.php?action=editcomment&c=6
. Doing that should not simply show an empty list table. I didn't propose any specific solution for that as I was merely throwing around some ideas. A simple solution would probably be showing an error message in that scenario.
#14
@
8 years ago
@swissspidy
1.) Fixed.
2.) I added code at the top that stops the operation if the post in question is "trashed".
#16
@
8 years ago
- Keywords good-first-bug added
- Owner set to stevenlinx
- Status changed from new to assigned
@stevenlinx Assigning to you to mark the good-first-bug ticket as claimed.
#17
@
6 years ago
- Keywords needs-refresh added
@stevenlinx thanks for your work on this! Sorry that this ticket has not seen any activity in quite a while.
Are you able to refresh your patch to apply cleanly to trunk
?
#18
@
6 years ago
- Keywords needs-refresh removed
I refreshed the patch and did some changes. Since
$comment_id = absint( $_GET['c'] );
$comment = get_comment( $comment_id );
is already defined above, I remove those inside the editcomment
and spam
switch clause to prevent multiple calls to it.
#19
@
6 years ago
- Milestone changed from Future Release to 5.3
- Owner changed from stevenlinx to SergeyBiryukov
- Status changed from assigned to reviewing
#20
@
5 years ago
Regarding the wording of:
You can’t operate on this comment because the associated post is in the Trash. Please restore the post first, then try again.
I wonder if we should replace operate on
with edit
as the action is editcomment
and also to have it in line with the other similar messages:
You can’t edit this attachment because it is in the Trash. Please move it out of the Trash and try again.
and
You can’t edit this item because it is in the Trash. Please restore it and try again.
Probably better considered in another ticket, but I think it would be helpful to have a link to the corresponding item in the Trash list table, within the message, so it becomes easier to find the trashed item.
Currently one can filter the list tables by a single post ID with the
subpost_id
query variable but it seems to be related to attachment_id
and is deprecated according to https://core.trac.wordpress.org/ticket/38283#comment:2
#21
@
5 years ago
Sensible detailed error messages (as opposed to mysterious vague ones) with links for the publisher/editor to take positive action would be a big step forward for this issue.
Thanks @birgire!
This ticket was mentioned in Slack in #core by garrett-eclipse. View the logs.
5 years ago
#23
@
5 years ago
- Keywords needs-refresh needs-copy-review added; good-first-bug removed
- Milestone changed from 5.3 to 5.4
There's some great progress here, thanks everyone. As we're entering 5.3 Beta3 which comes with a string freeze I'm going to punt this to 5.4 as there's need of a copy review here.
P.S. @birgire I agree with your recommendation of using 'edit' instead of 'operate on' in this case.
#24
@
5 years ago
- Keywords needs-refresh needs-copy-review removed
I've revised the message to use the word 'edit'.
#25
@
5 years ago
- Keywords commit added
I have tested the latest patch 37826.6.diff and it applies cleanly. Also I think the error message for editing comments for posts that are the trash is clear enough.
#27
@
5 years ago
- Milestone changed from 5.4 to 5.5
- Owner changed from SergeyBiryukov to johnbillion
- Status changed from reviewing to accepted
- Type changed from defect (bug) to enhancement
#29
@
5 years ago
- Keywords needs-dev-note removed
37826.diff tidies up the formatting a little and removes the hover style for comment bubbles that aren't linked.
I think this is good to go.
Huh, that's terrible. What happens to comments of trashed posts that get deleted? They get deleted too?