diff options
-rw-r--r-- | include/ConversationObject.php | 16 | ||||
-rw-r--r-- | include/conversation.php | 6 |
2 files changed, 17 insertions, 5 deletions
diff --git a/include/ConversationObject.php b/include/ConversationObject.php index bb144d893..d8c6bca77 100644 --- a/include/ConversationObject.php +++ b/include/ConversationObject.php @@ -22,10 +22,17 @@ class Conversation extends BaseObject { private $commentable = false; private $profile_owner = 0; private $preview = false; + private $prepared_item = ''; - public function __construct($mode, $preview) { + + // $prepared_item is for use by alternate conversation structures such as photos + // wherein we've already prepared a top level item which doesn't look anything like + // a normal "post" item + + public function __construct($mode, $preview, $prepared_item = '') { $this->set_mode($mode); $this->preview = $preview; + $this->prepared_item = $prepared_item; } /** @@ -180,7 +187,12 @@ class Conversation extends BaseObject { foreach($this->threads as $item) { - $item_data = $item->get_template_data($alike, $dlike); + if(($item->get_data_value('id') == $item->get_data_value('parent')) && $this->prepared_item) { + $item_data = $this->prepared_item; + } + else { + $item_data = $item->get_template_data($alike, $dlike); + } if(!$item_data) { logger('[ERROR] Conversation::get_template_data : Failed to get item template data ('. $item->get_id() .').', LOGGER_DEBUG); return false; diff --git a/include/conversation.php b/include/conversation.php index c1d8e91f9..a8b3150b4 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -397,7 +397,7 @@ function visible_activity($item) { */ -function conversation(&$a, $items, $mode, $update, $page_mode = 'traditional') { +function conversation(&$a, $items, $mode, $update, $page_mode = 'traditional', $prepared_item = '') { $tstart = dba_timer(); $t0 = $t1 = $t2 = $t3 = $t4 = $t5 = $t6 = null; @@ -723,7 +723,7 @@ function conversation(&$a, $items, $mode, $update, $page_mode = 'traditional') { require_once('include/ConversationObject.php'); require_once('include/ItemObject.php'); - $conv = new Conversation($mode, $preview); + $conv = new Conversation($mode, $preview, $prepared_item); // In the display mode we don't have a profile owner. @@ -764,7 +764,7 @@ function conversation(&$a, $items, $mode, $update, $page_mode = 'traditional') { } - // Can we put this after the visibility check? + like_puller($a,$item,$alike,'like'); if(feature_enabled($profile_owner,'dislike')) |