We only need the uid
This commit is contained in:
parent
5cf745af44
commit
5019d46071
|
@ -865,32 +865,32 @@ class Item extends BaseObject
|
||||||
|
|
||||||
$condition = ["`nurl` IN (SELECT `nurl` FROM `contact` WHERE `id` = ?) AND `uid` != 0 AND NOT `blocked` AND `rel` IN (?, ?)",
|
$condition = ["`nurl` IN (SELECT `nurl` FROM `contact` WHERE `id` = ?) AND `uid` != 0 AND NOT `blocked` AND `rel` IN (?, ?)",
|
||||||
$parent['owner-id'], CONTACT_IS_SHARING, CONTACT_IS_FRIEND];
|
$parent['owner-id'], CONTACT_IS_SHARING, CONTACT_IS_FRIEND];
|
||||||
$contacts = dba::select('contact', [], $condition);
|
$contacts = dba::select('contact', ['uid'], $condition);
|
||||||
while ($contact = dba::fetch($contacts)) {
|
while ($contact = dba::fetch($contacts)) {
|
||||||
self::storeForUser($itemid, $item, $contact);
|
self::storeForUser($itemid, $item, $contact['uid']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Store public items for the receivers
|
* @brief Store public items for the receivers
|
||||||
*
|
*
|
||||||
* @param integer $itemid Item ID that should be added
|
* @param integer $itemid Item ID that should be added
|
||||||
* @param array $item The item entry that will be stored
|
* @param array $item The item entry that will be stored
|
||||||
* @param array $contact The contact that will receive the item entry
|
* @param integer $uid The user that will receive the item entry
|
||||||
*/
|
*/
|
||||||
private static function storeForUser($itemid, $item, $contact)
|
private static function storeForUser($itemid, $item, $uid)
|
||||||
{
|
{
|
||||||
$item['uid'] = $contact['uid'];
|
$item['uid'] = $uid;
|
||||||
$item['origin'] = 0;
|
$item['origin'] = 0;
|
||||||
$item['wall'] = 0;
|
$item['wall'] = 0;
|
||||||
if ($item['uri'] == $item['parent-uri']) {
|
if ($item['uri'] == $item['parent-uri']) {
|
||||||
$item['contact-id'] = Contact::getIdForURL($item['owner-link'], $contact['uid']);
|
$item['contact-id'] = Contact::getIdForURL($item['owner-link'], $uid);
|
||||||
} else {
|
} else {
|
||||||
$item['contact-id'] = Contact::getIdForURL($item['author-link'], $contact['uid']);
|
$item['contact-id'] = Contact::getIdForURL($item['author-link'], $uid);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($item['contact-id'])) {
|
if (empty($item['contact-id'])) {
|
||||||
$self = dba::selectFirst('contact', ['id'], ['self' => true, 'uid' => $contact['uid']]);
|
$self = dba::selectFirst('contact', ['id'], ['self' => true, 'uid' => $uid]);
|
||||||
if (!DBM::is_result($self)) {
|
if (!DBM::is_result($self)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -908,9 +908,9 @@ class Item extends BaseObject
|
||||||
$distributed = self::insert($item, false, false, true);
|
$distributed = self::insert($item, false, false, true);
|
||||||
|
|
||||||
if (!$distributed) {
|
if (!$distributed) {
|
||||||
logger("Distributed public item " . $itemid . " for user " . $contact['uid'] . " wasn't stored", LOGGER_DEBUG);
|
logger("Distributed public item " . $itemid . " for user " . $uid . " wasn't stored", LOGGER_DEBUG);
|
||||||
} else {
|
} else {
|
||||||
logger("Distributed public item " . $itemid . " for user " . $contact['uid'] . " with id " . $distributed, LOGGER_DEBUG);
|
logger("Distributed public item " . $itemid . " for user " . $uid . " with id " . $distributed, LOGGER_DEBUG);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2773,7 +2773,7 @@ class DFRN
|
||||||
if ($posted_id) {
|
if ($posted_id) {
|
||||||
logger("Reply from contact ".$item["contact-id"]." was stored with id ".$posted_id, LOGGER_DEBUG);
|
logger("Reply from contact ".$item["contact-id"]." was stored with id ".$posted_id, LOGGER_DEBUG);
|
||||||
|
|
||||||
IF ($item['uid'] == 0) {
|
if ($item['uid'] == 0) {
|
||||||
Item::distribute($posted_id);
|
Item::distribute($posted_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue