follow up r113686 . correction of algorithm for voting for the last answer, this was wrongly treated as revoke action

This commit is contained in:
Thomas Gries 2012-03-13 01:04:59 +00:00
parent 4822adcaca
commit a213ded538
Notes: Thomas Gries 2012-03-13 01:04:59 +00:00
2 changed files with 7 additions and 3 deletions

View file

@ -19,7 +19,7 @@
* @author Jack Phoenix <jack@countervandalism.net>
* @author Thomas Gries
* @maintainer Thomas Gries
* @version 1.68
* @version 1.69
* @link http://www.mediawiki.org/wiki/Extension:AJAX_Poll Documentation
*/
@ -31,7 +31,7 @@ if( !defined( 'MEDIAWIKI' ) ) {
$wgExtensionCredits['parserhook'][] = array(
'path' => __FILE__,
'name' => 'AJAX Poll',
'version' => '1.68 20120313',
'version' => '1.69 20120313',
'author' => array( 'Dariusz Siedlecki', 'Jack Phoenix', 'Thomas Gries' ),
'descriptionmsg' => 'ajaxpoll-desc',
'url' => 'https://www.mediawiki.org/wiki/Extension:AJAX_Poll',

View file

@ -317,9 +317,12 @@ function mout(x){
// Different message depending on if the user has already voted or not, or is entitled to vote
$canRevoke = false;
if ( $wgUser->isAllowed( 'ajaxpoll-vote' ) ) {
if ( isset( $row[0] ) ) {
$message = $ourLastVoteDate;
$canRevoke = true;
$lines[] = wfMsg( 'ajaxpoll-revoke-vote' );
} else {
$message = wfMsg( 'ajaxpoll-no-vote' );
@ -336,8 +339,9 @@ function mout(x){
for ( $i = 1; $i < count( $lines ); $i++ ) {
$vote = ( $i != count( $lines ) - 1 );
$vote = !( $canRevoke && ( $i == count( $lines ) - 1 ) );
$voteValue = ( $vote ) ? $i : 0;
$ans_no = $i - 1;
if ( $amountOfVotes == 0 ) {