minor optimisation

This commit is contained in:
Mike Macgirvin 2023-04-15 16:54:15 +10:00
parent 5fc2dd2bca
commit c22bc2075f
2 changed files with 5 additions and 4 deletions

View file

@ -3684,7 +3684,7 @@ class Activity
$allowed = false;
$reason = ['init'];
$isMail = (bool) (intval($item['item_private']) === 2);
if ($is_child_node) {
$parent_item = q(
"select * from item where mid = '%s' and uid = %d",
@ -3779,7 +3779,7 @@ class Activity
}
}
else {
if (perm_is_allowed($channel['channel_id'], $observer_hash, 'send_stream') || ($is_system && $pubstream)) {
if ((!$isMail) && (perm_is_allowed($channel['channel_id'], $observer_hash, 'send_stream') || ($is_system && $pubstream))) {
logger('allowed: permission allowed', LOGGER_DATA);
$allowed = true;
}
@ -3801,7 +3801,7 @@ class Activity
}
}
if (intval($item['item_private']) === 2) {
if ($isMail) {
if (!perm_is_allowed($channel['channel_id'], $observer_hash, 'post_mail')) {
$allowed = false;
}

View file

@ -1771,6 +1771,7 @@ class Libzot
}
$friendofriend = false;
$isMail = (bool) (intval($arr['item_private']) === 2);
if ((!$tag_delivery) && (!$local_public)) {
$allowed = (perm_is_allowed($channel['channel_id'], $sender, $perm));
@ -1833,7 +1834,7 @@ class Libzot
$friendofriend = true;
}
if (intval($arr['item_private']) === 2) {
if ($isMail) {
if (!perm_is_allowed($channel['channel_id'], $sender, 'post_mail')) {
$allowed = false;
}