Fix reply via API / fix missing variable

This commit is contained in:
Michael 2023-01-25 10:16:24 +00:00
parent c27fdc7167
commit b46f18bdf9
2 changed files with 14 additions and 11 deletions

View File

@ -950,18 +950,19 @@ class Item
public function initializePost(array $post): array public function initializePost(array $post): array
{ {
$post['network'] = Protocol::DFRN; $post['network'] = Protocol::DFRN;
$post['protocol'] = Conversation::PARCEL_DIRECT; $post['protocol'] = Conversation::PARCEL_DIRECT;
$post['direction'] = Conversation::PUSH; $post['direction'] = Conversation::PUSH;
$post['received'] = DateTimeFormat::utcNow(); $post['received'] = DateTimeFormat::utcNow();
$post['origin'] = true; $post['origin'] = true;
$post['wall'] = $post['wall'] ?? true; $post['wall'] = $post['wall'] ?? true;
$post['guid'] = $post['guid'] ?? System::createUUID(); $post['guid'] = $post['guid'] ?? System::createUUID();
$post['verb'] = $post['verb'] ?? Activity::POST; $post['verb'] = $post['verb'] ?? Activity::POST;
$post['uri'] = $post['uri'] ?? ItemModel::newURI($post['guid']);
$post['thr-parent'] = $post['thr-parent'] ?? $post['uri'];
if (empty($post['uri'])) { if (empty($post['gravity'])) {
$post['thr-parent'] = $post['uri'] = ItemModel::newURI($post['guid']); $post['gravity'] = ($post['uri'] == $post['thr-parent']) ? ItemModel::GRAVITY_PARENT : ItemModel::GRAVITY_COMMENT;
$post['gravity'] = ItemModel::GRAVITY_PARENT;
} }
$owner = User::getOwnerDataById($post['uid']); $owner = User::getOwnerDataById($post['uid']);

View File

@ -210,6 +210,8 @@ class Status extends BaseFactory
// We can always safely add attached activities. Real quotes are added to the body via "addSharedPost". // We can always safely add attached activities. Real quotes are added to the body via "addSharedPost".
if (empty($item['quote-uri-id'])) { if (empty($item['quote-uri-id'])) {
$quote = self::createQuote($item, $uid); $quote = self::createQuote($item, $uid);
} else {
$quote = [];
} }
$shared = $this->contentItem->getSharedPost($item, ['uri-id']); $shared = $this->contentItem->getSharedPost($item, ['uri-id']);