diff --git a/include/conversation.php b/include/conversation.php index e4e633f5a3..6dd1a473ec 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -840,7 +840,7 @@ function conversation(App $a, $items, $mode, $update, $preview = false) { // Normal View $page_template = get_markup_template("threaded_conversation.tpl"); - $conv = new Conversation($mode, $preview); + $conv = new Thread($mode, $preview); /* * get all the topmost parents diff --git a/src/Object/Item.php b/src/Object/Post.php similarity index 97% rename from src/Object/Item.php rename to src/Object/Post.php index 13a69fd289..902435b513 100644 --- a/src/Object/Item.php +++ b/src/Object/Post.php @@ -1,25 +1,24 @@ countDescendants(); - $conv = $this->getConversation(); + $conv = $this->getThread(); $lock = ((($item['private'] == 1) || (($item['uid'] == local_user()) && (strlen($item['allow_cid']) || strlen($item['allow_gid']) || strlen($item['deny_cid']) || strlen($item['deny_gid'])))) @@ -540,7 +539,7 @@ class Item extends BaseObject } $this->parent = $item; - $this->setConversation($item->getConversation()); + $this->setThread($item->getThread()); } /** @@ -551,7 +550,7 @@ class Item extends BaseObject protected function removeParent() { $this->parent = null; - $this->conversation = null; + $this->thread = null; } /** @@ -594,15 +593,15 @@ class Item extends BaseObject * * @return void */ - public function setConversation($conv) + public function setThread($conv) { - $previous_mode = ($this->conversation ? $this->conversation->getMode() : ''); + $previous_mode = ($this->thread ? $this->thread->getMode() : ''); - $this->conversation = $conv; + $this->thread = $conv; // Set it on our children too foreach ($this->getChildren() as $child) { - $child->setConversation($conv); + $child->setThread($conv); } } @@ -611,9 +610,9 @@ class Item extends BaseObject * * @return object */ - public function getConversation() + public function getThread() { - return $this->conversation; + return $this->thread; } /** @@ -690,7 +689,7 @@ class Item extends BaseObject */ private function isWritable() { - $conv = $this->getConversation(); + $conv = $this->getThread(); if ($conv) { // This will allow us to comment on wall-to-wall items owned by our friends @@ -748,7 +747,7 @@ class Item extends BaseObject $a = self::getApp(); $comment_box = ''; - $conv = $this->getConversation(); + $conv = $this->getThread(); $template = get_markup_template($this->getCommentBoxTemplate()); $ww = ''; if (($conv->getMode() === 'network') && $this->isWallToWall()) { @@ -819,7 +818,7 @@ class Item extends BaseObject protected function checkWallToWall() { $a = self::getApp(); - $conv = $this->getConversation(); + $conv = $this->getThread(); $this->wall_to_wall = false; if ($this->isToplevel()) { @@ -889,14 +888,6 @@ class Item extends BaseObject return $this->owner_url; } - /** - * @return string - */ - private function getOwnerPhoto() - { - return $this->owner_photo; - } - /** * @return string */ diff --git a/src/Object/Conversation.php b/src/Object/Thread.php similarity index 91% rename from src/Object/Conversation.php rename to src/Object/Thread.php index f09964ff2c..d159f41c96 100644 --- a/src/Object/Conversation.php +++ b/src/Object/Thread.php @@ -1,6 +1,6 @@ getThread($item->getId())) { + if ($this->getParent($item->getId())) { logger('[WARN] Conversation::addThread : Thread already exists ('. $item->getId() .').', LOGGER_DEBUG); return false; } @@ -147,10 +147,10 @@ class Conversation extends BaseObject return false; } - $item->setConversation($this); - $this->threads[] = $item; + $item->setThread($this); + $this->parents[] = $item; - return end($this->threads); + return end($this->parents); } /** @@ -169,7 +169,7 @@ class Conversation extends BaseObject $result = array(); $i = 0; - foreach ($this->threads as $item) { + foreach ($this->parents as $item) { if ($item->getDataValue('network') === NETWORK_MAIL && local_user() != $item->getDataValue('uid')) { continue; } @@ -194,9 +194,9 @@ class Conversation extends BaseObject * @return mixed The found item on success * false on failure */ - private function getThread($id) + private function getParent($id) { - foreach ($this->threads as $item) { + foreach ($this->parents as $item) { if ($item->getId() == $id) { return $item; }