Index: trunk/extensions/AbuseFilter/Views/AbuseFilterViewTestBatch.php |
— | — | @@ -124,7 +124,7 @@ |
125 | 125 | |
126 | 126 | $this->mFilter = $wgRequest->getText( 'wpTestFilter' ); |
127 | 127 | $this->mShowNegative = $wgRequest->getBool( 'wpShowNegative' ); |
128 | | - $this->mTestUser = $wgRequest->getText( 'wpTestUser' ); |
| 128 | + $testUsername = $wgRequest->getText( 'wpTestUser' ); |
129 | 129 | $this->mTestPeriodEnd = $wgRequest->getText( 'wpTestPeriodEnd' ); |
130 | 130 | $this->mTestPeriodStart = $wgRequest->getText( 'wpTestPeriodStart' ); |
131 | 131 | |
— | — | @@ -137,5 +137,17 @@ |
138 | 138 | array( 'af_id' => $this->mParams[1] ), |
139 | 139 | __METHOD__ ); |
140 | 140 | } |
| 141 | + |
| 142 | + // Normalise username |
| 143 | + $userTitle = Title::newFromText( $testUsername ); |
| 144 | + |
| 145 | + if ( $userTitle && $userTitle->getNamespace() == NS_USER ) |
| 146 | + $this->mTestUser = $userTitle->getText(); // Allow User:Blah syntax. |
| 147 | + elseif ( $userTitle ) |
| 148 | + // Not sure of the value of prefixedText over text, but no need to munge unnecessarily. |
| 149 | + $this->mTestUser = $userTitle->getPrefixedText(); |
| 150 | + else |
| 151 | + $this->mTestUser = null; // No user specified. |
| 152 | + |
141 | 153 | } |
142 | 154 | } |
Index: trunk/extensions/AbuseFilter/Views/AbuseFilterViewExamine.php |
— | — | @@ -203,10 +203,21 @@ |
204 | 204 | |
205 | 205 | function loadParameters() { |
206 | 206 | global $wgRequest; |
207 | | - $this->mSearchUser = $wgRequest->getText( 'wpSearchUser' ); |
| 207 | + $searchUsername = $wgRequest->getText( 'wpSearchUser' ); |
208 | 208 | $this->mSearchPeriodStart = $wgRequest->getText( 'wpSearchPeriodStart' ); |
209 | 209 | $this->mSearchPeriodEnd = $wgRequest->getText( 'wpSearchPeriodEnd' ); |
210 | 210 | $this->mSubmit = $wgRequest->getCheck( 'submit' ); |
211 | 211 | $this->mTestFilter = $wgRequest->getText( 'testfilter' ); |
| 212 | + |
| 213 | + // Normalise username |
| 214 | + $userTitle = Title::newFromText( $searchUsername ); |
| 215 | + |
| 216 | + if ( $userTitle->getNamespace() == NS_USER ) |
| 217 | + $this->mSearchUser = $userTitle->getText(); // Allow User:Blah syntax. |
| 218 | + elseif ( $userTitle ) |
| 219 | + // Not sure of the value of prefixedText over text, but no need to munge unnecessarily. |
| 220 | + $this->mSearchUser = $userTitle->getPrefixedText(); |
| 221 | + else |
| 222 | + $this->mSearchUser = ''; |
212 | 223 | } |
213 | 224 | } |