forked from GNUsocial/gnu-social
NoResultException is common if reply_to was not cleared on parent deletion
This commit is contained in:
parent
a09cf51b99
commit
3a6c98ff16
|
@ -1630,6 +1630,8 @@ class Notice extends Managed_DataObject
|
||||||
self::blow('reply:stream:%d', $parentauthor->id);
|
self::blow('reply:stream:%d', $parentauthor->id);
|
||||||
} catch (NoParentNoticeException $e) {
|
} catch (NoParentNoticeException $e) {
|
||||||
// Not a reply, since it has no parent!
|
// Not a reply, since it has no parent!
|
||||||
|
} catch (NoResultException $e) {
|
||||||
|
// Parent notice was probably deleted
|
||||||
}
|
}
|
||||||
|
|
||||||
// @todo ideally this parser information would only
|
// @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
|
$ctx->replyToUrl = $reply->getUrl(true); // true for fallback to local URL, less messy
|
||||||
} catch (NoParentNoticeException $e) {
|
} catch (NoParentNoticeException $e) {
|
||||||
// This is not a reply to something
|
// This is not a reply to something
|
||||||
|
} catch (NoResultException $e) {
|
||||||
|
// Parent notice was probably deleted
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -330,6 +330,9 @@ class ApiAction extends Action
|
||||||
$in_reply_to = $parent->id;
|
$in_reply_to = $parent->id;
|
||||||
} catch (NoParentNoticeException $e) {
|
} catch (NoParentNoticeException $e) {
|
||||||
$in_reply_to = null;
|
$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;
|
$twitter_status['in_reply_to_status_id'] = $in_reply_to;
|
||||||
|
|
||||||
|
|
|
@ -364,13 +364,16 @@ abstract class ImPlugin extends Plugin
|
||||||
protected function formatNotice(Notice $notice)
|
protected function formatNotice(Notice $notice)
|
||||||
{
|
{
|
||||||
$profile = $notice->getProfile();
|
$profile = $notice->getProfile();
|
||||||
|
$nicknames = $profile->getNickname();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$parent = $notice->getParent();
|
$parent = $notice->getParent();
|
||||||
$orig_profile = $parent->getProfile();
|
$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) {
|
} 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);
|
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) {
|
} catch (NoParentNoticeException $e) {
|
||||||
// It wasn't a reply to anything, so we can't harvest nickname-relations.
|
// 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);
|
$matches = common_find_mentions_raw($text);
|
||||||
|
|
|
@ -351,6 +351,9 @@ class XmppPlugin extends ImPlugin
|
||||||
$xs->text(sprintf(' => %s', $orig_profile->nickname));
|
$xs->text(sprintf(' => %s', $orig_profile->nickname));
|
||||||
} catch (NoParentNoticeException $e) {
|
} catch (NoParentNoticeException $e) {
|
||||||
$xs->text(": ");
|
$xs->text(": ");
|
||||||
|
} catch (NoResultException $e) {
|
||||||
|
// Parent notice was probably deleted.
|
||||||
|
$xs->text(": ");
|
||||||
}
|
}
|
||||||
if (!empty($notice->rendered)) {
|
if (!empty($notice->rendered)) {
|
||||||
$notice->rendered = str_replace("\t", "", $notice->rendered);
|
$notice->rendered = str_replace("\t", "", $notice->rendered);
|
||||||
|
|
Loading…
Reference in New Issue