Issue 11425: Additional sorting by creation date

This commit is contained in:
Michael 2022-04-20 21:03:33 +00:00
parent e1a8f8aff6
commit 2236e5cfb0
5 changed files with 81 additions and 44 deletions

View file

@ -65,7 +65,8 @@ General
../network ../network
-------- --------
* e - Sort by Comment Date * 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) * r - Conversation (Posts that mention or involve you)
* w - New posts * w - New posts
* m - Favourite Posts * m - Favourite Posts

View file

@ -1162,6 +1162,8 @@ class Conversation
usort($parents, [$this, 'sortThrReceived']); usort($parents, [$this, 'sortThrReceived']);
} elseif (stristr($order, 'commented')) { } elseif (stristr($order, 'commented')) {
usort($parents, [$this, 'sortThrCommented']); usort($parents, [$this, 'sortThrCommented']);
} elseif (stristr($order, 'created')) {
usort($parents, [$this, 'sortThrCreated']);
} }
/* /*
@ -1266,4 +1268,16 @@ class Conversation
{ {
return strcmp($b['commented'], $a['commented']); 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']);
}
} }

View file

@ -193,6 +193,8 @@ class Network extends BaseModule
if (self::$order === 'received') { if (self::$order === 'received') {
$ordering = '`received`'; $ordering = '`received`';
} elseif (self::$order === 'created') {
$ordering = '`created`';
} else { } else {
$ordering = '`commented`'; $ordering = '`commented`';
} }
@ -265,6 +267,14 @@ class Network extends BaseModule
'id' => 'post-order-tab', 'id' => 'post-order-tab',
'accesskey' => 't', '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'), 'label' => DI::l10n()->t('Personal'),
'url' => $cmd . '?' . http_build_query(['mention' => true]), 'url' => $cmd . '?' . http_build_query(['mention' => true]),
@ -322,6 +332,8 @@ class Network extends BaseModule
self::$mention = false; self::$mention = false;
} elseif (in_array(self::$selectedTab, ['received', 'star', 'mention'])) { } elseif (in_array(self::$selectedTab, ['received', 'star', 'mention'])) {
self::$order = 'received'; self::$order = 'received';
} elseif (in_array(self::$selectedTab, ['created'])) {
self::$order = 'created';
} }
self::$selectedTab = self::$selectedTab ?? self::$order; self::$selectedTab = self::$selectedTab ?? self::$order;

View file

@ -68,6 +68,8 @@ class Network extends NetworkModule
if (self::$order === 'received') { if (self::$order === 'received') {
$ordering = '`received`'; $ordering = '`received`';
} elseif (self::$order === 'created') {
$ordering = '`created`';
} else { } else {
$ordering = '`commented`'; $ordering = '`commented`';
} }

View file

@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: 2022.05-dev\n" "Project-Id-Version: 2022.05-dev\n"
"Report-Msgid-Bugs-To: \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" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
@ -163,7 +163,7 @@ msgid "Save"
msgstr "" msgstr ""
#: mod/editpost.php:92 mod/photos.php:1344 src/Content/Conversation.php:338 #: 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..." msgid "Loading..."
msgstr "" msgstr ""
@ -229,7 +229,7 @@ msgstr ""
#: mod/editpost.php:107 mod/message.php:200 mod/message.php:358 #: 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 #: 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/Content/Conversation.php:712 src/Module/Item/Compose.php:177
#: src/Object/Post.php:526 #: src/Object/Post.php:528
msgid "Please wait" msgid "Please wait"
msgstr "" msgstr ""
@ -261,7 +261,7 @@ msgstr ""
#: mod/editpost.php:128 mod/events.php:513 mod/photos.php:1343 #: 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 #: 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" msgid "Preview"
msgstr "" msgstr ""
@ -273,37 +273,37 @@ msgid "Cancel"
msgstr "" msgstr ""
#: mod/editpost.php:134 src/Content/Conversation.php:343 #: 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" msgid "Bold"
msgstr "" msgstr ""
#: mod/editpost.php:135 src/Content/Conversation.php:344 #: 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" msgid "Italic"
msgstr "" msgstr ""
#: mod/editpost.php:136 src/Content/Conversation.php:345 #: 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" msgid "Underline"
msgstr "" msgstr ""
#: mod/editpost.php:137 src/Content/Conversation.php:346 #: 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" msgid "Quote"
msgstr "" msgstr ""
#: mod/editpost.php:138 src/Content/Conversation.php:347 #: 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" msgid "Code"
msgstr "" msgstr ""
#: mod/editpost.php:139 src/Content/Conversation.php:349 #: 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" msgid "Link"
msgstr "" msgstr ""
#: mod/editpost.php:140 src/Content/Conversation.php:350 #: 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" msgid "Link or Media"
msgstr "" msgstr ""
@ -411,7 +411,7 @@ msgstr ""
#: src/Module/Install.php:252 src/Module/Install.php:294 #: src/Module/Install.php:252 src/Module/Install.php:294
#: src/Module/Install.php:331 src/Module/Invite.php:177 #: src/Module/Install.php:331 src/Module/Invite.php:177
#: src/Module/Item/Compose.php:162 src/Module/Profile/Profile.php:247 #: 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/duepuntozero/config.php:69 view/theme/frio/config.php:160
#: view/theme/quattro/config.php:71 view/theme/vier/config.php:119 #: view/theme/quattro/config.php:71 view/theme/vier/config.php:119
msgid "Submit" msgid "Submit"
@ -1066,12 +1066,12 @@ msgstr ""
#: mod/photos.php:1339 mod/photos.php:1395 mod/photos.php:1469 #: mod/photos.php:1339 mod/photos.php:1395 mod/photos.php:1469
#: src/Module/Contact.php:544 src/Module/Item/Compose.php:160 #: 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" msgid "This is you"
msgstr "" msgstr ""
#: mod/photos.php:1341 mod/photos.php:1397 mod/photos.php:1471 #: 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" msgid "Comment"
msgstr "" msgstr ""
@ -2465,7 +2465,7 @@ msgid "Visible to <strong>everybody</strong>"
msgstr "" msgstr ""
#: src/Content/Conversation.php:308 src/Module/Item/Compose.php:171 #: 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:" msgid "Please enter a image/video/audio/webpage URL:"
msgstr "" msgstr ""
@ -2498,7 +2498,7 @@ msgid "Share"
msgstr "" msgstr ""
#: src/Content/Conversation.php:348 src/Module/Item/Compose.php:168 #: src/Content/Conversation.php:348 src/Module/Item/Compose.php:168
#: src/Object/Post.php:998 #: src/Object/Post.php:1000
msgid "Image" msgid "Image"
msgstr "" msgstr ""
@ -2514,21 +2514,21 @@ msgstr ""
msgid "Pinned item" msgid "Pinned item"
msgstr "" msgstr ""
#: src/Content/Conversation.php:672 src/Object/Post.php:474 #: src/Content/Conversation.php:672 src/Object/Post.php:476
#: src/Object/Post.php:475 #: src/Object/Post.php:477
#, php-format #, php-format
msgid "View %s's profile @ %s" msgid "View %s's profile @ %s"
msgstr "" msgstr ""
#: src/Content/Conversation.php:685 src/Object/Post.php:462 #: src/Content/Conversation.php:685 src/Object/Post.php:464
msgid "Categories:" msgid "Categories:"
msgstr "" msgstr ""
#: src/Content/Conversation.php:686 src/Object/Post.php:463 #: src/Content/Conversation.php:686 src/Object/Post.php:465
msgid "Filed under:" msgid "Filed under:"
msgstr "" msgstr ""
#: src/Content/Conversation.php:694 src/Object/Post.php:488 #: src/Content/Conversation.php:694 src/Object/Post.php:490
#, php-format #, php-format
msgid "%s from %s" msgid "%s from %s"
msgstr "" msgstr ""
@ -7607,36 +7607,44 @@ msgstr ""
msgid "Group: %s" msgid "Group: %s"
msgstr "" msgstr ""
#: src/Module/Conversation/Network.php:253 #: src/Module/Conversation/Network.php:255
msgid "Latest Activity" msgid "Latest Activity"
msgstr "" msgstr ""
#: src/Module/Conversation/Network.php:256 #: src/Module/Conversation/Network.php:258
msgid "Sort by latest activity" msgid "Sort by latest activity"
msgstr "" msgstr ""
#: src/Module/Conversation/Network.php:261 #: src/Module/Conversation/Network.php:263
msgid "Latest Posts" msgid "Latest Posts"
msgstr "" msgstr ""
#: src/Module/Conversation/Network.php:264 #: src/Module/Conversation/Network.php:266
msgid "Sort by post received date" msgid "Sort by post received date"
msgstr "" 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 #: src/Module/Settings/Profile/Index.php:227
msgid "Personal" msgid "Personal"
msgstr "" msgstr ""
#: src/Module/Conversation/Network.php:272 #: src/Module/Conversation/Network.php:282
msgid "Posts that mention or involve you" msgid "Posts that mention or involve you"
msgstr "" 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" msgid "Starred"
msgstr "" msgstr ""
#: src/Module/Conversation/Network.php:280 #: src/Module/Conversation/Network.php:290
msgid "Favourite Posts" msgid "Favourite Posts"
msgstr "" msgstr ""
@ -10567,63 +10575,63 @@ msgstr ""
msgid "Share via external services" msgid "Share via external services"
msgstr "" msgstr ""
#: src/Object/Post.php:476 #: src/Object/Post.php:478
msgid "to" msgid "to"
msgstr "" msgstr ""
#: src/Object/Post.php:477 #: src/Object/Post.php:479
msgid "via" msgid "via"
msgstr "" msgstr ""
#: src/Object/Post.php:478 #: src/Object/Post.php:480
msgid "Wall-to-Wall" msgid "Wall-to-Wall"
msgstr "" msgstr ""
#: src/Object/Post.php:479 #: src/Object/Post.php:481
msgid "via Wall-To-Wall:" msgid "via Wall-To-Wall:"
msgstr "" msgstr ""
#: src/Object/Post.php:521 #: src/Object/Post.php:523
#, php-format #, php-format
msgid "Reply to %s" msgid "Reply to %s"
msgstr "" msgstr ""
#: src/Object/Post.php:524 #: src/Object/Post.php:526
msgid "More" msgid "More"
msgstr "" msgstr ""
#: src/Object/Post.php:542 #: src/Object/Post.php:544
msgid "Notifier task is pending" msgid "Notifier task is pending"
msgstr "" msgstr ""
#: src/Object/Post.php:543 #: src/Object/Post.php:545
msgid "Delivery to remote servers is pending" msgid "Delivery to remote servers is pending"
msgstr "" msgstr ""
#: src/Object/Post.php:544 #: src/Object/Post.php:546
msgid "Delivery to remote servers is underway" msgid "Delivery to remote servers is underway"
msgstr "" msgstr ""
#: src/Object/Post.php:545 #: src/Object/Post.php:547
msgid "Delivery to remote servers is mostly done" msgid "Delivery to remote servers is mostly done"
msgstr "" msgstr ""
#: src/Object/Post.php:546 #: src/Object/Post.php:548
msgid "Delivery to remote servers is done" msgid "Delivery to remote servers is done"
msgstr "" msgstr ""
#: src/Object/Post.php:566 #: src/Object/Post.php:568
#, php-format #, php-format
msgid "%d comment" msgid "%d comment"
msgid_plural "%d comments" msgid_plural "%d comments"
msgstr[0] "" msgstr[0] ""
msgstr[1] "" msgstr[1] ""
#: src/Object/Post.php:567 #: src/Object/Post.php:569
msgid "Show more" msgid "Show more"
msgstr "" msgstr ""
#: src/Object/Post.php:568 #: src/Object/Post.php:570
msgid "Show fewer" msgid "Show fewer"
msgstr "" msgstr ""