]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Show inline repeats-list in ThreadedNoticeList
authorMikael Nordfeldth <mmn@hethane.se>
Wed, 4 Jun 2014 22:59:13 +0000 (00:59 +0200)
committerMikael Nordfeldth <mmn@hethane.se>
Wed, 4 Jun 2014 22:59:49 +0000 (00:59 +0200)
Also, don't show repeats _as_ separate notices in the list either.

lib/noticelistitem.php
lib/threadednoticelist.php

index f46827d1f739206881eb7784b9c6d63761f82d53..75a1bdaab5469ccd539554dc89c3c8a539431b6d 100644 (file)
@@ -70,7 +70,7 @@ class NoticeListItem extends Widget
         parent::__construct($out);
         if (!empty($notice->repeat_of)) {
             $original = Notice::getKV('id', $notice->repeat_of);
-            if (empty($original)) { // could have been deleted
+            if (!$original instanceof Notice) { // could have been deleted
                 $this->notice = $notice;
             } else {
                 $this->notice = $original;
index ed3193420f009b5c3113cc1f9e586e602e07e0ff..92d9fbc571d88e6872a6e66c187242187f122fb3 100644 (file)
@@ -89,7 +89,7 @@ class ThreadedNoticeList extends NoticeList
             
             if ($notice->repeat_of) {
                 $orig = Notice::getKV('id', $notice->repeat_of);
-                if ($orig) {
+                if ($orig instanceof Notice) {
                     $notice = $orig;
                 }
             }
@@ -102,7 +102,7 @@ class ThreadedNoticeList extends NoticeList
 
             // Get the convo's root notice
             $root = $notice->conversationRoot($this->userProfile);
-            if ($root) {
+            if ($root instanceof Notice) {
                 $notice = $root;
             }
 
@@ -208,6 +208,11 @@ class ThreadedNoticeListItem extends NoticeListItem
             $moreCutoff = null;
             while ($notice->fetch()) {
                 if (Event::handle('StartAddNoticeReply', array($this, $this->notice, $notice))) {
+                    // Don't list repeats as separate notices in a conversation
+                    if (!empty($notice->repeat_of)) {
+                        continue;
+                    }
+
                     if ($notice->id == $this->notice->id) {
                         // Skip!
                         continue;
@@ -316,6 +321,8 @@ class ThreadedNoticeListSubItem extends NoticeListItem
     {
         $item = new ThreadedNoticeListInlineFavesItem($this->notice, $this->out);
         $hasFaves = $item->show();
+        $item = new ThreadedNoticeListInlineRepeatsItem($this->notice, $this->out);
+        $hasRepeats = $item->show();
         parent::showEnd();
     }
 }
@@ -551,7 +558,7 @@ class ThreadedNoticeListInlineFavesItem extends ThreadedNoticeListFavesItem
 }
 
 /**
- * Placeholder for showing faves...
+ * Placeholder for showing repeats...
  */
 class ThreadedNoticeListRepeatsItem extends NoticeListActorsItem
 {
@@ -612,3 +619,17 @@ class ThreadedNoticeListRepeatsItem extends NoticeListActorsItem
         $this->out->elementEnd('li');
     }
 }
+
+// @todo FIXME: needs documentation.
+class ThreadedNoticeListInlineRepeatsItem extends ThreadedNoticeListRepeatsItem
+{
+    function showStart()
+    {
+        $this->out->elementStart('div', array('class' => 'entry-content notice-repeats'));
+    }
+
+    function showEnd()
+    {
+        $this->out->elementEnd('div');
+    }
+}