diff --git a/include/conversation.php b/include/conversation.php index f6da5d858..724d18dfe 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -1541,12 +1541,6 @@ function sort_thr_received_rev(array $a, array $b) */ function sort_thr_commented(array $a, array $b) { - if ($b['pinned'] && !$a['pinned']) { - return 1; - } elseif (!$b['pinned'] && $a['pinned']) { - return -1; - } - return strcmp($b['commented'], $a['commented']); } diff --git a/src/Model/Item.php b/src/Model/Item.php index 98b058215..dde33437a 100644 --- a/src/Model/Item.php +++ b/src/Model/Item.php @@ -143,6 +143,15 @@ class Item extends BaseObject return (bool)$useritem['pinned']; } + /** + * @brief Select pinned rows from the item table for a given user + * + * @param integer $uid User ID + * @param array $selected Array of selected fields, empty for all + * + * @return boolean|object + * @throws \Exception + */ public static function selectPinned(int $uid, array $selected = []) { $useritems = DBA::select('user-item', ['iid'], ['uid' => $uid, 'pinned' => true]);