Fixes editing for ordinary users and new thread field name.

This commit is contained in:
Dominik Picheta 2018-05-20 13:09:16 +01:00
commit bfa5bfe4d9
2 changed files with 2 additions and 2 deletions

View file

@ -1076,7 +1076,7 @@ proc updatePost(c: TForumData, postId: int, content: string,
# Verify that the current user has permissions to edit the specified post.
let creation = fromUnix(postRow[1].parseInt)
let isArchived = (getTime() - creation).weeks > 8
let canEdit = c.rank == Admin or c.username == postRow[0]
let canEdit = c.rank == Admin or c.userid == postRow[0]
if isArchived:
raise newForumError("This post is archived and can no longer be edited")
if not canEdit:

View file

@ -49,7 +49,7 @@ when defined(js):
tdiv(class="title"):
p(): text "New Thread"
tdiv(class="content"):
input(class="form-input", `type`="text", name="username",
input(class="form-input", `type`="text", name="subject",
placeholder="Type the title here",
onChange=(e: Event, n: VNode) => onSubjectChange(e, n, state))
if state.error.isSome():