Merge branch 'develop' into merge-2024.09-rc-branch

This commit is contained in:
Art4 2024-11-16 08:32:25 +00:00
commit eb04f3b079
25 changed files with 340 additions and 205 deletions

View file

@ -2709,8 +2709,6 @@ class Contact
*
* @param int $id
* @param array $contact
*
* @return boolean
*/
private static function hasLocalData(int $id, array $contact): bool
{
@ -2770,6 +2768,8 @@ class Contact
'network', 'alias', 'baseurl', 'gsid', 'forum', 'prv', 'contact-type', 'pubkey', 'last-item', 'xmpp', 'matrix',
'created', 'last-update'
];
/** @var array<string,mixed> */
$contact = DBA::selectFirst('contact', $fields, ['id' => $id]);
if (!DBA::isResult($contact)) {
return false;
@ -2795,22 +2795,22 @@ class Contact
$has_local_data = self::hasLocalData($id, $contact);
$uid = $contact['uid'];
$uid = $contact['uid'] ?? null;
unset($contact['uid']);
$uriid = $contact['uri-id'];
$uriid = $contact['uri-id'] ?? null;
unset($contact['uri-id']);
$pubkey = $contact['pubkey'];
$pubkey = $contact['pubkey'] ?? null;
unset($contact['pubkey']);
$created = $contact['created'];
$created = $contact['created'] ?? '';
unset($contact['created']);
$last_update = $contact['last-update'];
$last_update = $contact['last-update'] ?? '';
unset($contact['last-update']);
$contact['photo'] = $contact['avatar'];
$contact['photo'] = $contact['avatar'] ?? null;
unset($contact['avatar']);
$updated = DateTimeFormat::utcNow();

View file

@ -3199,10 +3199,10 @@ class Item
} elseif ($remote_user) {
// Authenticated visitor - fetch the matching permissionsets
$permissionSets = DI::permissionSet()->selectByContactId($remote_user, $owner_id);
if (!empty($set)) {
if (!empty($permissionSets)) {
$condition = [
"(`private` != ? OR (`private` = ? AND `wall`
AND `psid` IN (" . implode(', ', array_fill(0, count($set), '?')) . ")))",
AND `psid` IN (" . implode(', ', array_fill(0, count($permissionSets), '?')) . ")))",
self::PRIVATE, self::PRIVATE
];
$condition = array_merge($condition, $permissionSets->column('id'));
@ -3248,7 +3248,7 @@ class Item
*/
$permissionSets = DI::permissionSet()->selectByContactId($remote_user, $owner_id);
if (!empty($set)) {
if (!empty($permissionSets)) {
$sql_set = sprintf(" OR (" . $table . "`private` = %d AND " . $table . "`wall` AND " . $table . "`psid` IN (", self::PRIVATE) . implode(',', $permissionSets->column('id')) . "))";
} else {
$sql_set = '';