From: Michael Date: Wed, 22 Mar 2023 21:43:03 +0000 (+0000) Subject: Don't show permissions from permissiongroups on comments X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=6a1f7c47b3d450a0df958f7be1429dd087bdf05a;p=friendica.git Don't show permissions from permissiongroups on comments --- diff --git a/src/Module/PermissionTooltip.php b/src/Module/PermissionTooltip.php index 4265ff4010..1f41584d65 100644 --- a/src/Module/PermissionTooltip.php +++ b/src/Module/PermissionTooltip.php @@ -22,6 +22,7 @@ namespace Friendica\Module; use Friendica\Core\Hook; +use Friendica\Core\Protocol; use Friendica\Core\System; use Friendica\Database\DBA; use Friendica\DI; @@ -32,7 +33,6 @@ use Friendica\Model\Post; use Friendica\Model\Tag; use Friendica\Model\User; use Friendica\Network\HTTPException; -use Friendica\Protocol\ActivityPub; /** * Outputs the permission tooltip HTML content for the provided item, photo or event id. @@ -51,8 +51,21 @@ class PermissionTooltip extends \Friendica\BaseModule $condition = ['id' => $referenceId, 'uid' => [0, DI::userSession()->getLocalUserId()]]; if ($type == 'item') { - $fields = ['uid', 'psid', 'private', 'uri-id']; - $model = Post::selectFirst($fields, $condition); + $fields = ['uid', 'psid', 'private', 'uri-id', 'origin', 'network']; + $model = Post::selectFirst($fields, $condition, ['order' => ['uid' => true]]); + + if ($model['origin'] || ($model['network'] != Protocol::ACTIVITYPUB)) { + $permissionSet = DI::permissionSet()->selectOneById($model['psid'], $model['uid']); + $model['allow_cid'] = $permissionSet->allow_cid; + $model['allow_gid'] = $permissionSet->allow_gid; + $model['deny_cid'] = $permissionSet->deny_cid; + $model['deny_gid'] = $permissionSet->deny_gid; + } else { + $model['allow_cid'] = []; + $model['allow_gid'] = []; + $model['deny_cid'] = []; + $model['deny_gid'] = []; + } } else { $fields = ['uid', 'allow_cid', 'allow_gid', 'deny_cid', 'deny_gid']; $model = DBA::selectFirst($type, $fields, $condition); @@ -66,14 +79,6 @@ class PermissionTooltip extends \Friendica\BaseModule throw new HttpException\NotFoundException(DI::l10n()->t('Model not found')); } - if (isset($model['psid'])) { - $permissionSet = DI::permissionSet()->selectOneById($model['psid'], $model['uid']); - $model['allow_cid'] = $permissionSet->allow_cid; - $model['allow_gid'] = $permissionSet->allow_gid; - $model['deny_cid'] = $permissionSet->deny_cid; - $model['deny_gid'] = $permissionSet->deny_gid; - } - // Kept for backwards compatiblity Hook::callAll('lockview_content', $model); @@ -161,11 +166,10 @@ class PermissionTooltip extends \Friendica\BaseModule } if (!empty($l)) { - echo $o . implode(', ', $l); + System::httpExit($o . implode(', ', $l)); } else { - echo $o . $receivers; + System::httpExit($o . $receivers);; } - System::exit(); } /**