Let users delete their own posts, fixes #208

This commit is contained in:
hlaaftana 2020-04-15 10:29:42 +03:00 committed by GitHub
commit d8661f62c7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -716,7 +716,7 @@ proc executeDeletePost(c: TForumData, postId: int) =
"""
let id = getValue(db, postQuery, c.username, postId)
if id.len == 0 and c.rank < Admin:
if id.len == 0 and (c.rank == Admin or c.userid == postRow[0]):
raise newForumError("You cannot delete this post")
# Set the `isDeleted` flag.