]> git.mxchange.org Git - friendica.git/commitdiff
Centralised function for the sort order
authorMichael <heluecht@pirati.ca>
Sat, 9 Sep 2023 13:48:41 +0000 (13:48 +0000)
committerMichael <heluecht@pirati.ca>
Sat, 9 Sep 2023 13:48:41 +0000 (13:48 +0000)
src/Module/Conversation/Network.php
src/Module/Update/Network.php

index b65910e01b0a2f0688f4098280b0dfe280a7f957..e99c0150504cdb74222ea89a264ef2bb98a4720d 100644 (file)
@@ -238,15 +238,7 @@ class Network extends Timeline
                        $o .= Profile::getEventsReminderHTML();
                }
 
-               if (self::$order === 'received') {
-                       $ordering = '`received`';
-               } elseif (self::$order === 'created') {
-                       $ordering = '`created`';
-               } else {
-                       $ordering = '`commented`';
-               }
-
-               $o .= $this->conversation->render($items, Conversation::MODE_NETWORK, false, false, $ordering, $this->session->getLocalUserId());
+               $o .= $this->conversation->render($items, Conversation::MODE_NETWORK, false, false, $this->getOrder(), $this->session->getLocalUserId());
 
                if ($this->pConfig->get($this->session->getLocalUserId(), 'system', 'infinite_scroll')) {
                        $o .= HTML::scrollLoader();
@@ -265,6 +257,17 @@ class Network extends Timeline
                return $o;
        }
 
+       protected function getOrder(): string
+       {
+               if (self::$order === 'received') {
+                       return '`received`';
+               } elseif (self::$order === 'created') {
+                       return '`created`';
+               } else {
+                       return '`commented`';
+               }
+       }
+
        /**
         * Sets items as seen
         *
index adb73141d6a11e951c4cb9ba118f89d59b84f7df..59ab0e2eb19cc5df3edd462ff37e9033e42b03ba 100644 (file)
@@ -43,17 +43,7 @@ class Network extends NetworkModule
                        System::htmlUpdateExit($o);
                }
 
-               $items = $this->getItems();
-
-               if (self::$order === 'received') {
-                       $ordering = '`received`';
-               } elseif (self::$order === 'created') {
-                       $ordering = '`created`';
-               } else {
-                       $ordering = '`commented`';
-               }
-
-               $o = $this->conversation->render($items, Conversation::MODE_NETWORK, $profile_uid, false, $ordering, $this->session->getLocalUserId());
+               $o = $this->conversation->render($this->getItems(), Conversation::MODE_NETWORK, $profile_uid, false, $this->getOrder(), $this->session->getLocalUserId());
 
                System::htmlUpdateExit($o);
        }