Commit 7e01a25c 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 efa0e742
Loading
Loading
Loading
Loading
+9 −4
Changes for vud.theme.inc: 9 added lines, 4 removed lines.
Original line number Diff line number Diff line
@@ -395,10 +395,10 @@ function vud_vote($type, $entity_id, $value, $tag, $widget, $token, $ajax = 'aja
  elseif ($value < 0) {
    $value = -1;
  }


  if ($value == 0 || ($casted_vote > 0 && $value > 0) || ($casted_vote < 0 && $value < 0)) {
    // Do not allow vote with the same value.
  else {
    // 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;
  }

@@ -410,6 +410,11 @@ function vud_vote($type, $entity_id, $value, $tag, $widget, $token, $ajax = 'aja
  $vote['entity_type'] = $type;
  $votes = array(0 => $vote);
  drupal_alter('vud_votes', $votes);

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

  if ($ajax == 'ajax') {