Check existence of $params['activity'] in notification()

- Address https://github.com/friendica/friendica/issues/9252#issuecomment-752730033
This commit is contained in:
Hypolite Petovan 2021-01-01 07:54:08 -05:00
parent f5da6f4ae3
commit ff94b9a694

View file

@ -184,9 +184,9 @@ function notification($params)
// First go for the general message // First go for the general message
// "George Bull's post" // "George Bull's post"
if ($params['activity']['origin_comment']) { if (!empty($params['activity']['origin_comment'])) {
$message = $l10n->t('%1$s replied to you on %2$s\'s %3$s %4$s'); $message = $l10n->t('%1$s replied to you on %2$s\'s %3$s %4$s');
} elseif ($params['activity']['explicit_tagged']) { } elseif (!empty($params['activity']['explicit_tagged'])) {
$message = $l10n->t('%1$s tagged you on %2$s\'s %3$s %4$s'); $message = $l10n->t('%1$s tagged you on %2$s\'s %3$s %4$s');
} else { } else {
$message = $l10n->t('%1$s commented on %2$s\'s %3$s %4$s'); $message = $l10n->t('%1$s commented on %2$s\'s %3$s %4$s');
@ -197,10 +197,10 @@ function notification($params)
// Then look for the special cases // Then look for the special cases
// "your post" // "your post"
if ($params['activity']['origin_thread']) { if (!empty($params['activity']['origin_thread'])) {
if ($params['activity']['origin_comment']) { if (!empty($params['activity']['origin_comment'])) {
$message = $l10n->t('%1$s replied to you on your %2$s %3$s'); $message = $l10n->t('%1$s replied to you on your %2$s %3$s');
} elseif ($params['activity']['explicit_tagged']) { } elseif (!empty($params['activity']['explicit_tagged'])) {
$message = $l10n->t('%1$s tagged you on your %2$s %3$s'); $message = $l10n->t('%1$s tagged you on your %2$s %3$s');
} else { } else {
$message = $l10n->t('%1$s commented on your %2$s %3$s'); $message = $l10n->t('%1$s commented on your %2$s %3$s');
@ -209,9 +209,9 @@ function notification($params)
$dest_str = sprintf($message, $params['source_name'], $item_post_type, $title); $dest_str = sprintf($message, $params['source_name'], $item_post_type, $title);
// "their post" // "their post"
} elseif ($item['author-link'] == $params['source_link']) { } elseif ($item['author-link'] == $params['source_link']) {
if ($params['activity']['origin_comment']) { if (!empty($params['activity']['origin_comment'])) {
$message = $l10n->t('%1$s replied to you on their %2$s %3$s'); $message = $l10n->t('%1$s replied to you on their %2$s %3$s');
} elseif ($params['activity']['explicit_tagged']) { } elseif (!empty($params['activity']['explicit_tagged'])) {
$message = $l10n->t('%1$s tagged you on their %2$s %3$s'); $message = $l10n->t('%1$s tagged you on their %2$s %3$s');
} else { } else {
$message = $l10n->t('%1$s commented on their %2$s %3$s'); $message = $l10n->t('%1$s commented on their %2$s %3$s');
@ -224,7 +224,7 @@ function notification($params)
// So, we cannot have different subjects for notifications of the same thread. // So, we cannot have different subjects for notifications of the same thread.
// Before this we have the name of the replier on the subject rendering // Before this we have the name of the replier on the subject rendering
// different subjects for messages on the same thread. // different subjects for messages on the same thread.
if ($params['activity']['explicit_tagged']) { if (!empty($params['activity']['explicit_tagged'])) {
$subject = $l10n->t('%s %s tagged you', $subjectPrefix, $params['source_name']); $subject = $l10n->t('%s %s tagged you', $subjectPrefix, $params['source_name']);
$preamble = $l10n->t('%1$s tagged you at %2$s', $params['source_name'], $sitename); $preamble = $l10n->t('%1$s tagged you at %2$s', $params['source_name'], $sitename);