From 65ce8a50b318b2a2d611727cb4a05062a52b6a3a Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Mon, 16 Nov 2015 15:02:24 -0500 Subject: [PATCH] Removed cant-vote-self-post As suggested in nodebb/nodebb-theme-persona#203, a positive action has been applied when a user attempts to upvote their own post. It will now open the upvoters modal instead of throwing an alertError. Closes nodebb/nodebb-theme-persona#203 --- public/language/en_GB/error.json | 1 - public/src/client/topic/postTools.js | 4 +++- src/favourites.js | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/public/language/en_GB/error.json b/public/language/en_GB/error.json index 720541d0c1..4159d211d8 100644 --- a/public/language/en_GB/error.json +++ b/public/language/en_GB/error.json @@ -62,7 +62,6 @@ "file-too-big": "Maximum allowed file size is %1 kB - please upload a smaller file", - "cant-vote-self-post": "You cannot vote for your own post", "already-favourited": "You have already favourited this post", "already-unfavourited": "You have already unfavourited this post", diff --git a/public/src/client/topic/postTools.js b/public/src/client/topic/postTools.js index 0d36139403..423637e21e 100644 --- a/public/src/client/topic/postTools.js +++ b/public/src/client/topic/postTools.js @@ -255,7 +255,9 @@ define('forum/topic/postTools', ['share', 'navigator', 'components', 'translator pid: post.attr('data-pid'), room_id: app.currentRoom }, function(err) { - if (err) { + if (err.message === 'self-vote') { + showVotes(post.attr('data-pid')); + } else { app.alertError(err.message); } }); diff --git a/src/favourites.js b/src/favourites.js index c55702b433..c5d71f6de2 100644 --- a/src/favourites.js +++ b/src/favourites.js @@ -204,7 +204,7 @@ var async = require('async'), } if (parseInt(uid, 10) === parseInt(results.owner, 10)) { - return callback(new Error('[[error:cant-vote-self-post]]')); + return callback(new Error('self-vote')); } var voteStatus = results.voteStatus,