r107010 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r107009‎ | r107010 | r107011 >
Date:23:50, 21 December 2011
Author:bsitu
Status:ok
Tags:
Comment:
follow up to -r106843 - Fix the logic in "Mark As Helpful" Hook
Modified paths:
  • /trunk/extensions/MarkAsHelpful/api/ApiGetMarkAsHelpfulItem.php (modified) (history)
  • /trunk/extensions/MarkAsHelpful/api/ApiMarkAsHelpful.php (modified) (history)

Diff [purge]

Index: trunk/extensions/MarkAsHelpful/api/ApiGetMarkAsHelpfulItem.php
@@ -8,7 +8,9 @@
99 $params = $this->extractRequestParams();
1010
1111 // check if current user has permission to mark this item,
12 - $isAbleToMark = wfRunHooks( 'onMarkItemAsHelpful', array( 'mark', $params['type'], $params['item'], $wgUser ) );
 12+ $isAbleToMark = true;
 13+
 14+ wfRunHooks( 'onMarkItemAsHelpful', array( 'mark', $params['type'], $params['item'], $wgUser, &$isAbleToMark ) );
1315
1416 $HelpfulUserList = MarkAsHelpfulItem::getMarkAsHelpfulList( $params['type'], $params['item'] );
1517
Index: trunk/extensions/MarkAsHelpful/api/ApiMarkAsHelpful.php
@@ -11,8 +11,12 @@
1212
1313 $params = $this->extractRequestParams();
1414
 15+ $isAbleToMark = true;
 16+
1517 // Gives other extension the last chance to speicfy mark as helpful permission rules
16 - if ( !wfRunHooks( 'onMarkItemAsHelpful', array( $params['mahaction'], $params['type'], $params['item'], $wgUser ) ) ) {
 18+ wfRunHooks( 'onMarkItemAsHelpful', array( $params['mahaction'], $params['type'], $params['item'], $wgUser, &$isAbleToMark ) );
 19+
 20+ if ( !$isAbleToMark ) {
1721 $this->dieUsage( "You don't have permission to do that", 'permission-denied' );
1822 }
1923

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r106843Mark As Helpful APIs and backendbsitu19:30, 20 December 2011

Status & tagging log