mirror of
https://github.com/friendica/friendica
synced 2025-04-28 13:04:23 +02:00
Use the post-counts table to display content (#13781)
* Use the post-counts table to display content * Use verb instead of vid * Use verb * Update counter on delete
This commit is contained in:
parent
0c68a53e1e
commit
8fc96477e7
12 changed files with 250 additions and 126 deletions
|
@ -338,7 +338,7 @@ class Item
|
|||
// locate item to be deleted
|
||||
$fields = [
|
||||
'id', 'uri', 'uri-id', 'uid', 'parent', 'parent-uri-id', 'origin',
|
||||
'deleted', 'resource-id', 'event-id',
|
||||
'thr-parent-id', 'deleted', 'resource-id', 'event-id', 'vid', 'body',
|
||||
'verb', 'object-type', 'object', 'target', 'contact-id', 'psid', 'gravity'
|
||||
];
|
||||
$item = Post::selectFirst($fields, ['id' => $item_id]);
|
||||
|
@ -418,6 +418,10 @@ class Item
|
|||
DI::notify()->deleteForItem($item['uri-id']);
|
||||
DI::notification()->deleteForItem($item['uri-id']);
|
||||
|
||||
if (in_array($item['gravity'], [self::GRAVITY_ACTIVITY, self::GRAVITY_COMMENT])) {
|
||||
Post\Counts::update($item['thr-parent-id'], $item['parent-uri-id'], $item['vid'], $item['verb'], $item['body']);
|
||||
}
|
||||
|
||||
Logger::info('Item has been marked for deletion.', ['id' => $item_id]);
|
||||
|
||||
return true;
|
||||
|
@ -1427,16 +1431,15 @@ class Item
|
|||
Worker::add(['priority' => $priority, 'dont_fork' => true], 'Notifier', $notify_type, (int)$posted_item['uri-id'], (int)$posted_item['uid']);
|
||||
}
|
||||
|
||||
// Fill the cache with the rendered content.
|
||||
if (in_array($posted_item['gravity'], [self::GRAVITY_PARENT, self::GRAVITY_COMMENT]) && ($posted_item['uid'] == 0)) {
|
||||
self::updateDisplayCache($posted_item['uri-id']);
|
||||
}
|
||||
|
||||
if (in_array($posted_item['gravity'], [self::GRAVITY_ACTIVITY, self::GRAVITY_COMMENT]) && ($posted_item['uid'] == 0)) {
|
||||
Post\Counts::update($posted_item['thr-parent-id'], $posted_item['parent-uri-id'], $posted_item['vid'], $posted_item['verb'], $posted_item['body']);
|
||||
}
|
||||
|
||||
if ($inserted) {
|
||||
// Fill the cache with the rendered content.
|
||||
if (in_array($posted_item['gravity'], [self::GRAVITY_PARENT, self::GRAVITY_COMMENT])) {
|
||||
self::updateDisplayCache($posted_item['uri-id']);
|
||||
}
|
||||
|
||||
if (in_array($posted_item['gravity'], [self::GRAVITY_ACTIVITY, self::GRAVITY_COMMENT])) {
|
||||
Post\Counts::update($posted_item['thr-parent-id'], $posted_item['parent-uri-id'], $posted_item['vid'], $posted_item['verb'], $posted_item['body']);
|
||||
}
|
||||
Post\Engagement::storeFromItem($posted_item);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue