From 48524586459c86727efc96c851cbf64e9000e954 Mon Sep 17 00:00:00 2001 From: Michael Date: Sun, 6 Sep 2020 20:28:08 +0000 Subject: [PATCH] Simplify the code / check number of parameters in mergeConditions --- src/Database/DBA.php | 4 ++++ src/Model/Item.php | 6 +----- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Database/DBA.php b/src/Database/DBA.php index 273c87690b..b45f7cfb24 100644 --- a/src/Database/DBA.php +++ b/src/Database/DBA.php @@ -669,6 +669,10 @@ class DBA */ public static function mergeConditions(array ...$conditions) { + if (count($conditions) == 1) { + return current($conditions); + } + $conditionStrings = []; $result = []; diff --git a/src/Model/Item.php b/src/Model/Item.php index d780010944..af19ec16a7 100644 --- a/src/Model/Item.php +++ b/src/Model/Item.php @@ -201,11 +201,7 @@ class Item return []; } - if (!empty($condition)) { - $condition = DBA::mergeConditions(['iid' => $pinned], $condition); - } else { - $condition = ['iid' => $pinned]; - } + $condition = DBA::mergeConditions(['iid' => $pinned], $condition); return self::selectThreadForUser($uid, $selected, $condition, $params); }