Don't censor your own images. For one thing this makes your posts difficult to preview, but in any case we're assuming you are tolerant to your own content.

This commit is contained in:
Mike Macgirvin 2022-06-24 14:55:13 -07:00
parent 0c6ac2c721
commit ff936b55b3
2 changed files with 24 additions and 8 deletions

View file

@ -1980,10 +1980,11 @@ class Libzot
// This is used to fetch allow/deny rules if either the sender
// or owner is a connection. post_is_importable() evaluates all of them
$abook = q(
"select * from abook where abook_channel = %d and ( abook_xchan = '%s' OR abook_xchan = '%s' )",
"select * from abook where abook_channel = %d and ( abook_xchan = '%s' OR abook_xchan = '%s' OR abook_xchan = '%s')",
intval($channel['channel_id']),
dbesc($arr['owner_xchan']),
dbesc($arr['author_xchan'])
dbesc($arr['author_xchan']),
dbesc($sender)
);
if (isset($arr['item_deleted']) && intval($arr['item_deleted'])) {

View file

@ -1792,18 +1792,33 @@ function generate_named_map($location)
return (($arr['html']) ? $arr['html'] : $location);
}
function item_is_censored($item, $observer) {
// Don't censor your own posts.
if ($observer && $item['author_xchan'] === $observer) {
return false;
}
$censored = ((($item['author']['abook_censor']
|| $item['owner']['abook_censor']
|| $item['author']['xchan_selfcensored']
|| $item['owner']['xchan_selfcensored']
|| $item['author']['xchan_censored']
|| $item['owner']['xchan_censored']
|| intval($item['item_nsfw'])) && (get_safemode()))
? true
: false
);
return $censored;
}
function prepare_body(&$item, $attach = false, $opts = false)
{
Hook::call('prepare_body_init', $item);
$censored = ((($item['author']['abook_censor'] || $item['owner']['abook_censor'] || $item['author']['xchan_selfcensored'] || $item['owner']['xchan_selfcensored'] || $item['author']['xchan_censored'] || $item['owner']['xchan_censored'] || intval($item['item_nsfw'])) && (get_safemode()))
? true
: false
);
if ($censored) {
if (item_is_censored($item, get_observer_hash())) {
if (! $opts) {
$opts = [];
}