From 2422fb020b79b387ef667d146cf3e0dd7b1faebf Mon Sep 17 00:00:00 2001 From: Lukas Fleischer Date: Sat, 23 Nov 2019 12:00:52 -0500 Subject: Store timestamp and user ID when closing requests Signed-off-by: Lukas Fleischer --- aurweb/git/serve.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'aurweb/git/serve.py') diff --git a/aurweb/git/serve.py b/aurweb/git/serve.py index d43523c2..64d51b9e 100755 --- a/aurweb/git/serve.py +++ b/aurweb/git/serve.py @@ -207,18 +207,22 @@ def pkgreq_close(reqid, user, reason, comments, autoclose=False): conn = aurweb.db.Connection() if autoclose: - userid = 0 + userid = None else: cur = conn.execute("SELECT ID FROM Users WHERE Username = ?", [user]) userid = cur.fetchone()[0] if userid == 0: raise aurweb.exceptions.InvalidUserException(user) - conn.execute("UPDATE PackageRequests SET Status = ?, ClosureComment = ? " + - "WHERE ID = ?", [status, comments, reqid]) + now = int(time.time()) + conn.execute("UPDATE PackageRequests SET Status = ?, ClosedTS = ?, " + + "ClosedUID = ?, ClosureComment = ? " + + "WHERE ID = ?", [status, now, userid, comments, reqid]) conn.commit() conn.close() + if not userid: + userid = 0 subprocess.Popen((notify_cmd, 'request-close', str(userid), str(reqid), reason)).wait() -- cgit v1.2.3-24-g4f1b