]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - classes/Profile.php
getID() will complain loudly if something is wrong
[quix0rs-gnu-social.git] / classes / Profile.php
index 09f9ca71d109933db6509cb883ec1bee866d222c..78ef18484c7e0d9f7c9f2559cb419783f39fd1ad 100644 (file)
@@ -144,7 +144,7 @@ class Profile extends Managed_DataObject
     public function hasPassword()
     {
         try {
-            return !empty($this->getUser()->hasPassword());
+            return $this->getUser()->hasPassword();
         } catch (NoSuchUserException $e) {
             return false;
         }
@@ -1242,8 +1242,9 @@ class Profile extends Managed_DataObject
     {
         // XXX: not really a pkey, but should work
 
-        $notice = Notice::pkeyGet(array('profile_id' => $this->id,
-                                        'repeat_of' => $notice->id));
+        $notice = Notice::pkeyGet(array('profile_id' => $this->getID(),
+                                        'repeat_of' => $notice->getID(),
+                                        'verb' => ActivityVerb::SHARE));
 
         return !empty($notice);
     }
@@ -1593,8 +1594,20 @@ class Profile extends Managed_DataObject
         return $this;
     }
 
-    public function sameAs(Profile $other)
+    /**
+     * Test whether the given profile is the same as the current class,
+     * for testing identities.
+     *
+     * @param Profile $other    The other profile, usually from Action's $this->scoped
+     *
+     * @return boolean
+     */
+    public function sameAs(Profile $other=null)
     {
+        if (is_null($other)) {
+            // In case $this->scoped is null or something, i.e. not a current/legitimate profile.
+            return false;
+        }
         return $this->getID() === $other->getID();
     }