Allow logged in users to "hit" their own paste

Increments the view counter in an edge case where the logged in
user is viewing their own paste.
This commit is contained in:
Robin Malley 2020-10-12 00:15:38 +00:00
parent 8825e000c2
commit 4c65fc3692
1 changed files with 5 additions and 0 deletions

View File

@ -853,6 +853,11 @@ function read(req)
--the page, since it'll have an edit button on it. --the page, since it'll have an edit button on it.
assert(err == sql.ROW) assert(err == sql.ROW)
local title, storytext, tauthor, isanon, authorname, views = unpack(stmnt_read:get_values()) local title, storytext, tauthor, isanon, authorname, views = unpack(stmnt_read:get_values())
stmnt_update_views:bind_names{
id = id
}
print("update:",do_sql(stmnt_update_views))
stmnt_update_views:reset()
storytext = zlib.decompress(storytext) storytext = zlib.decompress(storytext)
stmnt_read:reset() stmnt_read:reset()
if tauthor == authorid then if tauthor == authorid then