From 0f7747af6751b55fb297a4e90f8c2ba6232bd0b9 Mon Sep 17 00:00:00 2001 From: Mischa POSLAWSKY Date: Sun, 1 Dec 2019 23:14:15 +0100 Subject: [PATCH] issue: indicate image presence in overview Advertise uploads as they are proverbially worth more than text replies. --- issue/index.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/issue/index.php b/issue/index.php index cefe00f..8a3d907 100644 --- a/issue/index.php +++ b/issue/index.php @@ -52,8 +52,9 @@ if ($_POST) { $_POST = []; } -$cols = "*, (SELECT count(*) FROM comments WHERE" - . " page=i.page||'/'||i.id AND message IS NOT NULL) AS replycount"; +$subsql = "SELECT count(*) FROM comments WHERE page=i.page||'/'||i.id"; +$cols = "*, ($subsql AND message IS NOT NULL) AS replycount"; +$cols .= ", ($subsql AND message ~ 'img') AS imagecount"; $sql = "SELECT $cols FROM issues i WHERE page = ?"; if (isset($_GET['open'])) { $sql .= ' AND closed IS NULL'; @@ -75,7 +76,8 @@ while ($row = $query->fetch()) { htmlspecialchars($row->subject)), showdate(array_slice(preg_split('/\D/', $row->updated), 0, 3)), implode(' ', [ - $row->replycount ? sprintf('+%d', $row->replycount) : '', + $row->imagecount ? sprintf('*') : '', + $row->replycount ? sprintf('+%d', $row->replycount) : '', isset($row->assign) ? ''.$row->assign.'' : '', ]) ); -- 2.30.0