mirror of
https://github.com/friendica/friendica
synced 2024-12-24 12:00:15 +00:00
Merge branch 'threaded_items' of github.com:CyberDomovoy/friendica into threaded_items
This commit is contained in:
commit
16260e9fbb
3 changed files with 47 additions and 0 deletions
|
@ -862,9 +862,18 @@ function conversation(&$a, $items, $mode, $update, $preview = false) {
|
||||||
$threads = array();
|
$threads = array();
|
||||||
foreach($items as $item) {
|
foreach($items as $item) {
|
||||||
|
|
||||||
|
// Can we put this after the visibility check?
|
||||||
like_puller($a,$item,$alike,'like');
|
like_puller($a,$item,$alike,'like');
|
||||||
like_puller($a,$item,$dlike,'dislike');
|
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']) {
|
if($item['id'] == $item['parent']) {
|
||||||
$item_object = new Item($item);
|
$item_object = new Item($item);
|
||||||
$conv->add_thread($item_object);
|
$conv->add_thread($item_object);
|
||||||
|
|
|
@ -91,6 +91,18 @@ class Conversation extends BaseObject {
|
||||||
logger('[WARN] Conversation::add_thread : Thread already exists ('. $item->get_id() .').', LOGGER_DEBUG);
|
logger('[WARN] Conversation::add_thread : Thread already exists ('. $item->get_id() .').', LOGGER_DEBUG);
|
||||||
return false;
|
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);
|
$item->set_conversation($this);
|
||||||
$this->threads[] = $item;
|
$this->threads[] = $item;
|
||||||
return end($this->threads);
|
return end($this->threads);
|
||||||
|
|
|
@ -42,6 +42,15 @@ class Item extends BaseObject {
|
||||||
// Prepare the children
|
// Prepare the children
|
||||||
if(count($data['children'])) {
|
if(count($data['children'])) {
|
||||||
foreach($data['children'] as $item) {
|
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);
|
$child = new Item($item);
|
||||||
$this->add_child($child);
|
$this->add_child($child);
|
||||||
}
|
}
|
||||||
|
@ -270,6 +279,18 @@ class Item extends BaseObject {
|
||||||
logger('[WARN] Item::add_child : Item already exists ('. $item->get_id() .').', LOGGER_DEBUG);
|
logger('[WARN] Item::add_child : Item already exists ('. $item->get_id() .').', LOGGER_DEBUG);
|
||||||
return false;
|
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);
|
$item->set_parent($this);
|
||||||
$this->children[] = $item;
|
$this->children[] = $item;
|
||||||
return end($this->children);
|
return end($this->children);
|
||||||
|
@ -456,6 +477,8 @@ class Item extends BaseObject {
|
||||||
$ww = 'ww';
|
$ww = 'ww';
|
||||||
|
|
||||||
if($conv->is_writeable() && $this->is_writeable()) {
|
if($conv->is_writeable() && $this->is_writeable()) {
|
||||||
|
logger('[DEBUG] Item::get_comment_box : Comment box is visible.', LOGGER_DEBUG);
|
||||||
|
|
||||||
$a = $this->get_app();
|
$a = $this->get_app();
|
||||||
$qc = $qcomment = null;
|
$qc = $qcomment = null;
|
||||||
|
|
||||||
|
@ -493,6 +516,9 @@ class Item extends BaseObject {
|
||||||
'$ww' => (($conv->get_mode() === 'network') ? $ww : '')
|
'$ww' => (($conv->get_mode() === 'network') ? $ww : '')
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
logger('[DEBUG] Item::get_comment_box : Comment box is NOT visible. Conv: '. ($conv->is_writeable() ? 'yes' : 'no') .' Item: '. ($this->is_writeable() ? 'yes' : 'no'), LOGGER_DEBUG);
|
||||||
|
}
|
||||||
|
|
||||||
return $comment_box;
|
return $comment_box;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue