adjusted to dom's remarks

This commit is contained in:
Andreas Rumpf 2017-01-02 20:49:27 +01:00
commit 9788e93676
4 changed files with 5 additions and 7 deletions

View file

@ -7,7 +7,7 @@ var db = open(connection="nimforum.db", user="postgres", password="",
db.exec(sql("update person set status = ?"), $User)
db.exec(sql("update person set status = ? where ban <> ''"), $Troll)
db.exec(sql("update person set status = ? where ban like '%spam%'"), $Spammer)
db.exec(sql("update person set status = ? where ban = 'DEACTIVATED' or ban = 'EMAILCONFIRMATION'"), $Inactive)
db.exec(sql("update person set status = ? where ban = 'DEACTIVATED' or ban = 'EMAILCONFIRMATION'"), $EmailUnconfirmed)
db.exec(sql("update person set status = ? where admin = 'true'"), $Admin)
close(db)

View file

@ -6,7 +6,7 @@
#
#
#proc genThreadsList(c: var TForumData, count: var int): string =
# const queryAdmin = sql"""select id, name, views, modified from thread
# const queryModAdmin = sql"""select id, name, views, modified from thread
# where id in (select thread from post where author in
# (select id from person where status not in ('Spammer') or id = ?))
# order by modified desc limit ?, ?"""
@ -41,7 +41,7 @@
</div>
</div>
<div id="talk-threads">
# for row in rows(db, if c.rank >= Moderator: queryAdmin else: query,
# for row in rows(db, if c.rank >= Moderator: queryModAdmin else: query,
# c.userId, $((c.pageNum-1) * ThreadsPerPage), $ThreadsPerPage):
# inc(count)
<div>

View file

@ -388,8 +388,7 @@ proc getBanErrorMsg(banValue: string; rank: Rank): string =
return "You have been banned: " & banValue
case rank
of Spammer: return "You are a spammer."
of Troll: return "You are a troll."
of Inactive: return "Your account has been deactivated."
of Troll: return "You have been banned."
of EmailUnconfirmed:
return "You need to confirm your email first."
of Moderated, User, Moderator, Admin:

View file

@ -3,10 +3,9 @@ type
Rank* = enum ## serialized as 'status'
Spammer ## spammer: every post is invisible
Troll ## troll: cannot write new posts
Inactive ## member is not inactive
EmailUnconfirmed ## member with unconfirmed email address
Moderated ## new member: posts manually reviewed before everybody
## can see them
User ## Ordinary user
Moderator ## Moderator: can ban/troll/moderate users
Moderator ## Moderator: can ban/moderate users
Admin ## Admin: can do everything