diff options
author | Lukas Fleischer <lfleischer@archlinux.org> | 2015-12-13 20:57:06 +0100 |
---|---|---|
committer | Lukas Fleischer <lfleischer@archlinux.org> | 2015-12-13 21:19:31 +0100 |
commit | 51407d4a296563ccb3f488589a531babba7a8c22 (patch) | |
tree | 792a8a062c7b9668f3f8637fbbe9c1be6a7a1ef5 /web/lib | |
parent | 9abd44671d690f91440c22e2069060500811cd21 (diff) | |
download | aurweb-51407d4a296563ccb3f488589a531babba7a8c22.tar.xz |
Store current date and time when deleting comments
Instead of modifying EditedTS when a comment is deleted, use a separate
field DelTS. Use this field to determine whether a comment has been
deleted, instead of checking DelUsersID which might be unset when the
corresponding user is deleted.
Fixes FS#47362.
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
Diffstat (limited to 'web/lib')
-rw-r--r-- | web/lib/pkgbasefuncs.inc.php | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/web/lib/pkgbasefuncs.inc.php b/web/lib/pkgbasefuncs.inc.php index 7b744d5..1abe426 100644 --- a/web/lib/pkgbasefuncs.inc.php +++ b/web/lib/pkgbasefuncs.inc.php @@ -21,7 +21,7 @@ function pkgbase_comments_count($base_id, $include_deleted, $only_pinned=false) $q = "SELECT COUNT(*) FROM PackageComments "; $q.= "WHERE PackageBaseID = " . $base_id . " "; if (!$include_deleted) { - $q.= "AND DelUsersID IS NULL"; + $q.= "AND DelTS IS NULL"; } if ($only_pinned) { $q.= "AND NOT PinnedTS = 0"; @@ -53,7 +53,7 @@ function pkgbase_comments($base_id, $limit, $include_deleted, $only_pinned=false $dbh = DB::connect(); $q = "SELECT PackageComments.ID, A.UserName AS UserName, UsersID, Comments, "; - $q.= "PackageBaseID, CommentTS, EditedTS, B.UserName AS EditUserName, "; + $q.= "PackageBaseID, CommentTS, DelTS, EditedTS, B.UserName AS EditUserName, "; $q.= "DelUsersID, C.UserName AS DelUserName, "; $q.= "PinnedTS FROM PackageComments "; $q.= "LEFT JOIN Users A ON PackageComments.UsersID = A.ID "; @@ -62,7 +62,7 @@ function pkgbase_comments($base_id, $limit, $include_deleted, $only_pinned=false $q.= "WHERE PackageBaseID = " . $base_id . " "; if (!$include_deleted) { - $q.= "AND DelUsersID IS NULL "; + $q.= "AND DelTS IS NULL "; } if ($only_pinned) { $q.= "AND NOT PinnedTS = 0 "; @@ -918,7 +918,7 @@ function pkgbase_delete_comment() { if (can_delete_comment($comment_id)) { $q = "UPDATE PackageComments "; $q.= "SET DelUsersID = ".$uid.", "; - $q.= "EditedTS = UNIX_TIMESTAMP() "; + $q.= "DelTS = UNIX_TIMESTAMP() "; $q.= "WHERE ID = ".intval($comment_id); $dbh->exec($q); return array(true, __("Comment has been deleted.")); |