Commit 094e6221 authored by Marco Villegas's avatar Marco Villegas
Browse files

Issue #1208732 by aleshaczech, marvil07: Let vote in the same direction with a different value.

parent a5e06669
Loading
Loading
Loading
Loading
+9 −8
Changes for vud.theme.inc: 9 added lines, 8 removed lines.
Original line number Diff line number Diff line
@@ -352,15 +352,12 @@ function vud_vote($type, $content_id, $value, $tag, $widget, $token) {
      $value = -1;
    }
    else {
      $value = FALSE;
    }

    // Do not allow vote with the same value
    if ( ($casted_vote > 0 && $value > 0) || ($casted_vote < 0 && $value < 0) ) {
      $value = FALSE;
      // Invalid value.
      watchdog('vud', 'Invalid vote on @type @content_id, with value @value, tag @tag and token @token',
        array('@type' => $type, '@content_id' => $content_id, '@value' => $value, '@tag' => $tag, '@token' => $token));
      return;
    }

    if ($value !== FALSE) {
    $vote['value'] = $value;
    $vote['value_type'] = 'points';
    $tag = $tag ? $tag : variable_get('vud_tag', 'vote');
@@ -369,8 +366,12 @@ function vud_vote($type, $content_id, $value, $tag, $widget, $token) {
    $vote['content_type'] = $type;
    $votes = array(0 => $vote);
    drupal_alter('vud_votes', $votes);
      votingapi_set_votes($votes);

    // Do not allow to vote with the same value.
    if ($casted_vote == $votes[0]['value']) {
      return;
    }
    votingapi_set_votes($votes);
  }
  else {
    watchdog('vud',