You can no longer upvote your own posts
This commit is contained in:
parent
516a054c31
commit
c98f799d67
1 changed files with 7 additions and 0 deletions
|
@ -249,6 +249,13 @@ backend.postBulk = async ({page, id, user, cookies, sort}) => {
|
|||
backend.vote = async ({id, vote, user}) => {
|
||||
if (!id || (vote != 'down' && vote != 'up')) return {success: 'fail' };
|
||||
|
||||
var isCreator = (await db.all('SELECT * from post WHERE id = ?', [
|
||||
id
|
||||
]))[0].username == user;
|
||||
|
||||
if (isCreator)
|
||||
return {success: 'fail' };
|
||||
|
||||
await db.run('DELETE FROM vote WHERE username = ? AND id = ?', [
|
||||
user,
|
||||
id
|
||||
|
|
Loading…
Reference in a new issue