From 51407d4a296563ccb3f488589a531babba7a8c22 Mon Sep 17 00:00:00 2001 From: Lukas Fleischer Date: Sun, 13 Dec 2015 20:57:06 +0100 Subject: 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 --- web/template/pkg_comments.php | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) (limited to 'web/template/pkg_comments.php') diff --git a/web/template/pkg_comments.php b/web/template/pkg_comments.php index 4f3ee3d4..5a15fabf 100644 --- a/web/template/pkg_comments.php +++ b/web/template/pkg_comments.php @@ -25,25 +25,30 @@ if (!isset($count)) { $heading = __('Anonymous comment on %s', $date_fmtd); } - if ($uid && $row['EditedTS']) { + $is_deleted = $row['DelTS']; + $is_edited = $row['EditedTS']; + $is_pinned = $row['PinnedTS']; + + if ($uid && $is_deleted) { + $date_fmtd = gmdate('Y-m-d H:i', $row['DelTS']); + $user_fmtd = html_format_username($row['DelUserName']); + $heading .= ' ('; + $heading .= __('deleted on %s by %s', $date_fmtd, $user_fmtd); + $heading .= ')'; + } elseif ($uid && $is_edited) { $date_fmtd = gmdate('Y-m-d H:i', $row['EditedTS']); + $user_fmtd = html_format_username($row['EditUserName']); $heading .= ' ('; - if ($row['DelUsersID']) { - $user_fmtd = html_format_username($row['DelUserName']); - $heading .= __('deleted on %s by %s', $date_fmtd, $user_fmtd); - } else { - $user_fmtd = html_format_username($row['EditUserName']); - $heading .= __('last edited on %s by %s', $date_fmtd, $user_fmtd); - } + $heading .= __('edited on %s by %s', $date_fmtd, $user_fmtd); $heading .= ')'; } $row['DelUserName'] = html_format_username($row['DelUserName']); $row['EditUserName'] = html_format_username($row['EditUserName']); ?> -

class="comment-deleted"> +

class="comment-deleted"> - +
@@ -53,11 +58,12 @@ if (!isset($count)) {
- + + <?= __('Edit comment') ?> - = 5)): ?> + = 5)): ?>
@@ -69,7 +75,7 @@ if (!isset($count)) { - +
@@ -80,7 +86,7 @@ if (!isset($count)) {

-
+

-- cgit v1.2.3-24-g4f1b