Page MenuHomePhabricator

"Deleting comment" link doesn't work for Comments extension
Closed, ResolvedPublic

Description

Author: frombc7197

Description:
HI, I installed comment extension in my mediawiki.

I posted a test comment. It works. But I didn't delete test comment. 'delete comment' link is not work. I don't know why it doesn't work.


Version: unspecified
Severity: normal

Details

Reference
bz34345

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 22 2014, 12:10 AM
bzimport set Reference to bz34345.

azuriaweb wrote:

Same problem for me. Also I can't answer to a comment. It's weird.
Except adding a message, looks like nothing really works. :(

edwardquick wrote:

Same here. Using clean install of mediawiki 1.18.1, and subversion code checked out on 18/03/2012. I can post comments, and see the delete comment button but clicking this does not delete the comment.

Updated bug summary to be more descriptive

edwardquick wrote:

Patch to fix Delete Comment

The delete comment code in Comment.php never gets called because before reaching this with a POST, the user receives a 302. I'm not sure where the 302 comes from, possibly the action=purge parameter in the initial POST?

if( isset( $_POST['commentid'] ) ) { // isset added by misza

$comment->setCommentID( $_POST['commentid'] );
$comment->delete();

}

Anyway, I've tried to get the delete comment functionality working in the same way as other functions such as blockUser, and this looks better now.

Thanks,
Ed.

Attached:

sumanah wrote:

Marking the patch as needing review. Thanks for the patch, Ed!

sumanah wrote:

Also, Edward, feel free to get developer access https://www.mediawiki.org/wiki/Developer_access to submit future changes right into our Git repository.

edwardquick wrote:

Thanks Sumana. I'm sure the patch works but not 100% confident I've understood all the code. There was a delete function in the CommentClass.php already but I wasn't sure how to use this, so I added a deleteComment function. This may or may not be the right way forward but I expect your reviewer will be able to pick that out if it's not.
Ed.

frombc7197 wrote:

Thanks Edward! My wiki is fixed!

Hi Edward!

Firstly, I'm terribly sorry about the delay. I've been busy in real life and with other online projects, so I've kinda forgotten about Bugzilla and reviewing patches. Sorry!

That being said, I took a look at your patch and improved it a bit and committed it to SVN in r115137. In addition to changing indentation (we use tabs for indentation, not spaces), I got rid of the deleteComment() function in favor of constructing a Comment object in wfDeleteComment and calling setCommentID() there.

I also added some permission checks to wfDeleteComment, so that blocked users not users without the 'commentadmin' permission cannot delete comments by callng that function manually.

I moved the question mark into the 'comment-delete-warning' i18n message from the JS file because "Lego" construction of i18n is considered bad practise. The reason why the 'comment-block-warning' does that is because it has a parameter -- that parameter is either 'comment-block-anon', or 'comment-block-user', followed by the name of the person we want to block. Ugly and hacky, but this extension predates ResourceLoader.

Thanks for fixing a pretty major and annoying bug, Edward! :-)

sumanah wrote:

And Edward, I encourage you to get developer access so you can get your code reviewed even faster in the future (for extensions that are in Git; this extension is still in Subversion). More info at https://www.mediawiki.org/wiki/Git_conversion#Affected_development_projects .

Thanks, Edward!