Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 10 additions & 11 deletions assets/js/ui.decklist.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@
that.attr('title', that.data('original-tooltip'));
$(that).removeClass('processing');
});
ui.send_like.call($('.social .social-icon-like'), event);
};

ui.setup_comment_form = function setup_comment_form()
Expand Down Expand Up @@ -163,26 +162,26 @@

ui.setup_social_icons = function setup_social_icons()
{

if(!app.user.data || app.user.data.is_author || app.user.data.is_liked) {
var element = $('.social .social-icon-like');
element.replaceWith($('<span class="social-icon-like"></span').html(element.html()));
var element;
if(!app.user.data || app.user.data.is_author) {
element = $('.social .social-icon-like');
element.replaceWith($('<span class="social-icon-like"></span>').html(element.html()));
}

if(!app.user.data) {
var element = $('.social .social-icon-favorite');
element.replaceWith($('<span class="social-icon-favorite"></span').html(element.html()));
element = $('.social .social-icon-favorite');
element.replaceWith($('<span class="social-icon-favorite"></span>').html(element.html()));
} else if(app.user.data.is_favorite) {
var element = $('.social .social-icon-favorite');
element = $('.social .social-icon-favorite');
element.attr('title', "Remove from favorites");
} else {
var element = $('.social .social-icon-favorite');
element = $('.social .social-icon-favorite');
element.attr('title', "Add to favorites");
}

if(!app.user.data) {
var element = $('.social .social-icon-comment');
element.replaceWith($('<span class="social-icon-comment"></span').html(element.html()));
element = $('.social .social-icon-comment');
element.replaceWith($('<span class="social-icon-comment"></span>').html(element.html()));
}

};
Expand Down
7 changes: 7 additions & 0 deletions src/Controller/SocialController.php
Original file line number Diff line number Diff line change
Expand Up @@ -913,6 +913,13 @@ public function voteAction(Request $request)
$decklist->setDateUpdate(new DateTime());
$decklist->setNbVotes($decklist->getNbVotes() + 1);
$this->getDoctrine()->getManager()->flush();
} else {
$user->removeVote($decklist);
$author = $decklist->getUser();
$author->setReputation($author->getReputation() - 1);
$decklist->setDateUpdate(new DateTime());
$decklist->setNbVotes($decklist->getNbVotes() - 1);
$this->getDoctrine()->getManager()->flush();
}
}

Expand Down