]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Ignore non-local notices as targets
authorStephen Paul Weber <singpolyma@singpolyma.net>
Thu, 22 Oct 2015 17:20:03 +0000 (17:20 +0000)
committerStephen Paul Weber <singpolyma@singpolyma.net>
Thu, 12 Nov 2015 19:06:15 +0000 (19:06 +0000)
plugins/Linkback/lib/util.php

index e4893bc644a2ca0c577b62959596dd0d554030fb..803c47763daf7caf9a21a28f825734622b271522 100644 (file)
@@ -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;