Disable content filter for preview and own posts

This commit is contained in:
Hypolite Petovan 2018-04-01 15:06:07 -04:00
parent d603bf062d
commit f26c99d17b

View file

@ -1270,7 +1270,8 @@ function prepare_body(array &$item, $attach = false, $is_preview = false)
// Compile eventual content filter reasons // Compile eventual content filter reasons
$filter_reasons = []; $filter_reasons = [];
if (!empty($item['content-warning']) && !PConfig::get(local_user(), 'social', 'disable_cw')) { if (!$is_preview && !$item['self']) {
if (!empty($item['content-warning']) && (!local_user() || !PConfig::get(local_user(), 'social', 'disable_cw', false))) {
$filter_reasons[] = L10n::t('Content warning: %s', $item['content-warning']); $filter_reasons[] = L10n::t('Content warning: %s', $item['content-warning']);
} }
@ -1281,6 +1282,7 @@ function prepare_body(array &$item, $attach = false, $is_preview = false)
Addon::callHooks('content_filter', $hook_data); Addon::callHooks('content_filter', $hook_data);
$filter_reasons = $hook_data['filter_reasons']; $filter_reasons = $hook_data['filter_reasons'];
unset($hook_data); unset($hook_data);
}
// Update the cached values if there is no "zrl=..." on the links. // Update the cached values if there is no "zrl=..." on the links.
$update = (!local_user() && !remote_user() && ($item["uid"] == 0)); $update = (!local_user() && !remote_user() && ($item["uid"] == 0));
@ -1303,7 +1305,9 @@ function prepare_body(array &$item, $attach = false, $is_preview = false)
$s = $hook_data['html']; $s = $hook_data['html'];
unset($hook_data); unset($hook_data);
if (!$is_preview && !$item['self']) {
$s = apply_content_filter($s, $filter_reasons); $s = apply_content_filter($s, $filter_reasons);
}
if (! $attach) { if (! $attach) {
// Replace the blockquotes with quotes that are used in mails. // Replace the blockquotes with quotes that are used in mails.