mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
Store timestamp and user ID when closing requests
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
This commit is contained in:
parent
4b97789bab
commit
2422fb020b
5 changed files with 21 additions and 6 deletions
|
@ -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()
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue