]> 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 5709a15d01060513b7b63b956d63f227edafdf56..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;
         }
@@ -877,6 +877,11 @@ class Profile extends Managed_DataObject
 
     function delete($useWhere=false)
     {
+        // just in case it hadn't been done before... (usually set before adding deluser to queue handling!)
+        if (!$this->hasRole(Profile_role::DELETED)) {
+            $this->grantRole(Profile_role::DELETED);
+        }
+
         $this->_deleteNotices();
         $this->_deleteSubscriptions();
         $this->_deleteTags();
@@ -1237,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);
     }
@@ -1407,6 +1413,11 @@ class Profile extends Managed_DataObject
         return $this->fullname;
     }
 
+    public function getHomepage()
+    {
+        return $this->homepage;
+    }
+
     public function getDescription()
     {
         return $this->bio;
@@ -1583,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();
     }