From: Stephen Paul Weber Date: Thu, 22 Oct 2015 17:20:03 +0000 (+0000) Subject: Ignore non-local notices as targets X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=1e3cf08d82eedfbdd0ca2bc10ced971fd1adc3dc;p=quix0rs-gnu-social.git Ignore non-local notices as targets --- diff --git a/plugins/Linkback/lib/util.php b/plugins/Linkback/lib/util.php index e4893bc644..803c47763d 100644 --- a/plugins/Linkback/lib/util.php +++ b/plugins/Linkback/lib/util.php @@ -24,7 +24,6 @@ function linkback_get_source($source, $target) { function linkback_get_target($target) { // TODO: linkback to a user should work for attention - // TODO: ignore remote notices and users // Resolve target (https://github.com/converspace/webmention/issues/43) $request = HTTPClient::start(); @@ -35,10 +34,14 @@ function linkback_get_target($target) { } try { - return Notice::fromUri($response->getEffectiveUrl()); + $notice = Notice::fromUri($response->getEffectiveUrl()); } catch(UnknownUriException $ex) { preg_match('/\/notice\/(\d+)(?:#.*)?$/', $response->getEffectiveUrl(), $match); - return Notice::getKV('id', $match[1]); + $notice = Notice::getKV('id', $match[1]); + } + + if($notice instanceof Notice && $notice->isLocal()) { + return $notice; } return NULL;