$threads = array();
foreach($items as $item) {
+ // Can we put this after the visibility check?
like_puller($a,$item,$alike,'like');
like_puller($a,$item,$dlike,'dislike');
+ // Only add what is visible
+ if($item['network'] === NETWORK_MAIL && local_user() != $item['uid']) {
+ continue;
+ }
+ if($item['verb'] === ACTIVITY_LIKE || $item['verb'] === ACTIVITY_DISLIKE) {
+ continue;
+ }
+
if($item['id'] == $item['parent']) {
$item_object = new Item($item);
$conv->add_thread($item_object);
logger('[WARN] Conversation::add_thread : Thread already exists ('. $item->get_id() .').', LOGGER_DEBUG);
return false;
}
+
+ /*
+ * Only add will be displayed
+ */
+ if($item->get_data_value('network') === NETWORK_MAIL && local_user() != $item->get_data_value('uid')) {
+ logger('[WARN] Conversation::add_thread : Thread is a mail ('. $item->get_id() .').', LOGGER_DEBUG);
+ return false;
+ }
+ if($item->get_data_value('verb') === ACTIVITY_LIKE || $item->get_data_value('verb') === ACTIVITY_DISLIKE) {
+ logger('[WARN] Conversation::add_thread : Thread is a (dis)like ('. $item->get_id() .').', LOGGER_DEBUG);
+ return false;
+ }
$item->set_conversation($this);
$this->threads[] = $item;
return end($this->threads);
// Prepare the children
if(count($data['children'])) {
foreach($data['children'] as $item) {
+ /*
+ * Only add will be displayed
+ */
+ if($item['network'] === NETWORK_MAIL && local_user() != $item['uid']) {
+ continue;
+ }
+ if($item['verb'] === ACTIVITY_LIKE || $item['verb'] === ACTIVITY_DISLIKE) {
+ continue;
+ }
$child = new Item($item);
$this->add_child($child);
}
logger('[WARN] Item::add_child : Item already exists ('. $item->get_id() .').', LOGGER_DEBUG);
return false;
}
+ /*
+ * Only add will be displayed
+ */
+ if($item->get_data_value('network') === NETWORK_MAIL && local_user() != $item->get_data_value('uid')) {
+ logger('[WARN] Item::add_child : Item is a mail ('. $item->get_id() .').', LOGGER_DEBUG);
+ return false;
+ }
+ if($item->get_data_value('verb') === ACTIVITY_LIKE || $item->get_data_value('verb') === ACTIVITY_DISLIKE) {
+ logger('[WARN] Item::add_child : Item is a (dis)like ('. $item->get_id() .').', LOGGER_DEBUG);
+ return false;
+ }
+
$item->set_parent($this);
$this->children[] = $item;
return end($this->children);