r93427 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r93426‎ | r93427 | r93428 >
Date:20:32, 28 July 2011
Author:raindrift
Status:ok
Tags:
Comment:
changed api output for blacklisted entries to be something more correct and informative ("error" is misleading).
followup to r93137
Modified paths:
  • /trunk/extensions/TitleBlacklist/api/ApiQueryTitleBlacklist.php (modified) (history)
  • /trunk/extensions/TitleBlacklist/tests/ApiQueryTitleBlacklistTest.php (modified) (history)

Diff [purge]

Index: trunk/extensions/TitleBlacklist/tests/ApiQueryTitleBlacklistTest.php
@@ -45,9 +45,9 @@
4646 'tbaction' => 'create',
4747 ) );
4848
49 - $this->assertEquals( $listed[0]['titleblacklist']['result'], 'error', 'Listed title returns error');
 49+ $this->assertEquals( $listed[0]['titleblacklist']['result'], 'blacklisted', 'Listed title returns error');
5050 $this->assertEquals(
51 - $listed[0]['titleblacklist']['error'],
 51+ $listed[0]['titleblacklist']['reason'],
5252 "The title \"bar\" has been banned from creation.\nIt matches the following blacklist entry: <code>[Bb]ar #example blacklist entry</code>",
5353 'Listed title error text is as as expected'
5454 );
Index: trunk/extensions/TitleBlacklist/api/ApiQueryTitleBlacklist.php
@@ -65,8 +65,8 @@
6666 htmlspecialchars( $params['title'] ),
6767 );
6868
69 - $this->getResult()->addValue( 'titleblacklist', 'result', 'error' );
70 - $this->getResult()->addValue( 'titleblacklist', 'error', wfMsg($blacklisted->getErrorMessage('edit'), $result) );
 69+ $this->getResult()->addValue( 'titleblacklist', 'result', 'blacklisted' );
 70+ $this->getResult()->addValue( 'titleblacklist', 'reason', wfMsg($blacklisted->getErrorMessage('edit'), $result) );
7171 } else {
7272 // not blacklisted
7373 $this->getResult()->addValue( 'titleblacklist', 'result', 'ok' );

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r93137Added a workaround for the lack of RequestContext in 1.17, so this code can b...raindrift22:39, 25 July 2011

Status & tagging log