Skip to content

Commit

Permalink
Add a confirm message to the "remove like" function to avoid toggling…
Browse files Browse the repository at this point in the history
… by mistake - partially addresses #2135

Signed-off-by: emanuele <emanuele45@gmail.com>
  • Loading branch information
emanuele45 committed Jul 25, 2015
1 parent c1a273d commit 1d26cf3
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions sources/controllers/Display.controller.php
Expand Up @@ -539,6 +539,9 @@ public function action_display()

// ajax controller for likes
loadJavascriptFile('like_posts.js', array('defer' => true));
addJavascriptVar(array(
'likemsg_are_you_sure' => JavaScriptEscape($txt['likemsg_are_you_sure']),
));
loadLanguage('Errors');

// Initiate likes and the tooltips for likes
Expand Down
1 change: 1 addition & 0 deletions themes/default/languages/english/index.english.php
Expand Up @@ -709,6 +709,7 @@
$txt['liked_by'] = 'Liked by:';
$txt['liked_you'] = 'You';
$txt['liked_more'] = 'more';
$txt['likemsg_are_you_sure'] = 'You already liked this message, are you sure you want to remove your like?';

$txt['unread_topics_visit'] = 'Recent Unread Topics';
$txt['unread_topics_visit_none'] = 'No unread topics found since your last visit. <a href="{unread_all_url}" class="linkbutton">Click here to try all unread topics</a>';
Expand Down
5 changes: 5 additions & 0 deletions themes/default/scripts/like_posts.js
Expand Up @@ -43,7 +43,12 @@

// Set the subAction to what they are doing
if (check.indexOf('unlike_button') >= 0)
{
if (!confirm(likemsg_are_you_sure))
return;

subAction = 'unlikepost';
}
else
subAction = 'likepost';

Expand Down

0 comments on commit 1d26cf3

Please sign in to comment.