Last modified: 2012-05-04 16:43:10 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T36345, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 34345 - "Deleting comment" link doesn't work for Comments extension
"Deleting comment" link doesn't work for Comments extension
Status: RESOLVED FIXED
Product: MediaWiki extensions
Classification: Unclassified
Comments (Other open bugs)
unspecified
All All
: Normal normal with 1 vote (vote)
: ---
Assigned To: Jack Phoenix
: patch, patch-reviewed
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-02-12 02:53 UTC by frombc7197
Modified: 2012-05-04 16:43 UTC (History)
5 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments
Patch to fix Delete Comment (5.78 KB, patch)
2012-04-10 13:40 UTC, Edward
Details

Description frombc7197 2012-02-12 02:53:07 UTC
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.
Comment 1 azuriaweb 2012-02-21 08:29:46 UTC
Same problem for me. Also I can't answer to a comment. It's weird.
Except adding a message, looks like nothing really works. :(
Comment 2 Edward 2012-03-18 17:20:11 UTC
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.
Comment 3 Mark A. Hershberger 2012-03-19 17:04:32 UTC
Updated bug summary to be more descriptive
Comment 4 Edward 2012-04-10 13:40:26 UTC
Created attachment 10399 [details]
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.
Comment 5 Sumana Harihareswara 2012-04-10 18:47:15 UTC
Marking the patch as needing review. Thanks for the patch, Ed!
Comment 6 Sumana Harihareswara 2012-04-10 18:48:30 UTC
Also, Edward, feel free to get developer access https://www.mediawiki.org/wiki/Developer_access to submit future changes right into our Git repository.
Comment 7 Edward 2012-04-10 21:17:23 UTC
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.
Comment 8 frombc7197 2012-05-04 05:38:01 UTC
Thanks Edward! My wiki is fixed!
Comment 9 Jack Phoenix 2012-05-04 16:23:44 UTC
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! :-)
Comment 10 Sumana Harihareswara 2012-05-04 16:43:10 UTC
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!

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links