From: Mischa POSLAWSKY Date: Sun, 1 Dec 2019 22:14:15 +0000 (+0100) Subject: issue: indicate image presence in overview X-Git-Tag: v4.3~11 X-Git-Url: http://git.shiar.net/minimedit.git/commitdiff_plain/0f7747af6751b55fb297a4e90f8c2ba6232bd0b9 issue: indicate image presence in overview Advertise uploads as they are proverbially worth more than text replies. --- 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.'' : '', ]) );