git.gnu.io has moved to IP address 209.51.188.249 -- please double check where you are logging in.

Commit 3a6c98ff authored by mmn's avatar mmn

NoResultException is common if reply_to was not cleared on parent deletion

parent a09cf51b
......@@ -1630,6 +1630,8 @@ class Notice extends Managed_DataObject
self::blow('reply:stream:%d', $parentauthor->id);
} catch (NoParentNoticeException $e) {
// Not a reply, since it has no parent!
} catch (NoResultException $e) {
// Parent notice was probably deleted
}
// @todo ideally this parser information would only
......@@ -1855,6 +1857,8 @@ class Notice extends Managed_DataObject
$ctx->replyToUrl = $reply->getUrl(true); // true for fallback to local URL, less messy
} catch (NoParentNoticeException $e) {
// This is not a reply to something
} catch (NoResultException $e) {
// Parent notice was probably deleted
}
try {
......
......@@ -330,6 +330,9 @@ class ApiAction extends Action
$in_reply_to = $parent->id;
} catch (NoParentNoticeException $e) {
$in_reply_to = null;
} catch (NoResultException $e) {
// the in_reply_to message has probably been deleted
$in_reply_to = null;
}
$twitter_status['in_reply_to_status_id'] = $in_reply_to;
......
......@@ -364,13 +364,16 @@ abstract class ImPlugin extends Plugin
protected function formatNotice(Notice $notice)
{
$profile = $notice->getProfile();
$nicknames = $profile->getNickname();
try {
$parent = $notice->getParent();
$orig_profile = $parent->getProfile();
$nicknames = sprintf('%1$s => %2$s', $profile->nickname, $orig_profile->nickname);
$nicknames = sprintf('%1$s => %2$s', $profile->getNickname(), $orig_profile->getNickname());
} catch (NoParentNoticeException $e) {
$nicknames = $profile->nickname;
// Not a reply, no parent notice stored
} catch (NoResultException $e) {
// Parent notice was probably deleted
}
return sprintf('%1$s: %2$s [%3$u]', $nicknames, $notice->content, $notice->id);
......
......@@ -725,6 +725,8 @@ function common_find_mentions($text, Notice $notice)
}
} catch (NoParentNoticeException $e) {
// It wasn't a reply to anything, so we can't harvest nickname-relations.
} catch (NoResultException $e) {
// The parent notice was deleted.
}
$matches = common_find_mentions_raw($text);
......
......@@ -351,6 +351,9 @@ class XmppPlugin extends ImPlugin
$xs->text(sprintf(' => %s', $orig_profile->nickname));
} catch (NoParentNoticeException $e) {
$xs->text(": ");
} catch (NoResultException $e) {
// Parent notice was probably deleted.
$xs->text(": ");
}
if (!empty($notice->rendered)) {
$notice->rendered = str_replace("\t", "", $notice->rendered);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment