1
1
Fork 0

Added handling another situation

This commit is contained in:
Michael 2021-08-22 03:58:50 +00:00
parent 4f1e61457d
commit 59045b2e23
2 changed files with 52 additions and 26 deletions

View file

@ -193,7 +193,7 @@ class Notification extends BaseModel
$announce = Verb::getID(Activity::ANNOUNCE);
$post = Verb::getID(Activity::POST);
if (in_array($notification['type'], [Post\UserNotification::NOTIF_THREAD_COMMENT, Post\UserNotification::NOTIF_COMMENT_PARTICIPATION, Post\UserNotification::NOTIF_EXPLICIT_TAGGED])) {
if (in_array($notification['type'], [Post\UserNotification::NOTIF_THREAD_COMMENT, Post\UserNotification::NOTIF_COMMENT_PARTICIPATION, Post\UserNotification::NOTIF_ACTIVITY_PARTICIPATION, Post\UserNotification::NOTIF_EXPLICIT_TAGGED])) {
$item = Post::selectFirst([], ['uri-id' => $notification['parent-uri-id'], 'uid' => [0, $notification['uid']]], ['order' => ['uid' => true]]);
if (empty($item)) {
Logger::info('Parent post not found', ['uri-id' => $notification['parent-uri-id']]);
@ -221,6 +221,12 @@ class Notification extends BaseModel
Logger::info('Causer not found', ['causer' => $item['causer-id']]);
return $message;
}
} elseif (in_array($notification['type'], [Post\UserNotification::NOTIF_COMMENT_PARTICIPATION, Post\UserNotification::NOTIF_ACTIVITY_PARTICIPATION])) {
$contact = Contact::getById($item['author-id'], ['id', 'name', 'url']);
if (empty($contact)) {
Logger::info('Author not found', ['author' => $item['author-id']]);
return $message;
}
}
$link = DI::baseUrl() . '/display/' . urlencode($item['guid']);
@ -284,11 +290,16 @@ class Notification extends BaseModel
break;
case Post\UserNotification::NOTIF_COMMENT_PARTICIPATION:
$msg = $l10n->t('%1$s commented in the thread %2$s');
break;
case Post\UserNotification::NOTIF_ACTIVITY_PARTICIPATION:
// Unhandled
if (($causer['id'] == $contact['id']) && ($title != '')) {
$msg = $l10n->t('%1$s commented in their thread %2$s');
} elseif ($causer['id'] == $contact['id']) {
$msg = $l10n->t('%1$s commented in their thread');
} elseif ($title != '') {
$msg = $l10n->t('%1$s commented in the thread %2$s from %3$s');
} else {
$msg = $l10n->t('%1$s commented in the thread from %3$s');
}
break;
case Post\UserNotification::NOTIF_DIRECT_THREAD_COMMENT:

View file

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: 2021.09-dev\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-08-21 20:27+0000\n"
"POT-Creation-Date: 2021-08-22 03:57+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"
@ -1774,15 +1774,15 @@ msgstr ""
msgid "View Album"
msgstr ""
#: mod/ping.php:286
#: mod/ping.php:287
msgid "{0} wants to be your friend"
msgstr ""
#: mod/ping.php:303
#: mod/ping.php:304
msgid "{0} requested registration"
msgstr ""
#: mod/ping.php:316
#: mod/ping.php:317
#, php-format
msgid "{0} and %d others requested registration"
msgstr ""
@ -4665,82 +4665,97 @@ msgstr ""
msgid "[no subject]"
msgstr ""
#: src/Model/Notification.php:241
#: src/Model/Notification.php:247
#, php-format
msgid "%1$s liked your comment %2$s"
msgstr ""
#: src/Model/Notification.php:244
#: src/Model/Notification.php:250
#, php-format
msgid "%1$s liked your post %2$s"
msgstr ""
#: src/Model/Notification.php:251
#: src/Model/Notification.php:257
#, php-format
msgid "%1$s disliked your comment %2$s"
msgstr ""
#: src/Model/Notification.php:254
#: src/Model/Notification.php:260
#, php-format
msgid "%1$s disliked your post %2$s"
msgstr ""
#: src/Model/Notification.php:261
#: src/Model/Notification.php:267
#, php-format
msgid "%1$s shared your comment %2$s"
msgstr ""
#: src/Model/Notification.php:264
#: src/Model/Notification.php:270
#, php-format
msgid "%1$s shared your post %2$s"
msgstr ""
#: src/Model/Notification.php:271
#: src/Model/Notification.php:277
#, php-format
msgid "%1$s tagged you on %2$s"
msgstr ""
#: src/Model/Notification.php:275
#: src/Model/Notification.php:281
#, php-format
msgid "%1$s replied to you on %2$s"
msgstr ""
#: src/Model/Notification.php:279
#: src/Model/Notification.php:285
#, php-format
msgid "%1$s commented in your thread %2$s"
msgstr ""
#: src/Model/Notification.php:283
#: src/Model/Notification.php:289
#, php-format
msgid "%1$s commented on your comment %2$s"
msgstr ""
#: src/Model/Notification.php:287
#: src/Model/Notification.php:295
#, php-format
msgid "%1$s commented in the thread %2$s"
msgid "%1$s commented in their thread %2$s"
msgstr ""
#: src/Model/Notification.php:295
#: src/Model/Notification.php:297
#, php-format
msgid "%1$s commented in their thread"
msgstr ""
#: src/Model/Notification.php:299
#, php-format
msgid "%1$s commented in the thread %2$s from %3$s"
msgstr ""
#: src/Model/Notification.php:301
#, php-format
msgid "%1$s commented in the thread from %3$s"
msgstr ""
#: src/Model/Notification.php:306
#, php-format
msgid "%1$s commented on your thread %2$s"
msgstr ""
#: src/Model/Notification.php:300
#: src/Model/Notification.php:311
#, php-format
msgid "%1$s shared the post %2$s from %3$s"
msgstr ""
#: src/Model/Notification.php:302
#: src/Model/Notification.php:313
#, php-format
msgid "%1$s shared a post from %3$s"
msgstr ""
#: src/Model/Notification.php:304
#: src/Model/Notification.php:315
#, php-format
msgid "%1$s shared the post %2$s"
msgstr ""
#: src/Model/Notification.php:306
#: src/Model/Notification.php:317
#, php-format
msgid "%1$s shared a post"
msgstr ""