Since 4.4, it has not been possible to delete a comment alone if that comment has replies; the replies are also deleted. This presents an administrative problem when a comment that is to be removed has replies that should not be.

This patch provides the ability to delete a single comment. In place of the current 'Delete' button on the confirmation page, there are two buttons: 'Delete Thread', which is just the current operation renamed, and 'Delete Comment', which removes only the selected comment, re-parenting and re-threading its replies up to the deleted comment's parent.

This patch moves the code to build a new comment thread value into a separate function, which is called to provide new thread values for the children of the deleted comment. Deeper descendents then have their thread values modified to match.

(Although I have not done so, this code could be directly adapted to move a comment up a level, without any deletion. If there is support for the idea, I may generalize this to provide operations for moving comments within the thread hierarchy.)

CommentFileSizeAuthor
#10 comment-delete-one.patch10.06 KBkps
comment.module_0.patch9.43 KBkps
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

kps’s picture

Verified that the above patch applies to the current CVS version.

killes@www.drop.org’s picture

I think it is quite useless to remove a single comment from a threaded discussion without removing the children of the comment in question. If you don't people won't know what the commentors are speaking about.

What could be usefull is a way to move comments to other parents (either comments or nodes).

kps’s picture

I think it is quite useless to remove a single comment from a threaded discussion without removing the children of the comment in question. If you don't people won't know what the commentors are speaking about.

You are assuming that the replies in a thread are in fact related to the parent comment. Not every site has drupal.org's user base! Non-technical users routinely read down to the bottom of a page and then click 'reply' on the last comment; they don't scroll up to find the node body and the 'add new comment' link. Threads regularly grow chains of unrelated comments.

(Translating 'reply' into 'reply to this comment' helped a little, but not enough. Disabling flat mode might help a little too -- but, you know what? Users happily create threads of unrelated comments, but complain when they're shown nested unrelated comments.)

In the current (unpatched) state of things, there are messes that an administrator can't clean up.

What could be usefull is a way to move comments to other parents (either comments or nodes).

Yes, that would also be useful, and as I said in my first post, I might do that if it doesn't seem like a waste of time.

However, the ability to delete a single comment is still necessary. Consider: an administrator is looking at the list of comments (admin/comment) and spots one to be deleted. The administrator clicks the handy 'delete' link. The administrator -- someone I recommended Drupal to; someone reasonably competent technically but not a programmer -- says to me (paraphrased for family audiences): "I want to delete that comment. I don't want to delete a whole bunch of comments. It doesn't even tell me what whole bunch of comments I'm about to delete. It doesn't even tell me if there are any other comments that would get deleted."

If this weren't an actual real life problem I wouldn't have bothered to implement it; the thread structure isn't exactly edit-friendly.

moshe weitzman’s picture

I certainly would support adding the ability for admins to split off a tangent thread into its own thread. this is a feature of sophisticated forums. this helps keep threads on topic.

+1 for deleting a single comment as well. this is indeed a common problem. lots of trolls in this world.

Dries’s picture

Just like Moshe, I think it could be useful to move a thread. Once you could move a thread, you can also delete individual comments (though it might involve some extra work).

TDobes’s picture

I am vehemently against adding longer (and additional) links on comments... If there needs to be an option to delete the entire thread, it should be presented as a checkbox on the delete confirmation page, IMO.

That said, I agree with the others that I would like to see the ability to adjust a comment's position within a thread... perhaps a better solution might be leaving the delete functionality as-is (but noting that it will delete all children of the current comment on the confirmation page), and adding the ability to move comments.

Gábor Hojtsy’s picture

On breaking threads, there should be a feature to take a comment and all its replies, and make a node out of the comment. This is a contrib project concept for sure, but is strongly related to this suggestion.

Dries’s picture

Anonymous’s picture

Is it likely that there will be a way to move a comment or a set of comments to a new/other existing node? The idea doesn't seem that technically difficult, but is somewhat essential for directing content to the right places where users make mistakes...

Thanks in advance.

kps’s picture

Version: » 4.6.0
FileSize
10.06 KB

Attached is a 4.6 version of the above patch.

magico’s picture

Version: 4.6.0 » x.y.z

Patchs for "Feature requests" will not be applied to other versions than the CVS.
Is this feature important to be worked in the current CVS?

Heine’s picture

@ 7 & 9: Comment mover gives one the ability to move comment threads, and make nodes from them.

killes@www.drop.org’s picture

Status: Active » Fixed

I consider thie request fixed by the presence of this mighty fine module.

Anonymous’s picture

Status: Fixed » Closed (fixed)