]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - actions/conversation.php
Removed 'bookmarklet' since we have Bookmark plugin
[quix0rs-gnu-social.git] / actions / conversation.php
index cfe4e47fe607607eab22d7e896d69b2cfde8e699..aa2539d213d4a49fcbc07e54480db4d9a78610c4 100644 (file)
@@ -47,9 +47,10 @@ require_once INSTALLDIR.'/lib/noticelist.php';
  */
 class ConversationAction extends Action
 {
-    var $id      = null;
-    var $page    = null;
-    var $notices = null;
+    var $id          = null;
+    var $page        = null;
+    var $notices     = null;
+    var $userProfile = null;
 
     const MAX_NOTICES = 500;
 
@@ -76,14 +77,14 @@ class ConversationAction extends Action
         $cur = common_current_user();
 
         if (empty($cur)) {
-            $profile = null;
+            $this->userProfile = null;
         } else {
-            $profile = $cur->getProfile();
+            $this->userProfile = $cur->getProfile();
         }
 
-        $stream = new ConversationNoticeStream($this->id, $profile);
+        $stream = new ConversationNoticeStream($this->id, $this->userProfile);
 
-        $this->notices = $stream->getNotices(0, self::MAX_NOTICES, null, null);
+        $this->notices = $stream->getNotices(0, self::MAX_NOTICES);
 
         return true;
     }
@@ -122,13 +123,49 @@ class ConversationAction extends Action
      */
     function showContent()
     {
-        $tnl = new ThreadedNoticeList($this->notices, $this);
+        $user = common_current_user();
 
-        $cnt = $tnl->show();
+        if (!empty($user) && $user->conversationTree()) {
+            $nl = new ConversationTree($this->notices, $this);
+        } else {
+            $nl = new FullThreadedNoticeList($this->notices, $this, $this->userProfile);
+        }
+
+        $cnt = $nl->show();
     }
 
     function isReadOnly()
     {
         return true;
     }
+    
+    function getFeeds()
+    {
+       
+        return array(new Feed(Feed::JSON,
+                              common_local_url('apiconversation',
+                                               array(
+                                                    'id' => $this->id,
+                                                    'format' => 'as')),
+                              // TRANS: Title for link to notice feed.
+                              // TRANS: %s is a user nickname.
+                              _('Conversation feed (Activity Streams JSON)')),
+                     new Feed(Feed::RSS2,
+                              common_local_url('apiconversation',
+                                               array(
+                                                    'id' => $this->id,
+                                                    'format' => 'rss')),
+                              // TRANS: Title for link to notice feed.
+                              // TRANS: %s is a user nickname.
+                              _('Conversation feed (RSS 2.0)')),
+                     new Feed(Feed::ATOM,
+                              common_local_url('apiconversation',
+                                               array(
+                                                    'id' => $this->id,
+                                                    'format' => 'atom')),
+                              // TRANS: Title for link to notice feed.
+                              // TRANS: %s is a user nickname.
+                              _('Conversation feed (Activity Streams JSON)')));
+    }
 }
+