From 096dacf0fd1ad7282ec99934af6c55b3a1677c03 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Thu, 21 Oct 2021 18:49:22 -0400 Subject: [PATCH 1/2] Manually expand ACLs coming from non-permissionset tables - Return early if parameter is empty in ACLFormatter->expand - Address https://github.com/friendica/friendica/issues/10756#issuecomment-949049195 --- src/Module/PermissionTooltip.php | 6 +++++- src/Util/ACLFormatter.php | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Module/PermissionTooltip.php b/src/Module/PermissionTooltip.php index df82574e92..7599c2f060 100644 --- a/src/Module/PermissionTooltip.php +++ b/src/Module/PermissionTooltip.php @@ -5,8 +5,8 @@ namespace Friendica\Module; use Friendica\Core\Hook; use Friendica\Database\DBA; use Friendica\DI; -use Friendica\Model\Item; use Friendica\Model\Group; +use Friendica\Model\Item; use Friendica\Model\Post; use Friendica\Network\HTTPException; @@ -32,6 +32,10 @@ class PermissionTooltip extends \Friendica\BaseModule } else { $fields = ['uid', 'allow_cid', 'allow_gid', 'deny_cid', 'deny_gid']; $model = DBA::selectFirst($type, $fields, $condition); + $model['allow_cid'] = DI::aclFormatter()->expand($model['allow_cid']); + $model['allow_gid'] = DI::aclFormatter()->expand($model['allow_gid']); + $model['deny_cid'] = DI::aclFormatter()->expand($model['deny_cid']); + $model['deny_gid'] = DI::aclFormatter()->expand($model['deny_gid']); } if (!DBA::isResult($model)) { diff --git a/src/Util/ACLFormatter.php b/src/Util/ACLFormatter.php index 352c914bcf..03aded3854 100644 --- a/src/Util/ACLFormatter.php +++ b/src/Util/ACLFormatter.php @@ -38,7 +38,7 @@ final class ACLFormatter public function expand(string $acl_string = null) { // In case there is no ID list, return empty array (=> no ACL set) - if (!isset($acl_string)) { + if (empty($acl_string)) { return []; } From 82c2a30c5947ce5661bfa5ba40e1fcc23ec8ab39 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Thu, 21 Oct 2021 18:58:18 -0400 Subject: [PATCH 2/2] Fix wrong array access to Entity object - Address https://github.com/friendica/friendica/issues/10756#issuecomment-949051839 --- src/Model/Contact.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Model/Contact.php b/src/Model/Contact.php index 0acb6d4d72..c6a91edc8b 100644 --- a/src/Model/Contact.php +++ b/src/Model/Contact.php @@ -1088,7 +1088,7 @@ class Contact if (!empty($contact['pending'])) { try { $intro = DI::intro()->selectForContact($contact['id']); - $menu['follow'] = [DI::l10n()->t('Approve'), 'notifications/intros/' . $intro['id'], true]; + $menu['follow'] = [DI::l10n()->t('Approve'), 'notifications/intros/' . $intro->id, true]; } catch (IntroductionNotFoundException $exception) { DI::logger()->error('Pending contact doesn\'t have an introduction.', ['exception' => $exception]); }