namespace Friendica\Module;
use Friendica\Core\Hook;
+use Friendica\Core\Protocol;
use Friendica\Core\System;
use Friendica\Database\DBA;
use Friendica\DI;
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.
$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);
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);
}
if (!empty($l)) {
- echo $o . implode(', ', $l);
+ System::httpExit($o . implode(', ', $l));
} else {
- echo $o . $receivers;
+ System::httpExit($o . $receivers);;
}
- System::exit();
}
/**