r99030 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r99029‎ | r99030 | r99031 >
Date:19:14, 5 October 2011
Author:hashar
Status:reverted (Comments)
Tags:
Comment:
disable inline commenting by default

One can enable it with $wgCodeReviewInlineComments = true;
This should be safe enough to have CodeReview extension deployed.
Modified paths:
  • /trunk/extensions/CodeReview/CodeReview.php (modified) (history)
  • /trunk/extensions/CodeReview/api/ApiRevisionUpdate.php (modified) (history)
  • /trunk/extensions/CodeReview/ui/CodeRevisionView.php (modified) (history)

Diff [purge]

Index: trunk/extensions/CodeReview/api/ApiRevisionUpdate.php
@@ -37,6 +37,11 @@
3838 $this->dieUsage( 'You do not have permission to post comment', 'permissiondenied' );
3939 }
4040
 41+ global $wgCodeReviewInlineComments;
 42+ if( !$wgCodeReviewInlineComments ) {
 43+ $params['patchline'] = null;
 44+ }
 45+
4146 $repo = CodeRepository::newFromName( $params['repo'] );
4247 if ( !$repo ) {
4348 $this->dieUsage( "Invalid repo ``{$params['repo']}''", 'invalidrepo' );
@@ -89,7 +94,7 @@
9095
9196 public function getAllowedParams() {
9297 $flags = CodeRevision::getPossibleFlags();
93 - return array(
 98+ $params = array(
9499 'repo' => array(
95100 ApiBase::PARAM_TYPE => 'string',
96101 ApiBase::PARAM_REQUIRED => true,
@@ -129,11 +134,15 @@
130135 ApiBase::PARAM_TYPE => 'integer',
131136 ApiBase::PARAM_ISMULTI => true,
132137 ),
133 - 'patchline' => array(
 138+ );
 139+ global $wgCodeReviewInlineComments;
 140+ if( $wgCodeReviewInlineComments ) {
 141+ $params['patchline'] = array(
134142 ApiBase::PARAM_TYPE => 'integer',
135143 ApiBase::PARAM_MIN => 1,
136 - ),
137 - );
 144+ );
 145+ }
 146+ return $params;
138147 }
139148
140149 public function getParamDescription() {
Index: trunk/extensions/CodeReview/ui/CodeRevisionView.php
@@ -75,6 +75,7 @@
7676
7777 function execute() {
7878 global $wgOut, $wgLang;
 79+ global $wgCodeReviewInlineComments;
7980 if ( !$this->mRepo ) {
8081 $view = new CodeRepoListView();
8182 $view->execute();
@@ -204,10 +205,12 @@
205206 // Encode revision id for our modules
206207 $encRev = Xml::encodeJsVar( $this->mRev->getId() );
207208
208 - $wgOut->addModules( 'ext.codereview.linecomment' );
209 - $wgOut->addInLineScript(
210 - "CodeReview.lcInit( $encRev );"
211 - );
 209+ if( $wgCodeReviewInlineComments ) {
 210+ $wgOut->addModules( 'ext.codereview.linecomment' );
 211+ $wgOut->addInLineScript(
 212+ "CodeReview.lcInit( $encRev );"
 213+ );
 214+ }
212215
213216 $wgOut->addModules( 'ext.codereview.tags' );
214217 $wgOut->addInlineScript(
Index: trunk/extensions/CodeReview/CodeReview.php
@@ -210,6 +210,13 @@
211211 $wgCodeReviewImgRegex = '/\.(png|jpg|jpeg|gif)$/i';
212212
213213 /**
 214+ * Whether to enable the experimental inline commenting feature. This
 215+ * let you add comments inside the diff output. The feature is highly
 216+ * experimental and has bugs so the default is false.
 217+ */
 218+$wgCodeReviewInlineComments = false;
 219+
 220+/**
214221 * Maximum size of diff text before it is omitted from the revision view
215222 */
216223 $wgCodeReviewMaxDiffSize = 500000;

Follow-up revisions

RevisionCommit summaryAuthorDate
r99034API: give error when trying not attach a comment to a line...hashar19:40, 5 October 2011
r108350Reverting inline commenting from CodeReview...johnduhart06:55, 8 January 2012

Comments

#Comment by Reedy (talk | contribs)   19:17, 5 October 2011

We usually don't optionally have API parameters... Just always have them and throw an error if a disabled parameter is called...

Status & tagging log