From f5e1a71e6eb678425f05e465682fb0b875fc4378 Mon Sep 17 00:00:00 2001 From: hlaaftana <10591326+hlaaftana@users.noreply.github.com> Date: Sun, 10 May 2020 17:00:39 +0300 Subject: [PATCH] add clear variables --- src/forum.nim | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/forum.nim b/src/forum.nim index 88a6d5e..5d55670 100644 --- a/src/forum.nim +++ b/src/forum.nim @@ -714,9 +714,12 @@ proc executeDeletePost(c: TForumData, postId: int) = select p.author, p.id from post p where p.author = ? and p.id = ? """ - let postRow = getRow(db, postQuery, c.username, postId) + let + row = getRow(db, postQuery, c.username, postId) + author = row[0] + id = row[1] - if postRow[1].len == 0 and not (c.rank == Admin or c.userid == postRow[0]): + if id.len == 0 and not (c.rank == Admin or c.userid == author): raise newForumError("You cannot delete this post") # Set the `isDeleted` flag.