]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - lib/threadednoticelist.php
No nickname in profile listing
[quix0rs-gnu-social.git] / lib / threadednoticelist.php
index c3382897c7b368636b8b967b1ec54f9a0d5a4024..de714e0ab73bcd42fe3881195ac44cc0f411e76a 100644 (file)
@@ -27,9 +27,7 @@
  * @link      http://status.net/
  */
 
-if (!defined('STATUSNET') && !defined('LACONICA')) {
-    exit(1);
-}
+if (!defined('GNUSOCIAL') && !defined('STATUSNET')) { exit(1); }
 
 /**
  * widget for displaying a list of notices
@@ -52,7 +50,7 @@ class ThreadedNoticeList extends NoticeList
 {
     protected $userProfile;
 
-    function __construct($notice, $out=null, $profile=-1)
+    function __construct(Notice $notice, HTMLOutputter $out=null, $profile=-1)
     {
         parent::__construct($notice, $out);
         if (is_int($profile) && $profile == -1) {
@@ -91,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;
                 }
             }
@@ -104,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;
             }
 
@@ -149,7 +147,7 @@ class ThreadedNoticeList extends NoticeList
      *
      * @return NoticeListItem a list item for displaying the notice
      */
-    function newListItem($notice)
+    function newListItem(Notice $notice)
     {
         return new ThreadedNoticeListItem($notice, $this->out, $this->userProfile);
     }
@@ -176,7 +174,7 @@ class ThreadedNoticeListItem extends NoticeListItem
 {
     protected $userProfile = null;
 
-    function __construct($notice, $out=null, $profile=null)
+    function __construct(Notice $notice, HTMLOutputter $out=null, $profile=null)
     {
         parent::__construct($notice, $out);
         $this->userProfile = $profile;
@@ -210,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;
@@ -271,7 +274,7 @@ class ThreadedNoticeListSubItem extends NoticeListItem
 {
     protected $root = null;
 
-    function __construct($notice, $root, $out)
+    function __construct(Notice $notice, $root, $out)
     {
         $this->root = $root;
         parent::__construct($notice, $out);
@@ -318,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();
     }
 }
@@ -329,7 +334,7 @@ class ThreadedNoticeListMoreItem extends NoticeListItem
 {
     protected $cnt;
 
-    function __construct($notice, $out, $cnt)
+    function __construct(Notice $notice, HTMLOutputter $out, $cnt)
     {
         parent::__construct($notice, $out);
         $this->cnt = $cnt;
@@ -363,7 +368,7 @@ class ThreadedNoticeListMoreItem extends NoticeListItem
     function showMiniForm()
     {
         $id = $this->notice->conversation;
-        $url = common_local_url('conversationreplies', array('id' => $id));
+        $url = common_local_url('conversation', array('id' => $id));
 
         $n = Conversation::noticeCount($id) - 1;
 
@@ -543,7 +548,7 @@ class ThreadedNoticeListInlineFavesItem extends ThreadedNoticeListFavesItem
 {
     function showStart()
     {
-        $this->out->elementStart('div', array('class' => 'entry-content notice-faves'));
+        $this->out->elementStart('div', array('class' => 'e-content notice-faves'));
     }
 
     function showEnd()
@@ -553,7 +558,7 @@ class ThreadedNoticeListInlineFavesItem extends ThreadedNoticeListFavesItem
 }
 
 /**
- * Placeholder for showing faves...
+ * Placeholder for showing repeats...
  */
 class ThreadedNoticeListRepeatsItem extends NoticeListActorsItem
 {
@@ -614,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' => 'e-content notice-repeats'));
+    }
+
+    function showEnd()
+    {
+        $this->out->elementEnd('div');
+    }
+}