Index: trunk/extensions/CodeReview/api/ApiRevisionUpdate.php |
— | — | @@ -37,6 +37,11 @@ |
38 | 38 | $this->dieUsage( 'You do not have permission to post comment', 'permissiondenied' ); |
39 | 39 | } |
40 | 40 | |
| 41 | + global $wgCodeReviewInlineComments; |
| 42 | + if( !$wgCodeReviewInlineComments ) { |
| 43 | + $params['patchline'] = null; |
| 44 | + } |
| 45 | + |
41 | 46 | $repo = CodeRepository::newFromName( $params['repo'] ); |
42 | 47 | if ( !$repo ) { |
43 | 48 | $this->dieUsage( "Invalid repo ``{$params['repo']}''", 'invalidrepo' ); |
— | — | @@ -89,7 +94,7 @@ |
90 | 95 | |
91 | 96 | public function getAllowedParams() { |
92 | 97 | $flags = CodeRevision::getPossibleFlags(); |
93 | | - return array( |
| 98 | + $params = array( |
94 | 99 | 'repo' => array( |
95 | 100 | ApiBase::PARAM_TYPE => 'string', |
96 | 101 | ApiBase::PARAM_REQUIRED => true, |
— | — | @@ -129,11 +134,15 @@ |
130 | 135 | ApiBase::PARAM_TYPE => 'integer', |
131 | 136 | ApiBase::PARAM_ISMULTI => true, |
132 | 137 | ), |
133 | | - 'patchline' => array( |
| 138 | + ); |
| 139 | + global $wgCodeReviewInlineComments; |
| 140 | + if( $wgCodeReviewInlineComments ) { |
| 141 | + $params['patchline'] = array( |
134 | 142 | ApiBase::PARAM_TYPE => 'integer', |
135 | 143 | ApiBase::PARAM_MIN => 1, |
136 | | - ), |
137 | | - ); |
| 144 | + ); |
| 145 | + } |
| 146 | + return $params; |
138 | 147 | } |
139 | 148 | |
140 | 149 | public function getParamDescription() { |
Index: trunk/extensions/CodeReview/ui/CodeRevisionView.php |
— | — | @@ -75,6 +75,7 @@ |
76 | 76 | |
77 | 77 | function execute() { |
78 | 78 | global $wgOut, $wgLang; |
| 79 | + global $wgCodeReviewInlineComments; |
79 | 80 | if ( !$this->mRepo ) { |
80 | 81 | $view = new CodeRepoListView(); |
81 | 82 | $view->execute(); |
— | — | @@ -204,10 +205,12 @@ |
205 | 206 | // Encode revision id for our modules |
206 | 207 | $encRev = Xml::encodeJsVar( $this->mRev->getId() ); |
207 | 208 | |
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 | + } |
212 | 215 | |
213 | 216 | $wgOut->addModules( 'ext.codereview.tags' ); |
214 | 217 | $wgOut->addInlineScript( |
Index: trunk/extensions/CodeReview/CodeReview.php |
— | — | @@ -210,6 +210,13 @@ |
211 | 211 | $wgCodeReviewImgRegex = '/\.(png|jpg|jpeg|gif)$/i'; |
212 | 212 | |
213 | 213 | /** |
| 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 | +/** |
214 | 221 | * Maximum size of diff text before it is omitted from the revision view |
215 | 222 | */ |
216 | 223 | $wgCodeReviewMaxDiffSize = 500000; |