Non-replies cannot harvest parent notice nicknames

A feature we use of parent notices is that if you use the same @user
as the parent notice, the same @user will be notified, regardless if
there might be @user@site.com as well as @user@example.com and you're
subscribed to just one of them (or both, or none of them!).

But this threw an exception since we tested this on new notice threads.
This commit is contained in:
Mikael Nordfeldth 2015-07-16 12:53:10 +02:00
parent cd23c78800
commit 44dc00a58c
1 changed files with 13 additions and 9 deletions

View File

@ -710,18 +710,22 @@ function common_find_mentions($text, Notice $notice)
// Is it a reply?
$origNotice = $notice->getParent();
$origAuthor = $origNotice->getProfile();
try {
$origNotice = $notice->getParent();
$origAuthor = $origNotice->getProfile();
$ids = $origNotice->getReplies();
$ids = $origNotice->getReplies();
foreach ($ids as $id) {
try {
$repliedTo = Profile::getByID($id);
$origMentions[$repliedTo->nickname] = $repliedTo;
} catch (NoResultException $e) {
// continue foreach
foreach ($ids as $id) {
try {
$repliedTo = Profile::getByID($id);
$origMentions[$repliedTo->getNickname()] = $repliedTo;
} catch (NoResultException $e) {
// continue foreach
}
}
} catch (NoParentNoticeException $e) {
// It wasn't a reply to anything, so we can't harvest nickname-relations.
}
$matches = common_find_mentions_raw($text);