Add disabled_cw user setting

This commit is contained in:
Hypolite Petovan 2018-04-01 02:23:26 -04:00
parent 92332932c6
commit 180f7d8218
3 changed files with 5 additions and 1 deletions

View file

@ -19,7 +19,6 @@ use Friendica\Model\GContact;
use Friendica\Model\Group; use Friendica\Model\Group;
use Friendica\Model\User; use Friendica\Model\User;
use Friendica\Protocol\Email; use Friendica\Protocol\Email;
use Friendica\Util\DateTimeFormat;
use Friendica\Util\Network; use Friendica\Util\Network;
use Friendica\Util\Temporal; use Friendica\Util\Temporal;
@ -213,6 +212,7 @@ function settings_post(App $a)
check_form_security_token_redirectOnErr('/settings/connectors', 'settings_connectors'); check_form_security_token_redirectOnErr('/settings/connectors', 'settings_connectors');
if (x($_POST, 'general-submit')) { if (x($_POST, 'general-submit')) {
PConfig::set(local_user(), 'social', 'disable_cw', intval($_POST['disable_cw']));
PConfig::set(local_user(), 'system', 'no_intelligent_shortening', intval($_POST['no_intelligent_shortening'])); PConfig::set(local_user(), 'system', 'no_intelligent_shortening', intval($_POST['no_intelligent_shortening']));
PConfig::set(local_user(), 'system', 'ostatus_autofriend', intval($_POST['snautofollow'])); PConfig::set(local_user(), 'system', 'ostatus_autofriend', intval($_POST['snautofollow']));
PConfig::set(local_user(), 'ostatus', 'default_group', $_POST['group-selection']); PConfig::set(local_user(), 'ostatus', 'default_group', $_POST['group-selection']);
@ -787,6 +787,7 @@ function settings_content(App $a)
} }
if (($a->argc > 1) && ($a->argv[1] === 'connectors')) { if (($a->argc > 1) && ($a->argv[1] === 'connectors')) {
$disable_cw = intval(PConfig::get(local_user(), 'social', 'disable_cw'));
$no_intelligent_shortening = intval(PConfig::get(local_user(), 'system', 'no_intelligent_shortening')); $no_intelligent_shortening = intval(PConfig::get(local_user(), 'system', 'no_intelligent_shortening'));
$ostatus_autofriend = intval(PConfig::get(local_user(), 'system', 'ostatus_autofriend')); $ostatus_autofriend = intval(PConfig::get(local_user(), 'system', 'ostatus_autofriend'));
$default_group = PConfig::get(local_user(), 'ostatus', 'default_group'); $default_group = PConfig::get(local_user(), 'ostatus', 'default_group');
@ -844,6 +845,7 @@ function settings_content(App $a)
'$ostat_enabled' => $ostat_enabled, '$ostat_enabled' => $ostat_enabled,
'$general_settings' => L10n::t('General Social Media Settings'), '$general_settings' => L10n::t('General Social Media Settings'),
'$disable_cw' => ['disable_cw', L10n::t('Disable Content Warning'), $disable_cw, L10n::t('Users on networks like Mastodon or Pleroma are able to set a content warning field which collapse their post by default. You can disable this default behavior to always show post with an author-set content warning. Doesn\'t affect any other content filtering you eventually set up.')],
'$no_intelligent_shortening' => ['no_intelligent_shortening', L10n::t('Disable intelligent shortening'), $no_intelligent_shortening, L10n::t('Normally the system tries to find the best link to add to shortened posts. If this option is enabled then every shortened post will always point to the original friendica post.')], '$no_intelligent_shortening' => ['no_intelligent_shortening', L10n::t('Disable intelligent shortening'), $no_intelligent_shortening, L10n::t('Normally the system tries to find the best link to add to shortened posts. If this option is enabled then every shortened post will always point to the original friendica post.')],
'$ostatus_autofriend' => ['snautofollow', L10n::t("Automatically follow any GNU Social \x28OStatus\x29 followers/mentioners"), $ostatus_autofriend, L10n::t('If you receive a message from an unknown OStatus user, this option decides what to do. If it is checked, a new contact will be created for every unknown user.')], '$ostatus_autofriend' => ['snautofollow', L10n::t("Automatically follow any GNU Social \x28OStatus\x29 followers/mentioners"), $ostatus_autofriend, L10n::t('If you receive a message from an unknown OStatus user, this option decides what to do. If it is checked, a new contact will be created for every unknown user.')],
'$default_group' => Group::displayGroupSelection(local_user(), $default_group, L10n::t("Default group for OStatus contacts")), '$default_group' => Group::displayGroupSelection(local_user(), $default_group, L10n::t("Default group for OStatus contacts")),

View file

@ -15,6 +15,7 @@
<h3 class="connector">{{$general_settings}}</h3> <h3 class="connector">{{$general_settings}}</h3>
</span> </span>
{{include file="field_checkbox.tpl" field=$disable_cw}}
{{include file="field_checkbox.tpl" field=$no_intelligent_shortening}} {{include file="field_checkbox.tpl" field=$no_intelligent_shortening}}
{{include file="field_checkbox.tpl" field=$ostatus_autofriend}} {{include file="field_checkbox.tpl" field=$ostatus_autofriend}}
{{$default_group}} {{$default_group}}

View file

@ -20,6 +20,7 @@
<div id="content-settings-content" class="panel-collapse collapse" role="tabpanel" aria-labelledby="content-settings"> <div id="content-settings-content" class="panel-collapse collapse" role="tabpanel" aria-labelledby="content-settings">
<div class="section-content-wrapper"> <div class="section-content-wrapper">
{{include file="field_checkbox.tpl" field=$disable_cw}}
{{include file="field_checkbox.tpl" field=$no_intelligent_shortening}} {{include file="field_checkbox.tpl" field=$no_intelligent_shortening}}
{{include file="field_checkbox.tpl" field=$ostatus_autofriend}} {{include file="field_checkbox.tpl" field=$ostatus_autofriend}}
{{$default_group}} {{$default_group}}