]> git.mxchange.org Git - friendica.git/commitdiff
Pinned items are always at the top
authorMichael <heluecht@pirati.ca>
Thu, 7 Nov 2019 07:09:46 +0000 (07:09 +0000)
committerMichael <heluecht@pirati.ca>
Thu, 7 Nov 2019 07:09:46 +0000 (07:09 +0000)
include/conversation.php

index 84e47d34e3020bee2d1d78c6aaa3f47918b6a296..54008fb5d4304c078f333ee0f58194c0726ff652 100644 (file)
@@ -1497,6 +1497,12 @@ function conv_sort(array $item_list, $order)
  */
 function sort_thr_received(array $a, array $b)
 {
+       if ($b['pinned'] && !$a['pinned']) {
+               return 1;
+       } elseif (!$b['pinned'] && $a['pinned']) {
+               return -1;
+       }
+
        return strcmp($b['received'], $a['received']);
 }
 
@@ -1509,6 +1515,12 @@ function sort_thr_received(array $a, array $b)
  */
 function sort_thr_received_rev(array $a, array $b)
 {
+       if ($b['pinned'] && !$a['pinned']) {
+               return -1;
+       } elseif (!$b['pinned'] && $a['pinned']) {
+               return 1;
+       }
+
        return strcmp($a['received'], $b['received']);
 }
 
@@ -1521,6 +1533,12 @@ 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']);
 }