]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - classes/Notice.php
common_sql_now() is recommended before DB_DataObject_Cast::dateTime()
[quix0rs-gnu-social.git] / classes / Notice.php
index 5d6ae128108430e293d2857e189ff1c281793bb8..4812dff91a29b5caf70fb9e2262154fcaef43889 100644 (file)
@@ -211,6 +211,11 @@ class Notice extends Managed_DataObject
         return $result;
     }
 
+    public function getUri()
+    {
+        return $this->uri;
+    }
+
     /**
      * Extract #hashtags from this notice's content and save them to the database.
      */
@@ -417,7 +422,7 @@ class Notice extends Managed_DataObject
 
             $repeat = Notice::getKV('id', $repeat_of);
 
-            if (empty($repeat)) {
+            if (!($repeat instanceof Notice)) {
                 // TRANS: Client exception thrown in notice when trying to repeat a missing or deleted notice.
                 throw new ClientException(_('Cannot repeat; original notice is missing or deleted.'));
             }
@@ -439,7 +444,7 @@ class Notice extends Managed_DataObject
                 throw new ClientException(_('Cannot repeat a notice you cannot read.'), 403);
             }
 
-            if ($profile->hasRepeated($repeat->id)) {
+            if ($profile->hasRepeated($repeat)) {
                 // TRANS: Client error displayed when trying to repeat an already repeated notice.
                 throw new ClientException(_('You already repeated that notice.'));
             }
@@ -927,13 +932,11 @@ class Notice extends Managed_DataObject
             try {
                 $parent = $last->getParent();
                 if ($parent->inScope($profile)) {
-                    common_debug(__METHOD__ . 'Parent of '.$last->id.' is '.$parent->id);
                     $last = $parent;
                     continue;
                 }
             } catch (Exception $e) {
                 // Latest notice has no parent
-                common_debug(__METHOD__ . 'Found no parent for '.$last->id);
             }
             // No parent, or parent out of scope
             $root = $last;
@@ -1712,9 +1715,9 @@ class Notice extends Managed_DataObject
         // favorite and repeated
 
         if (!empty($cur)) {
-            $noticeInfoAttr['favorite'] = ($cur->hasFave($this)) ? "true" : "false";
             $cp = $cur->getProfile();
-            $noticeInfoAttr['repeated'] = ($cp->hasRepeated($this->id)) ? "true" : "false";
+            $noticeInfoAttr['favorite'] = ($cp->hasFave($this)) ? "true" : "false";
+            $noticeInfoAttr['repeated'] = ($cp->hasRepeated($this)) ? "true" : "false";
         }
 
         if (!empty($this->repeat_of)) {