r41906 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r41905‎ | r41906 | r41907 >
Date:23:51, 9 October 2008
Author:aaron
Status:old
Tags:
Comment:
Check 'codereview-post-comment'
Modified paths:
  • /trunk/extensions/CodeReview/CodeRevisionView.php (modified) (history)

Diff [purge]

Index: trunk/extensions/CodeReview/CodeRevisionView.php
@@ -120,8 +120,7 @@
121121
122122 function checkPostings() {
123123 global $wgRequest, $wgUser;
124 - if( $wgRequest->wasPosted()
125 - && $wgUser->matchEditToken( $wgRequest->getVal( 'wpEditToken' ) ) ) {
 124+ if( $wgRequest->wasPosted() && $wgUser->matchEditToken( $wgRequest->getVal('wpEditToken') ) ) {
126125 // Look for a posting...
127126 $text = $wgRequest->getText( "wpReply{$this->mReplyTarget}" );
128127 $parent = $wgRequest->getIntOrNull( 'wpParent' );
@@ -130,9 +129,8 @@
131130 if( $isPreview ) {
132131 // Save the text for reference on later comment display...
133132 $this->mPreviewText = $text;
134 - } else if( strlen($text) ) { // don't save blank comments
 133+ } else if( $wgUser->isAllowed('codereview-post-comment') && strlen($text) ) {
135134 $id = $this->mRev->saveComment( $text, $review, $parent );
136 -
137135 // Redirect to the just-saved comment; this avoids POST
138136 // horrors on forward/rewind. Hope we don't have slave issues?
139137 $permaLink = $this->commentLink( $id );
@@ -329,6 +327,9 @@
330328 }
331329 $repo = $this->mRepo->getName();
332330 $rev = $this->mRev->getId();
 331+ if( !$wgUser->isAllowed('codereview-post-comment') ) {
 332+ return '';
 333+ }
333334 return '<div class="mw-codereview-post-comment">' .
334335 $preview .
335336 Xml::hidden( 'wpEditToken', $wgUser->editToken() ) .

Status & tagging log