Minor cleanup

This commit is contained in:
Joey Yakimowich-Payne 2020-02-19 16:57:50 -07:00 committed by Andreas Rumpf
commit 7ec3ff9cac

View file

@ -151,7 +151,7 @@ proc checkLoggedIn(c: TForumData) =
)
c.previousVisitAt = personRow[1].parseInt
let diff = getTime() - fromUnix(personRow[0].parseInt)
if diff.minutes > 30:
if diff.inMinutes > 30:
c.previousVisitAt = personRow[0].parseInt
db.exec(
sql"""
@ -238,7 +238,7 @@ proc verifyIdentHash(
let newIdent = makeIdentHash(name, row[0], epoch, row[1])
# Check that it hasn't expired.
let diff = getTime() - epoch.fromUnix()
if diff.hours > 2:
if diff.inHours > 2:
raise newForumError("Link expired")
if newIdent != ident:
raise newForumError("Invalid ident hash")
@ -498,7 +498,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 isArchived = (getTime() - creation).inWeeks > 8
let canEdit = c.rank == Admin or c.userid == postRow[0]
if isArchived:
raise newForumError("This post is archived and can no longer be edited")