]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Do proper fromUri lookup on groups too
authorMikael Nordfeldth <mmn@hethane.se>
Sat, 9 Jan 2016 13:36:47 +0000 (14:36 +0100)
committerMikael Nordfeldth <mmn@hethane.se>
Sat, 9 Jan 2016 13:36:47 +0000 (14:36 +0100)
classes/Notice.php
classes/Profile.php
plugins/OStatus/OStatusPlugin.php

index 6781918be4ae410e2b654466673ff0bbee31f859..b7378711f5d03382347eced4569a237cc17f8517 100644 (file)
@@ -974,8 +974,6 @@ class Notice extends Managed_DataObject
         // reasonably handle notifications themselves.
         if (ActivityUtils::compareVerbs($stored->verb, array(ActivityVerb::POST))) {
 
-            $stored->saveAttentions($act->context->attention);
-
             if (!empty($tags)) {
                 $stored->saveKnownTags($tags);
             } else {
@@ -984,7 +982,7 @@ class Notice extends Managed_DataObject
 
             // Note: groups may save tags, so must be run after tags are saved
             // to avoid errors on duplicates.
-            // Note: groups should always be set.
+            $stored->saveAttentions($act->context->attention);
 
             if (!empty($urls)) {
                 $stored->saveKnownUrls($urls);
index e8470d96c5d209641434934ee5d5bdde15b4046f..9c334fd923be614f04f1e41e419c09639e6b62ce 100644 (file)
@@ -1555,6 +1555,11 @@ class Profile extends Managed_DataObject
             $user = User::getKV('uri', $uri);
             if ($user instanceof User) {
                 $profile = $user->getProfile();
+            } else {
+                $group = User_group::getKV('uri', $uri);
+                if ($group instanceof User_group) {
+                    $profile = $group->getProfile();
+                }
             }
             Event::handle('EndGetProfileFromURI', array($uri, $profile));
         }
index c3307f23cbcb021dec2378f4391a146ba59cbca5..7c509f06418900d30bc9059ac15080f2f73e7c75 100644 (file)
@@ -1265,17 +1265,23 @@ class OStatusPlugin extends Plugin
     function onStartGetProfileFromURI($uri, &$profile)
     {
         // Don't want to do Web-based discovery on our own server,
-        // so we check locally first.
+        // so we check locally first. This duplicates the functionality
+        // in the Profile class, since the plugin always runs before
+        // that local lookup, but since we return false it won't run double.
 
         $user = User::getKV('uri', $uri);
-
-        if (!empty($user)) {
+        if ($user instanceof User) {
             $profile = $user->getProfile();
             return false;
+        } else {
+            $group = User_group::getKV('uri', $uri);
+            if ($group instanceof User_group) {
+                $profile = $group->getProfile();
+                return false;
+            }
         }
 
         // Now, check remotely
-
         try {
             $oprofile = Ostatus_profile::ensureProfileURI($uri);
             $profile = $oprofile->localProfile();