groups should not inherit foreign categories.

This commit is contained in:
Mike Macgirvin 2023-06-11 16:41:07 +10:00
parent aeeadb6298
commit ee38b8b699
2 changed files with 18 additions and 0 deletions

View file

@ -2475,6 +2475,7 @@ function tag_deliver($uid, $item_id) {
// and this will be turned into an embedded wall-to-wall post
if(perm_is_allowed($uid, $item['author_xchan'], 'post_wall')) {
logger('group DM delivery for ' . $u['channel_address']);
$item = filter_categories($item);
start_delivery_chain($u, $item, $item_id, false, true, (($item['edited'] != $item['created']) || $item['item_deleted']));
q("update item set item_blocked = %d where id = %d",
intval(ITEM_HIDDEN),
@ -2504,6 +2505,7 @@ function tag_deliver($uid, $item_id) {
if ($id == z_root() . '/outbox/' . $u['channel_address']) {
if(perm_is_allowed($uid, $item['author_xchan'], 'post_wall')) {
logger('group collection delivery for ' . $u['channel_address']);
$item = filter_categories($item);
start_delivery_chain($u, $item, $item_id, false, true, (($item['edited'] != $item['created']) || $item['item_deleted']));
q("update item set item_blocked = %d where id = %d",
intval(ITEM_HIDDEN),
@ -2737,6 +2739,21 @@ function tag_deliver($uid, $item_id) {
}
function filter_categories($item)
{
$tags = [];
if ($item['term'] && is_array($item['term'])) {
foreach ($item['term'] as $tag) {
if ($tag['ttype'] === TERM_CATEGORY || $tag['ttype'] === TERM_PCATEGORY) {
continue;
}
$tags[] = $tag;
}
$item['term'] = $tags;
}
return $item;
}
/**
* @brief This function is called pre-deliver to see if a post matches the criteria to be tag delivered.

View file

@ -1,3 +1,4 @@
<!--suppress HtmlFormInputWithoutLabel -->
<input id="invisible-wall-file-upload" type="file" name="files" style="visibility:hidden;position:absolute;top:-50px;left:-50px;width:0;height:0;" multiple>
<input id="invisible-comment-upload" type="file" name="files" style="visibility:hidden;position:absolute;top:-50px;left:-50px;width:0;height:0;" multiple>
<form id="profile-jot-form" action="{{$action}}" method="post" class="acl-form" data-form_id="profile-jot-form" data-allow_cid='{{$allow_cid}}' data-allow_gid='{{$allow_gid}}' data-deny_cid='{{$deny_cid}}' data-deny_gid='{{$deny_gid}}'>