From 1e3cf08d82eedfbdd0ca2bc10ced971fd1adc3dc Mon Sep 17 00:00:00 2001 From: Stephen Paul Weber Date: Thu, 22 Oct 2015 17:20:03 +0000 Subject: [PATCH] Ignore non-local notices as targets --- plugins/Linkback/lib/util.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) 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; -- 2.39.5