From 5e4a2badb251fefa286c9997c72c576458be8175 Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Thu, 28 Apr 2016 06:56:55 +0200 Subject: [PATCH] Check before doing the database update --- include/api.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/include/api.php b/include/api.php index 996c52f54e..488e858445 100644 --- a/include/api.php +++ b/include/api.php @@ -1335,9 +1335,12 @@ $idlist = implode(",", $idarray); - if ($idlist != "") - $r = q("UPDATE `item` SET `unseen` = 0 WHERE `unseen` AND `id` IN (%s)", $idlist); + if ($idlist != "") { + $unseen = q("SELECT `id` FROM `item` WHERE `unseen` AND `id` IN (%s)", $idlist); + if ($unseen) + $r = q("UPDATE `item` SET `unseen` = 0 WHERE `unseen` AND `id` IN (%s)", $idlist); + } $data = array('$statuses' => $ret); switch($type){ -- 2.39.5