Index: trunk/extensions/CodeReview/api/ApiRevisionUpdate.php |
— | — | @@ -38,8 +38,11 @@ |
39 | 39 | } |
40 | 40 | |
41 | 41 | global $wgCodeReviewInlineComments; |
42 | | - if( !$wgCodeReviewInlineComments ) { |
43 | | - $params['patchline'] = null; |
| 42 | + if( |
| 43 | + !$wgCodeReviewInlineComments |
| 44 | + && isset( $params['patchline'] ) |
| 45 | + ) { |
| 46 | + $this->dieUsage( "Can not attach a comment to a diff when inline commenting is disabled (\$wgCodeReviewInlineComments is false)." ); |
44 | 47 | } |
45 | 48 | |
46 | 49 | $repo = CodeRepository::newFromName( $params['repo'] ); |
— | — | @@ -94,7 +97,7 @@ |
95 | 98 | |
96 | 99 | public function getAllowedParams() { |
97 | 100 | $flags = CodeRevision::getPossibleFlags(); |
98 | | - $params = array( |
| 101 | + return array( |
99 | 102 | 'repo' => array( |
100 | 103 | ApiBase::PARAM_TYPE => 'string', |
101 | 104 | ApiBase::PARAM_REQUIRED => true, |
— | — | @@ -134,15 +137,11 @@ |
135 | 138 | ApiBase::PARAM_TYPE => 'integer', |
136 | 139 | ApiBase::PARAM_ISMULTI => true, |
137 | 140 | ), |
138 | | - ); |
139 | | - global $wgCodeReviewInlineComments; |
140 | | - if( $wgCodeReviewInlineComments ) { |
141 | | - $params['patchline'] = array( |
| 141 | + 'patchline' => array( |
142 | 142 | ApiBase::PARAM_TYPE => 'integer', |
143 | 143 | ApiBase::PARAM_MIN => 1, |
144 | | - ); |
145 | | - } |
146 | | - return $params; |
| 144 | + ), |
| 145 | + ); |
147 | 146 | } |
148 | 147 | |
149 | 148 | public function getParamDescription() { |