mirror of
https://github.com/friendica/friendica
synced 2025-02-22 23:18:13 +00:00
Rename ItemInserter into ItemHelper
This commit is contained in:
parent
764a701610
commit
7a2e1e0511
2 changed files with 8 additions and 8 deletions
|
@ -760,7 +760,7 @@ class Item
|
||||||
*/
|
*/
|
||||||
public static function insert(array $item, int $notify = 0, bool $post_local = true): int
|
public static function insert(array $item, int $notify = 0, bool $post_local = true): int
|
||||||
{
|
{
|
||||||
$itemInserter = new ItemInserter(
|
$itemHelper = new ItemHelper(
|
||||||
DI::contentItem(),
|
DI::contentItem(),
|
||||||
DI::activity(),
|
DI::activity(),
|
||||||
DI::logger(),
|
DI::logger(),
|
||||||
|
@ -776,7 +776,7 @@ class Item
|
||||||
|
|
||||||
// If it is a posting where users should get notifications, then define it as wall posting
|
// If it is a posting where users should get notifications, then define it as wall posting
|
||||||
if ($notify) {
|
if ($notify) {
|
||||||
$item = $itemInserter->prepareOriginPost($item);
|
$item = $itemHelper->prepareOriginPost($item);
|
||||||
|
|
||||||
if (is_int($notify) && in_array($notify, Worker::PRIORITIES)) {
|
if (is_int($notify) && in_array($notify, Worker::PRIORITIES)) {
|
||||||
$priority = $notify;
|
$priority = $notify;
|
||||||
|
@ -789,7 +789,7 @@ class Item
|
||||||
$item['network'] = trim(($item['network'] ?? '') ?: Protocol::PHANTOM);
|
$item['network'] = trim(($item['network'] ?? '') ?: Protocol::PHANTOM);
|
||||||
}
|
}
|
||||||
|
|
||||||
$item = $itemInserter->prepareItemData($item, (bool) $notify);
|
$item = $itemHelper->prepareItemData($item, (bool) $notify);
|
||||||
|
|
||||||
// Store conversation data
|
// Store conversation data
|
||||||
$source = $item['source'] ?? '';
|
$source = $item['source'] ?? '';
|
||||||
|
@ -830,7 +830,7 @@ class Item
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$item = $itemInserter->validateItemData($item);
|
$item = $itemHelper->validateItemData($item);
|
||||||
|
|
||||||
// Ensure that there is an avatar cache
|
// Ensure that there is an avatar cache
|
||||||
Contact::checkAvatarCache($item['author-id']);
|
Contact::checkAvatarCache($item['author-id']);
|
||||||
|
@ -851,13 +851,13 @@ class Item
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($item['gravity'] !== self::GRAVITY_PARENT) {
|
if ($item['gravity'] !== self::GRAVITY_PARENT) {
|
||||||
$toplevel_parent = $itemInserter->getTopLevelParent($item);
|
$toplevel_parent = $itemHelper->getTopLevelParent($item);
|
||||||
if (empty($toplevel_parent)) {
|
if (empty($toplevel_parent)) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
$parent_id = (int) $toplevel_parent['id'];
|
$parent_id = (int) $toplevel_parent['id'];
|
||||||
$item = $itemInserter->handleToplevelParent($item, $toplevel_parent, $defined_permissions);
|
$item = $itemHelper->handleToplevelParent($item, $toplevel_parent, $defined_permissions);
|
||||||
$parent_origin = $toplevel_parent['origin'];
|
$parent_origin = $toplevel_parent['origin'];
|
||||||
} else {
|
} else {
|
||||||
$parent_id = 0;
|
$parent_id = 0;
|
||||||
|
|
|
@ -16,13 +16,13 @@ use Friendica\Util\DateTimeFormat;
|
||||||
use Psr\Log\LoggerInterface;
|
use Psr\Log\LoggerInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A helper class for inserting an Item Model
|
* A helper class for handling an Item Model
|
||||||
*
|
*
|
||||||
* @internal only for use in Friendica\Content\Item class
|
* @internal only for use in Friendica\Content\Item class
|
||||||
*
|
*
|
||||||
* @see Item::insert()
|
* @see Item::insert()
|
||||||
*/
|
*/
|
||||||
final class ItemInserter
|
final class ItemHelper
|
||||||
{
|
{
|
||||||
private ItemContent $itemContent;
|
private ItemContent $itemContent;
|
||||||
|
|
Loading…
Add table
Reference in a new issue