Needless coude duplication removed

This commit is contained in:
Michael 2022-01-24 04:15:36 +00:00
parent 27a306185a
commit e4887d23d2
2 changed files with 22 additions and 33 deletions

View File

@ -114,8 +114,7 @@ class Notification extends BaseFactory implements ICanCreateFromTableRow
return $message; return $message;
} }
if (($Notification->verb == Activity::POST) || if (($Notification->verb == Activity::POST) || ($Notification->type === Post\UserNotification::TYPE_SHARED)) {
(($Notification->type === Post\UserNotification::TYPE_SHARED) && ($Notification->verb == Activity::ANNOUNCE))) {
$item = Post::selectFirst([], ['uri-id' => $item['thr-parent-id'], 'uid' => [0, $Notification->uid]], ['order' => ['uid' => true]]); $item = Post::selectFirst([], ['uri-id' => $item['thr-parent-id'], 'uid' => [0, $Notification->uid]], ['order' => ['uid' => true]]);
if (empty($item)) { if (empty($item)) {
$this->logger->info('Thread parent post not found', ['uri-id' => $item['thr-parent-id']]); $this->logger->info('Thread parent post not found', ['uri-id' => $item['thr-parent-id']]);
@ -124,13 +123,7 @@ class Notification extends BaseFactory implements ICanCreateFromTableRow
} }
} }
if ($Notification->type === Post\UserNotification::TYPE_SHARED) { if (in_array($Notification->type, [Post\UserNotification::TYPE_COMMENT_PARTICIPATION, Post\UserNotification::TYPE_ACTIVITY_PARTICIPATION, Post\UserNotification::TYPE_SHARED])) {
$author = Contact::getById($item['author-id'], ['id', 'name', 'url']);
if (empty($author)) {
$this->logger->info('Author not found', ['author' => $item['author-id']]);
return $message;
}
} elseif (in_array($Notification->type, [Post\UserNotification::TYPE_COMMENT_PARTICIPATION, Post\UserNotification::TYPE_ACTIVITY_PARTICIPATION])) {
$author = Contact::getById($item['author-id'], ['id', 'name', 'url']); $author = Contact::getById($item['author-id'], ['id', 'name', 'url']);
if (empty($author)) { if (empty($author)) {
$this->logger->info('Author not found', ['author' => $item['author-id']]); $this->logger->info('Author not found', ['author' => $item['author-id']]);

View File

@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: 2021.12-rc\n" "Project-Id-Version: 2021.12-rc\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-01-23 19:57+0000\n" "POT-Creation-Date: 2022-01-24 04:13+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"
@ -9957,101 +9957,97 @@ msgstr ""
msgid "%1$s had started following you" msgid "%1$s had started following you"
msgstr "" msgstr ""
#: src/Navigation/Notifications/Factory/Notification.php:162 #: src/Navigation/Notifications/Factory/Notification.php:149
#, php-format #, php-format
msgid "%1$s liked your comment %2$s" msgid "%1$s liked your comment %2$s"
msgstr "" msgstr ""
#: src/Navigation/Notifications/Factory/Notification.php:165 #: src/Navigation/Notifications/Factory/Notification.php:152
#, php-format #, php-format
msgid "%1$s liked your post %2$s" msgid "%1$s liked your post %2$s"
msgstr "" msgstr ""
#: src/Navigation/Notifications/Factory/Notification.php:172 #: src/Navigation/Notifications/Factory/Notification.php:159
#, php-format #, php-format
msgid "%1$s disliked your comment %2$s" msgid "%1$s disliked your comment %2$s"
msgstr "" msgstr ""
#: src/Navigation/Notifications/Factory/Notification.php:175 #: src/Navigation/Notifications/Factory/Notification.php:162
#, php-format #, php-format
msgid "%1$s disliked your post %2$s" msgid "%1$s disliked your post %2$s"
msgstr "" msgstr ""
#: src/Navigation/Notifications/Factory/Notification.php:182 #: src/Navigation/Notifications/Factory/Notification.php:169
#, php-format #, php-format
msgid "%1$s shared your comment %2$s" msgid "%1$s shared your comment %2$s"
msgstr "" msgstr ""
#: src/Navigation/Notifications/Factory/Notification.php:185 #: src/Navigation/Notifications/Factory/Notification.php:172
#, php-format #, php-format
msgid "%1$s shared your post %2$s" msgid "%1$s shared your post %2$s"
msgstr "" msgstr ""
#: src/Navigation/Notifications/Factory/Notification.php:189 #: src/Navigation/Notifications/Factory/Notification.php:176
#: src/Navigation/Notifications/Factory/Notification.php:237
#, php-format #, php-format
msgid "%1$s shared the post %2$s from %3$s" msgid "%1$s shared the post %2$s from %3$s"
msgstr "" msgstr ""
#: src/Navigation/Notifications/Factory/Notification.php:191 #: src/Navigation/Notifications/Factory/Notification.php:178
#: src/Navigation/Notifications/Factory/Notification.php:239
#, php-format #, php-format
msgid "%1$s shared a post from %3$s" msgid "%1$s shared a post from %3$s"
msgstr "" msgstr ""
#: src/Navigation/Notifications/Factory/Notification.php:193 #: src/Navigation/Notifications/Factory/Notification.php:180
#: src/Navigation/Notifications/Factory/Notification.php:241
#, php-format #, php-format
msgid "%1$s shared the post %2$s" msgid "%1$s shared the post %2$s"
msgstr "" msgstr ""
#: src/Navigation/Notifications/Factory/Notification.php:195 #: src/Navigation/Notifications/Factory/Notification.php:182
#: src/Navigation/Notifications/Factory/Notification.php:243
#, php-format #, php-format
msgid "%1$s shared a post" msgid "%1$s shared a post"
msgstr "" msgstr ""
#: src/Navigation/Notifications/Factory/Notification.php:203 #: src/Navigation/Notifications/Factory/Notification.php:190
#, php-format #, php-format
msgid "%1$s tagged you on %2$s" msgid "%1$s tagged you on %2$s"
msgstr "" msgstr ""
#: src/Navigation/Notifications/Factory/Notification.php:207 #: src/Navigation/Notifications/Factory/Notification.php:194
#, php-format #, php-format
msgid "%1$s replied to you on %2$s" msgid "%1$s replied to you on %2$s"
msgstr "" msgstr ""
#: src/Navigation/Notifications/Factory/Notification.php:211 #: src/Navigation/Notifications/Factory/Notification.php:198
#, php-format #, php-format
msgid "%1$s commented in your thread %2$s" msgid "%1$s commented in your thread %2$s"
msgstr "" msgstr ""
#: src/Navigation/Notifications/Factory/Notification.php:215 #: src/Navigation/Notifications/Factory/Notification.php:202
#, php-format #, php-format
msgid "%1$s commented on your comment %2$s" msgid "%1$s commented on your comment %2$s"
msgstr "" msgstr ""
#: src/Navigation/Notifications/Factory/Notification.php:221 #: src/Navigation/Notifications/Factory/Notification.php:208
#, php-format #, php-format
msgid "%1$s commented in their thread %2$s" msgid "%1$s commented in their thread %2$s"
msgstr "" msgstr ""
#: src/Navigation/Notifications/Factory/Notification.php:223 #: src/Navigation/Notifications/Factory/Notification.php:210
#, php-format #, php-format
msgid "%1$s commented in their thread" msgid "%1$s commented in their thread"
msgstr "" msgstr ""
#: src/Navigation/Notifications/Factory/Notification.php:225 #: src/Navigation/Notifications/Factory/Notification.php:212
#, php-format #, php-format
msgid "%1$s commented in the thread %2$s from %3$s" msgid "%1$s commented in the thread %2$s from %3$s"
msgstr "" msgstr ""
#: src/Navigation/Notifications/Factory/Notification.php:227 #: src/Navigation/Notifications/Factory/Notification.php:214
#, php-format #, php-format
msgid "%1$s commented in the thread from %3$s" msgid "%1$s commented in the thread from %3$s"
msgstr "" msgstr ""
#: src/Navigation/Notifications/Factory/Notification.php:232 #: src/Navigation/Notifications/Factory/Notification.php:219
#, php-format #, php-format
msgid "%1$s commented on your thread %2$s" msgid "%1$s commented on your thread %2$s"
msgstr "" msgstr ""