From: Mikael Nordfeldth Date: Thu, 16 Jul 2015 10:53:10 +0000 (+0200) Subject: Non-replies cannot harvest parent notice nicknames X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=44dc00a58c4d0f3d78e7b6dc2cee13959e480aad;p=quix0rs-gnu-social.git 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. --- diff --git a/lib/util.php b/lib/util.php index 4d69651089..4949231c52 100644 --- a/lib/util.php +++ b/lib/util.php @@ -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);