From 7184c245102d40e712dba7a1e0fd9fc518596f19 Mon Sep 17 00:00:00 2001 From: Daniel Bailey Date: Tue, 17 Sep 2019 22:26:06 +0100 Subject: [PATCH] Don't deliver deleted comments to the client, fixes #2 --- index.cgi | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/index.cgi b/index.cgi index 72df8a2..8f0c307 100755 --- a/index.cgi +++ b/index.cgi @@ -104,18 +104,17 @@ def change_review_status(db, reviewId, closed): def list_comments(db, reviewId): processedResults = [] cur = db.cursor() - cur.execute("SELECT comments.id, comments.hash, comments.author, comments.pageId, comments.type, comments.msg, comments.status, comments.rects, comments.replyToId, comments.timestamp, comments.deleted, myread.myread FROM comments LEFT JOIN myread ON comments.hash=myread.commenthash AND comments.reviewid=myread.reviewid AND myread.reader=%s WHERE comments.reviewid=%s ORDER BY comments.id ASC;", (login_email, reviewId)) + cur.execute("SELECT comments.id, comments.hash, comments.author, comments.pageId, comments.type, comments.msg, comments.status, comments.rects, comments.replyToId, comments.timestamp, myread.myread FROM comments LEFT JOIN myread ON comments.hash=myread.commenthash AND comments.reviewid=myread.reviewid AND myread.reader=%s WHERE comments.deleted = 0 AND comments.reviewid=%s ORDER BY comments.id ASC;", (login_email, reviewId)) result = cur.fetchall() cur.close() if result: - for (id, hash, author, pageId, type, msg, status, rects, replyToId, timestamp, deleted, read) in result: + for (id, hash, author, pageId, type, msg, status, rects, replyToId, timestamp, read) in result: tmp = { "id": hash, "author": author, "msg": msg, "status": status, "secs_UTC": timestamp, - "deleted": deleted, "owner": (author == login_name) } if (pageId is not None): tmp["pageId"] = pageId