Don't count and fetch "follow" activities
This commit is contained in:
parent
fbf846accb
commit
856cf7f664
|
@ -769,20 +769,12 @@ function conversation_add_children(array $parents, $block_authors, $order, $uid)
|
||||||
|
|
||||||
$items = [];
|
$items = [];
|
||||||
|
|
||||||
|
$follow = Item::activityToIndex(Activity::FOLLOW);
|
||||||
|
|
||||||
foreach ($parents AS $parent) {
|
foreach ($parents AS $parent) {
|
||||||
$condition = ["`item`.`parent-uri` = ? AND `item`.`uid` IN (0, ?) ",
|
$condition = ["`item`.`parent-uri` = ? AND `item`.`uid` IN (0, ?) AND (`activity` != ? OR `activity` IS NULL)",
|
||||||
$parent['uri'], $uid];
|
$parent['uri'], $uid, $follow];
|
||||||
if ($block_authors) {
|
$items = conversation_fetch_items($parent, $items, $condition, $block_authors, $params);
|
||||||
$condition[0] .= "AND NOT `author`.`hidden`";
|
|
||||||
}
|
|
||||||
|
|
||||||
$thread_items = Item::selectForUser(local_user(), array_merge(Item::DISPLAY_FIELDLIST, ['contact-uid', 'gravity']), $condition, $params);
|
|
||||||
|
|
||||||
$comments = conversation_fetch_comments($thread_items, $parent['pinned'] ?? false);
|
|
||||||
|
|
||||||
if (count($comments) != 0) {
|
|
||||||
$items = array_merge($items, $comments);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($items as $index => $item) {
|
foreach ($items as $index => $item) {
|
||||||
|
@ -796,6 +788,31 @@ function conversation_add_children(array $parents, $block_authors, $order, $uid)
|
||||||
return $items;
|
return $items;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fetch conversation items
|
||||||
|
*
|
||||||
|
* @param array $parent
|
||||||
|
* @param array $items
|
||||||
|
* @param array $condition
|
||||||
|
* @param boolean $block_authors
|
||||||
|
* @param array $params
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
function conversation_fetch_items(array $parent, array $items, array $condition, bool $block_authors, array $params) {
|
||||||
|
if ($block_authors) {
|
||||||
|
$condition[0] .= "AND NOT `author`.`hidden`";
|
||||||
|
}
|
||||||
|
|
||||||
|
$thread_items = Item::selectForUser(local_user(), array_merge(Item::DISPLAY_FIELDLIST, ['contact-uid', 'gravity']), $condition, $params);
|
||||||
|
|
||||||
|
$comments = conversation_fetch_comments($thread_items, $parent['pinned'] ?? false);
|
||||||
|
|
||||||
|
if (count($comments) != 0) {
|
||||||
|
$items = array_merge($items, $comments);
|
||||||
|
}
|
||||||
|
return $items;
|
||||||
|
}
|
||||||
|
|
||||||
function item_photo_menu($item) {
|
function item_photo_menu($item) {
|
||||||
$sub_link = '';
|
$sub_link = '';
|
||||||
$poke_link = '';
|
$poke_link = '';
|
||||||
|
|
|
@ -30,6 +30,7 @@ use Friendica\Model\Contact;
|
||||||
use Friendica\Model\Group;
|
use Friendica\Model\Group;
|
||||||
use Friendica\Model\Item;
|
use Friendica\Model\Item;
|
||||||
use Friendica\Model\Notify\Type;
|
use Friendica\Model\Notify\Type;
|
||||||
|
use Friendica\Protocol\Activity;
|
||||||
use Friendica\Util\DateTimeFormat;
|
use Friendica\Util\DateTimeFormat;
|
||||||
use Friendica\Util\Temporal;
|
use Friendica\Util\Temporal;
|
||||||
use Friendica\Util\Proxy as ProxyUtils;
|
use Friendica\Util\Proxy as ProxyUtils;
|
||||||
|
@ -134,9 +135,10 @@ function ping_init(App $a)
|
||||||
|
|
||||||
$notifs = ping_get_notifications(local_user());
|
$notifs = ping_get_notifications(local_user());
|
||||||
|
|
||||||
$condition = ["`unseen` AND `uid` = ? AND `contact-id` != ?", local_user(), local_user()];
|
$condition = ["`unseen` AND `uid` = ? AND `contact-id` != ? AND (`activity` != ? OR `activity` IS NULL)",
|
||||||
|
local_user(), local_user(), Item::activityToIndex(Activity::FOLLOW)];
|
||||||
$fields = ['id', 'parent', 'verb', 'author-name', 'unseen', 'author-link', 'author-avatar', 'contact-avatar',
|
$fields = ['id', 'parent', 'verb', 'author-name', 'unseen', 'author-link', 'author-avatar', 'contact-avatar',
|
||||||
'network', 'created', 'object', 'parent-author-name', 'parent-author-link', 'parent-guid', 'wall'];
|
'network', 'created', 'object', 'parent-author-name', 'parent-author-link', 'parent-guid', 'wall', 'activity'];
|
||||||
$params = ['order' => ['received' => true]];
|
$params = ['order' => ['received' => true]];
|
||||||
$items = Item::selectForUser(local_user(), $fields, $condition, $params);
|
$items = Item::selectForUser(local_user(), $fields, $condition, $params);
|
||||||
|
|
||||||
|
|
|
@ -74,7 +74,7 @@ class Item
|
||||||
'event-id', 'event-created', 'event-edited', 'event-start', 'event-finish',
|
'event-id', 'event-created', 'event-edited', 'event-start', 'event-finish',
|
||||||
'event-summary', 'event-desc', 'event-location', 'event-type',
|
'event-summary', 'event-desc', 'event-location', 'event-type',
|
||||||
'event-nofinish', 'event-adjust', 'event-ignore', 'event-id',
|
'event-nofinish', 'event-adjust', 'event-ignore', 'event-id',
|
||||||
'delivery_queue_count', 'delivery_queue_done', 'delivery_queue_failed'
|
'delivery_queue_count', 'delivery_queue_done', 'delivery_queue_failed', 'activity'
|
||||||
];
|
];
|
||||||
|
|
||||||
// Field list that is used to deliver items via the protocols
|
// Field list that is used to deliver items via the protocols
|
||||||
|
@ -1672,7 +1672,13 @@ class Item
|
||||||
$allow_gid = $parent['allow_gid'];
|
$allow_gid = $parent['allow_gid'];
|
||||||
$deny_cid = $parent['deny_cid'];
|
$deny_cid = $parent['deny_cid'];
|
||||||
$deny_gid = $parent['deny_gid'];
|
$deny_gid = $parent['deny_gid'];
|
||||||
$item['wall'] = $parent['wall'];
|
|
||||||
|
// Don't federate received participation messages
|
||||||
|
if ($item['verb'] != Activity::FOLLOW) {
|
||||||
|
$item['wall'] = $parent['wall'];
|
||||||
|
} else {
|
||||||
|
$item['wall'] = false;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If the parent is private, force privacy for the entire conversation
|
* If the parent is private, force privacy for the entire conversation
|
||||||
|
|
Loading…
Reference in a new issue