r113700 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r113699‎ | r113700 | r113701 >
Date:01:04, 13 March 2012
Author:wikinaut
Status:new
Tags:
Comment:
follow up r113686 . correction of algorithm for voting for the last answer, this was wrongly treated as revoke action
Modified paths:
  • /trunk/extensions/AJAXPoll/AJAXPoll.php (modified) (history)
  • /trunk/extensions/AJAXPoll/AJAXPoll_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/AJAXPoll/AJAXPoll_body.php
@@ -317,9 +317,12 @@
318318
319319 // Different message depending on if the user has already voted or not, or is entitled to vote
320320
 321+ $canRevoke = false;
 322+
321323 if ( $wgUser->isAllowed( 'ajaxpoll-vote' ) ) {
322324 if ( isset( $row[0] ) ) {
323325 $message = $ourLastVoteDate;
 326+ $canRevoke = true;
324327 $lines[] = wfMsg( 'ajaxpoll-revoke-vote' );
325328 } else {
326329 $message = wfMsg( 'ajaxpoll-no-vote' );
@@ -336,8 +339,9 @@
337340
338341 for ( $i = 1; $i < count( $lines ); $i++ ) {
339342
340 - $vote = ( $i != count( $lines ) - 1 );
 343+ $vote = !( $canRevoke && ( $i == count( $lines ) - 1 ) );
341344 $voteValue = ( $vote ) ? $i : 0;
 345+
342346 $ans_no = $i - 1;
343347
344348 if ( $amountOfVotes == 0 ) {
Index: trunk/extensions/AJAXPoll/AJAXPoll.php
@@ -19,7 +19,7 @@
2020 * @author Jack Phoenix <jack@countervandalism.net>
2121 * @author Thomas Gries
2222 * @maintainer Thomas Gries
23 - * @version 1.68
 23+ * @version 1.69
2424 * @link http://www.mediawiki.org/wiki/Extension:AJAX_Poll Documentation
2525 */
2626
@@ -31,7 +31,7 @@
3232 $wgExtensionCredits['parserhook'][] = array(
3333 'path' => __FILE__,
3434 'name' => 'AJAX Poll',
35 - 'version' => '1.68 20120313',
 35+ 'version' => '1.69 20120313',
3636 'author' => array( 'Dariusz Siedlecki', 'Jack Phoenix', 'Thomas Gries' ),
3737 'descriptionmsg' => 'ajaxpoll-desc',
3838 'url' => 'https://www.mediawiki.org/wiki/Extension:AJAX_Poll',

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r113686added method for votersto revoke their vote.wikinaut23:56, 12 March 2012

Status & tagging log