]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
isLocal() for User_group
authorMikael Nordfeldth <mmn@hethane.se>
Mon, 19 May 2014 12:46:54 +0000 (14:46 +0200)
committerMikael Nordfeldth <mmn@hethane.se>
Mon, 19 May 2014 12:46:54 +0000 (14:46 +0200)
classes/User_group.php
plugins/OStatus/OStatusPlugin.php

index e085014c46dd03256e65bfdae013206f74cac15a..762b4466016f8f16c7ee530f79759ee2e9296fad 100644 (file)
@@ -752,6 +752,8 @@ class User_group extends Managed_DataObject
         // or we'll miss clearing some cache keys; that can make it hard
         // to create a new group with one of those names or aliases.
         $this->setAliases(array());
+
+        // $this->isLocal() but we're using the resulting object
         $local = Local_group::getKV('group_id', $this->id);
         if ($local instanceof Local_group) {
             $local->delete();
@@ -804,6 +806,12 @@ class User_group extends Managed_DataObject
                 $this->force_scope == 1);
     }
 
+    public function isLocal()
+    {
+        $local = Local_group::getKV('group_id', $this->id);
+        return ($local instanceof Local_group);
+    }
+
     static function groupsFromText($text, Profile $profile)
     {
         $groups = array();
index 0befe150ab6ae379f4361630a9f2eae0cc3d4c46..d180a27d225aac104df095a0063238c20380e702 100644 (file)
@@ -1258,9 +1258,8 @@ class OStatusPlugin extends Plugin
     public static function localGroupFromUrl($url)
     {
         $group = User_group::getKV('uri', $url);
-        if ($group) {
-            $local = Local_group::getKV('group_id', $group->id);
-            if ($local) {
+        if ($group instanceof User_group) {
+            if ($group->isLocal()) {
                 return $group->id;
             }
         } else {