Merge pull request #8913 from annando/notice

Fix notice "Undefined index: parent-uri"
This commit is contained in:
Hypolite Petovan 2020-07-21 16:14:44 -04:00 committed by GitHub
commit f6428cf2bc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 2 deletions

View file

@ -2001,6 +2001,7 @@ class Item
$uids = Tag::getUIDListByURIId($item['uri-id']); $uids = Tag::getUIDListByURIId($item['uri-id']);
foreach ($uids as $uid) { foreach ($uids as $uid) {
$original['uri-id'] = $item['uri-id']; $original['uri-id'] = $item['uri-id'];
$original['gravity'] = $item['gravity'];
$stored = self::storeForUser($original, $uid); $stored = self::storeForUser($original, $uid);
Logger::info('Stored item for users', ['uri-id' => $item['uri-id'], 'uid' => $uid, 'stored' => $stored]); Logger::info('Stored item for users', ['uri-id' => $item['uri-id'], 'uid' => $uid, 'stored' => $stored]);
} }
@ -2189,7 +2190,7 @@ class Item
$item['origin'] = 0; $item['origin'] = 0;
$item['wall'] = 0; $item['wall'] = 0;
if ($item['uri'] == $item['parent-uri']) { if ($item['gravity'] == GRAVITY_PARENT) {
$contact = Contact::getByURLForUser($item['owner-link'], $uid, false, ['id']); $contact = Contact::getByURLForUser($item['owner-link'], $uid, false, ['id']);
} else { } else {
$contact = Contact::getByURLForUser($item['author-link'], $uid, false, ['id']); $contact = Contact::getByURLForUser($item['author-link'], $uid, false, ['id']);
@ -2212,7 +2213,7 @@ class Item
/// @todo Handling of "event-id" /// @todo Handling of "event-id"
$notify = false; $notify = false;
if ($item['uri'] == $item['parent-uri']) { if ($item['gravity'] == GRAVITY_PARENT) {
$contact = DBA::selectFirst('contact', [], ['id' => $item['contact-id'], 'self' => false]); $contact = DBA::selectFirst('contact', [], ['id' => $item['contact-id'], 'self' => false]);
if (DBA::isResult($contact)) { if (DBA::isResult($contact)) {
$notify = self::isRemoteSelf($contact, $item); $notify = self::isRemoteSelf($contact, $item);

View file

@ -514,6 +514,10 @@ class Processor
*/ */
public static function postItem(array $activity, array $item) public static function postItem(array $activity, array $item)
{ {
if (empty($item)) {
return;
}
$stored = false; $stored = false;
foreach ($activity['receiver'] as $receiver) { foreach ($activity['receiver'] as $receiver) {