mirror of
https://codeberg.org/streams/streams.git
synced 2024-09-19 01:55:13 +00:00
dm issue
This commit is contained in:
parent
81db331045
commit
8def2331c9
5 changed files with 25 additions and 23 deletions
|
@ -122,10 +122,6 @@ function collect_recipients($item, &$private_envelope) {
|
|||
|
||||
}
|
||||
|
||||
// This is a somewhat expensive operation but important.
|
||||
// Don't send this item to anybody who doesn't have the deliver_stream permission
|
||||
|
||||
$recipients = check_deliver_permissions($item,$recipients);
|
||||
|
||||
// Add both the author and owner (if different).
|
||||
|
||||
|
|
|
@ -518,10 +518,8 @@ function check_list_permissions($uid, $arr, $perm)
|
|||
|
||||
function check_deliver_permissions($item, $arr, $includeMentions = false)
|
||||
{
|
||||
xdebug_break();
|
||||
$result = [];
|
||||
$uid = $item['uid'] ?? 0;
|
||||
$terms = ((isset($item['term'])) ? get_terms_oftype($item['term'], [TERM_MENTION, TERM_GROUP]) : false);
|
||||
// Find actors we are not delivering to.
|
||||
$r = q("select * from abconfig where chan = %d and cat = 'system' and k = 'my_perms' and v not like '%%deliver_stream%%'",
|
||||
intval($uid)
|
||||
|
@ -566,16 +564,24 @@ function check_deliver_permissions($item, $arr, $includeMentions = false)
|
|||
}
|
||||
}
|
||||
// Send mentions even if you have no permission to do so. They might allow it.
|
||||
if ($terms && $includeMentions) {
|
||||
foreach ($terms as $term) {
|
||||
$r = q("select * from hubloc where (hubloc_hash = '%s' or hubloc_id_url = '%s') and hubloc_deleted = 0",
|
||||
dbesc($term['url']),
|
||||
dbesc($term['url'])
|
||||
);
|
||||
$r = Libzot::zot_record_preferred($r);
|
||||
if ($r && !in_array($r['hubloc_hash'], $result)) {
|
||||
$result[] = $r['hubloc_hash'];
|
||||
break;
|
||||
if ($includeMentions) {
|
||||
$terms = ((isset($item['term'])) ? get_terms_oftype($item['term'], [TERM_MENTION, TERM_GROUP]) : false);
|
||||
if ($terms === false) {
|
||||
$items = fetch_post_tags(['item']);
|
||||
$item = array_shift($items);
|
||||
$terms = ((isset($item['term'])) ? get_terms_oftype($item['term'], [TERM_MENTION, TERM_GROUP]) : false);
|
||||
}
|
||||
if ($terms) {
|
||||
foreach ($terms as $term) {
|
||||
$r = q("select * from hubloc where (hubloc_hash = '%s' or hubloc_id_url = '%s') and hubloc_deleted = 0",
|
||||
dbesc($term['url']),
|
||||
dbesc($term['url'])
|
||||
);
|
||||
$r = Libzot::zot_record_preferred($r);
|
||||
if ($r && !in_array($r['hubloc_hash'], $result)) {
|
||||
$result[] = $r['hubloc_hash'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -529,6 +529,7 @@ class Notifier implements DaemonInterface
|
|||
else {
|
||||
self::$private = false;
|
||||
self::$recipients = collect_recipients($parent_item, self::$private);
|
||||
self::$recipients = check_deliver_permissions($parent_item, self::$recipients, true);
|
||||
}
|
||||
|
||||
if ($top_level_post && intval($target_item['item_wall'])) {
|
||||
|
|
|
@ -5210,7 +5210,8 @@ class Activity
|
|||
->setDenyGid($sourceItem['deny_gid'])
|
||||
->setPrivate($sourceItem['item_private'])
|
||||
->setNocomment($sourceItem['item_nocomment'])
|
||||
->setCommentPolicy($sourceItem['comment_policy']);
|
||||
->setCommentPolicy($sourceItem['comment_policy'])
|
||||
->setPostopts($sourceItem['postopts']);
|
||||
}
|
||||
$result = post_activity_item($item->toArray(), deliver: $deliver, channel: $channel, observer: $channel, addAndSync: false);
|
||||
logger('addToCollection: ' . print_r($result, true));
|
||||
|
|
|
@ -1815,8 +1815,7 @@ class Libzot
|
|||
$isMail = (bool) (intval($arr['item_private']) === 2);
|
||||
|
||||
if ((!$tag_delivery) && (!$local_public)) {
|
||||
$allowed = (perm_is_allowed($channel['channel_id'], $sender, $perm));
|
||||
|
||||
$allowed = (perm_is_allowed($channel['channel_id'], $sender, $perm))
|
||||
$blocked = LibBlock::fetch($channel['channel_id'], BLOCKTYPE_SERVER);
|
||||
if ($blocked) {
|
||||
$h = q(
|
||||
|
@ -1854,6 +1853,7 @@ class Libzot
|
|||
$allowed = true;
|
||||
}
|
||||
}
|
||||
|
||||
if ($request) {
|
||||
// Conversation fetches (e.g. $request == true) take place for
|
||||
// a) new comments on expired posts
|
||||
|
@ -1876,10 +1876,8 @@ class Libzot
|
|||
}
|
||||
}
|
||||
|
||||
if ($isMail) {
|
||||
if (!perm_is_allowed($channel['channel_id'], $sender, 'post_mail')) {
|
||||
$allowed = false;
|
||||
}
|
||||
if ($isMail && !$allowed) {
|
||||
$allowed = perm_is_allowed($channel['channel_id'], $sender, 'post_mail');
|
||||
}
|
||||
|
||||
if (get_abconfig($channel['channel_id'], $sender, 'system', 'block_announce', false)) {
|
||||
|
|
Loading…
Reference in a new issue