Merge pull request #4933 from annando/bugfix-distribute

Bugfix: The Distribition of public items failed with comments
This commit is contained in:
Hypolite Petovan 2018-04-26 16:02:56 -04:00 committed by GitHub
commit 9e700ba6ea
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -863,11 +863,24 @@ class Item extends BaseObject
unset($item['id']);
$users = [];
$condition = ["`nurl` IN (SELECT `nurl` FROM `contact` WHERE `id` = ?) AND `uid` != 0 AND NOT `blocked` AND NOT `readonly` AND `rel` IN (?, ?)",
$parent['owner-id'], CONTACT_IS_SHARING, CONTACT_IS_FRIEND];
$contacts = dba::select('contact', ['uid'], $condition);
while ($contact = dba::fetch($contacts)) {
self::storeForUser($itemid, $item, $contact['uid']);
$users[$contact['uid']] = $contact['uid'];
}
if ($item['uri'] != $item['parent-uri']) {
$parents = dba::select('item', ['uid'], ["`uri` = ? AND `uid` != 0", $item['parent-uri']]);
while ($parent = dba::fetch($parents)) {
$users[$parent['uid']] = $parent['uid'];
}
}
foreach ($users as $uid) {
self::storeForUser($itemid, $item, $uid);
}
}