]> git.mxchange.org Git - friendica.git/commitdiff
Issue 11425: Additional sorting by creation date
authorMichael <heluecht@pirati.ca>
Wed, 20 Apr 2022 21:03:33 +0000 (21:03 +0000)
committerMichael <heluecht@pirati.ca>
Wed, 20 Apr 2022 21:03:33 +0000 (21:03 +0000)
doc/Accesskeys.md
src/Content/Conversation.php
src/Module/Conversation/Network.php
src/Module/Update/Network.php
view/lang/C/messages.po

index 1754fd75896b5251e8e83c85572f07cc794fd7a2..5945412de13ba50f17a6568c265a4eb5bd6af42c 100644 (file)
@@ -65,7 +65,8 @@ General
 ../network
 --------
 * e - Sort by Comment Date
-* t - Sort by Post Date
+* t - Sort by Receipt Date
+* q - Sort by Creation Date
 * r - Conversation (Posts that mention or involve you)
 * w - New posts
 * m - Favourite Posts
index fd1701483b4945dc63b38ced340f00b84f735f03..7723ddd63f0690dc204072c3a9c74ff615d640ce 100644 (file)
@@ -1162,6 +1162,8 @@ class Conversation
                        usort($parents, [$this, 'sortThrReceived']);
                } elseif (stristr($order, 'commented')) {
                        usort($parents, [$this, 'sortThrCommented']);
+               } elseif (stristr($order, 'created')) {
+                       usort($parents, [$this, 'sortThrCreated']);
                }
 
                /*
@@ -1266,4 +1268,16 @@ class Conversation
        {
                return strcmp($b['commented'], $a['commented']);
        }
+
+       /**
+        * usort() callback to sort item arrays by the created key
+        *
+        * @param array $a
+        * @param array $b
+        * @return int
+        */
+       private function sortThrCreated(array $a, array $b)
+       {
+               return strcmp($b['created'], $a['created']);
+       }
 }
index 2978ecbb9d72dfd86ed129feb8418daebb9b4356..ca29f4341a1a0bb7a9a49974665e45fedd914b49 100644 (file)
@@ -193,6 +193,8 @@ class Network extends BaseModule
 
                if (self::$order === 'received') {
                        $ordering = '`received`';
+               } elseif (self::$order === 'created') {
+                       $ordering = '`created`';
                } else {
                        $ordering = '`commented`';
                }
@@ -265,6 +267,14 @@ class Network extends BaseModule
                                'id'    => 'post-order-tab',
                                'accesskey' => 't',
                        ],
+                       [
+                               'label' => DI::l10n()->t('Latest Creation'),
+                               'url'   => $cmd . '?' . http_build_query(['order' => 'created']),
+                               'sel'   => $selectedTab == 'created' ? 'active' : '',
+                               'title' => DI::l10n()->t('Sort by post creation date'),
+                               'id'    => 'creation-order-tab',
+                               'accesskey' => 'q',
+                       ],
                        [
                                'label' => DI::l10n()->t('Personal'),
                                'url'   => $cmd . '?' . http_build_query(['mention' => true]),
@@ -322,6 +332,8 @@ class Network extends BaseModule
                        self::$mention = false;
                } elseif (in_array(self::$selectedTab, ['received', 'star', 'mention'])) {
                        self::$order = 'received';
+               } elseif (in_array(self::$selectedTab, ['created'])) {
+                       self::$order = 'created';
                }
 
                self::$selectedTab = self::$selectedTab ?? self::$order;
index be842112d481a5d8f98a161ee2f93263bc9198f2..330cba2d3ed8a265d66d06393d8757f0e2c97072 100644 (file)
@@ -68,6 +68,8 @@ class Network extends NetworkModule
 
                        if (self::$order === 'received') {
                                $ordering = '`received`';
+                       } elseif (self::$order === 'created') {
+                               $ordering = '`created`';
                        } else {
                                $ordering = '`commented`';
                        }
index 4f42aa3c40eb18a37934681d26e78adbe430fecf..8057f6b2e1bc551b468109cc40c2993c02666636 100644 (file)
@@ -8,7 +8,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: 2022.05-dev\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2022-04-19 19:14+0000\n"
+"POT-Creation-Date: 2022-04-20 20:58+0000\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -163,7 +163,7 @@ msgid "Save"
 msgstr ""
 
 #: mod/editpost.php:92 mod/photos.php:1344 src/Content/Conversation.php:338
-#: src/Module/Contact/Poke.php:176 src/Object/Post.php:992
+#: src/Module/Contact/Poke.php:176 src/Object/Post.php:994
 msgid "Loading..."
 msgstr ""
 
@@ -229,7 +229,7 @@ msgstr ""
 #: mod/editpost.php:107 mod/message.php:200 mod/message.php:358
 #: mod/photos.php:1495 mod/wallmessage.php:142 src/Content/Conversation.php:368
 #: src/Content/Conversation.php:712 src/Module/Item/Compose.php:177
-#: src/Object/Post.php:526
+#: src/Object/Post.php:528
 msgid "Please wait"
 msgstr ""
 
@@ -261,7 +261,7 @@ msgstr ""
 
 #: mod/editpost.php:128 mod/events.php:513 mod/photos.php:1343
 #: mod/photos.php:1399 mod/photos.php:1473 src/Content/Conversation.php:383
-#: src/Module/Item/Compose.php:172 src/Object/Post.php:1002
+#: src/Module/Item/Compose.php:172 src/Object/Post.php:1004
 msgid "Preview"
 msgstr ""
 
@@ -273,37 +273,37 @@ msgid "Cancel"
 msgstr ""
 
 #: mod/editpost.php:134 src/Content/Conversation.php:343
-#: src/Module/Item/Compose.php:163 src/Object/Post.php:993
+#: src/Module/Item/Compose.php:163 src/Object/Post.php:995
 msgid "Bold"
 msgstr ""
 
 #: mod/editpost.php:135 src/Content/Conversation.php:344
-#: src/Module/Item/Compose.php:164 src/Object/Post.php:994
+#: src/Module/Item/Compose.php:164 src/Object/Post.php:996
 msgid "Italic"
 msgstr ""
 
 #: mod/editpost.php:136 src/Content/Conversation.php:345
-#: src/Module/Item/Compose.php:165 src/Object/Post.php:995
+#: src/Module/Item/Compose.php:165 src/Object/Post.php:997
 msgid "Underline"
 msgstr ""
 
 #: mod/editpost.php:137 src/Content/Conversation.php:346
-#: src/Module/Item/Compose.php:166 src/Object/Post.php:996
+#: src/Module/Item/Compose.php:166 src/Object/Post.php:998
 msgid "Quote"
 msgstr ""
 
 #: mod/editpost.php:138 src/Content/Conversation.php:347
-#: src/Module/Item/Compose.php:167 src/Object/Post.php:997
+#: src/Module/Item/Compose.php:167 src/Object/Post.php:999
 msgid "Code"
 msgstr ""
 
 #: mod/editpost.php:139 src/Content/Conversation.php:349
-#: src/Module/Item/Compose.php:169 src/Object/Post.php:999
+#: src/Module/Item/Compose.php:169 src/Object/Post.php:1001
 msgid "Link"
 msgstr ""
 
 #: mod/editpost.php:140 src/Content/Conversation.php:350
-#: src/Module/Item/Compose.php:170 src/Object/Post.php:1000
+#: src/Module/Item/Compose.php:170 src/Object/Post.php:1002
 msgid "Link or Media"
 msgstr ""
 
@@ -411,7 +411,7 @@ msgstr ""
 #: src/Module/Install.php:252 src/Module/Install.php:294
 #: src/Module/Install.php:331 src/Module/Invite.php:177
 #: src/Module/Item/Compose.php:162 src/Module/Profile/Profile.php:247
-#: src/Module/Settings/Profile/Index.php:222 src/Object/Post.php:991
+#: src/Module/Settings/Profile/Index.php:222 src/Object/Post.php:993
 #: view/theme/duepuntozero/config.php:69 view/theme/frio/config.php:160
 #: view/theme/quattro/config.php:71 view/theme/vier/config.php:119
 msgid "Submit"
@@ -1066,12 +1066,12 @@ msgstr ""
 
 #: mod/photos.php:1339 mod/photos.php:1395 mod/photos.php:1469
 #: src/Module/Contact.php:544 src/Module/Item/Compose.php:160
-#: src/Object/Post.php:988
+#: src/Object/Post.php:990
 msgid "This is you"
 msgstr ""
 
 #: mod/photos.php:1341 mod/photos.php:1397 mod/photos.php:1471
-#: src/Object/Post.php:520 src/Object/Post.php:990
+#: src/Object/Post.php:522 src/Object/Post.php:992
 msgid "Comment"
 msgstr ""
 
@@ -2465,7 +2465,7 @@ msgid "Visible to <strong>everybody</strong>"
 msgstr ""
 
 #: src/Content/Conversation.php:308 src/Module/Item/Compose.php:171
-#: src/Object/Post.php:1001
+#: src/Object/Post.php:1003
 msgid "Please enter a image/video/audio/webpage URL:"
 msgstr ""
 
@@ -2498,7 +2498,7 @@ msgid "Share"
 msgstr ""
 
 #: src/Content/Conversation.php:348 src/Module/Item/Compose.php:168
-#: src/Object/Post.php:998
+#: src/Object/Post.php:1000
 msgid "Image"
 msgstr ""
 
@@ -2514,21 +2514,21 @@ msgstr ""
 msgid "Pinned item"
 msgstr ""
 
-#: src/Content/Conversation.php:672 src/Object/Post.php:474
-#: src/Object/Post.php:475
+#: src/Content/Conversation.php:672 src/Object/Post.php:476
+#: src/Object/Post.php:477
 #, php-format
 msgid "View %s's profile @ %s"
 msgstr ""
 
-#: src/Content/Conversation.php:685 src/Object/Post.php:462
+#: src/Content/Conversation.php:685 src/Object/Post.php:464
 msgid "Categories:"
 msgstr ""
 
-#: src/Content/Conversation.php:686 src/Object/Post.php:463
+#: src/Content/Conversation.php:686 src/Object/Post.php:465
 msgid "Filed under:"
 msgstr ""
 
-#: src/Content/Conversation.php:694 src/Object/Post.php:488
+#: src/Content/Conversation.php:694 src/Object/Post.php:490
 #, php-format
 msgid "%s from %s"
 msgstr ""
@@ -7607,36 +7607,44 @@ msgstr ""
 msgid "Group: %s"
 msgstr ""
 
-#: src/Module/Conversation/Network.php:253
+#: src/Module/Conversation/Network.php:255
 msgid "Latest Activity"
 msgstr ""
 
-#: src/Module/Conversation/Network.php:256
+#: src/Module/Conversation/Network.php:258
 msgid "Sort by latest activity"
 msgstr ""
 
-#: src/Module/Conversation/Network.php:261
+#: src/Module/Conversation/Network.php:263
 msgid "Latest Posts"
 msgstr ""
 
-#: src/Module/Conversation/Network.php:264
+#: src/Module/Conversation/Network.php:266
 msgid "Sort by post received date"
 msgstr ""
 
-#: src/Module/Conversation/Network.php:269
+#: src/Module/Conversation/Network.php:271
+msgid "Latest Creation"
+msgstr ""
+
+#: src/Module/Conversation/Network.php:274
+msgid "Sort by post creation date"
+msgstr ""
+
+#: src/Module/Conversation/Network.php:279
 #: src/Module/Settings/Profile/Index.php:227
 msgid "Personal"
 msgstr ""
 
-#: src/Module/Conversation/Network.php:272
+#: src/Module/Conversation/Network.php:282
 msgid "Posts that mention or involve you"
 msgstr ""
 
-#: src/Module/Conversation/Network.php:277 src/Object/Post.php:341
+#: src/Module/Conversation/Network.php:287 src/Object/Post.php:341
 msgid "Starred"
 msgstr ""
 
-#: src/Module/Conversation/Network.php:280
+#: src/Module/Conversation/Network.php:290
 msgid "Favourite Posts"
 msgstr ""
 
@@ -10567,63 +10575,63 @@ msgstr ""
 msgid "Share via external services"
 msgstr ""
 
-#: src/Object/Post.php:476
+#: src/Object/Post.php:478
 msgid "to"
 msgstr ""
 
-#: src/Object/Post.php:477
+#: src/Object/Post.php:479
 msgid "via"
 msgstr ""
 
-#: src/Object/Post.php:478
+#: src/Object/Post.php:480
 msgid "Wall-to-Wall"
 msgstr ""
 
-#: src/Object/Post.php:479
+#: src/Object/Post.php:481
 msgid "via Wall-To-Wall:"
 msgstr ""
 
-#: src/Object/Post.php:521
+#: src/Object/Post.php:523
 #, php-format
 msgid "Reply to %s"
 msgstr ""
 
-#: src/Object/Post.php:524
+#: src/Object/Post.php:526
 msgid "More"
 msgstr ""
 
-#: src/Object/Post.php:542
+#: src/Object/Post.php:544
 msgid "Notifier task is pending"
 msgstr ""
 
-#: src/Object/Post.php:543
+#: src/Object/Post.php:545
 msgid "Delivery to remote servers is pending"
 msgstr ""
 
-#: src/Object/Post.php:544
+#: src/Object/Post.php:546
 msgid "Delivery to remote servers is underway"
 msgstr ""
 
-#: src/Object/Post.php:545
+#: src/Object/Post.php:547
 msgid "Delivery to remote servers is mostly done"
 msgstr ""
 
-#: src/Object/Post.php:546
+#: src/Object/Post.php:548
 msgid "Delivery to remote servers is done"
 msgstr ""
 
-#: src/Object/Post.php:566
+#: src/Object/Post.php:568
 #, php-format
 msgid "%d comment"
 msgid_plural "%d comments"
 msgstr[0] ""
 msgstr[1] ""
 
-#: src/Object/Post.php:567
+#: src/Object/Post.php:569
 msgid "Show more"
 msgstr ""
 
-#: src/Object/Post.php:568
+#: src/Object/Post.php:570
 msgid "Show fewer"
 msgstr ""