Add option to enable CWs on own posts

This commit is contained in:
~keith 2022-08-13 00:37:48 +00:00
parent f826ce70ce
commit b8088d9686
Signed by: keith
GPG Key ID: 5BEBEEAB2C73D520
5 changed files with 68 additions and 51 deletions

View File

@ -71,6 +71,7 @@ function settings_post(App $a)
if (!empty($_POST['general-submit'])) {
DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'system', 'accept_only_sharer', intval($_POST['accept_only_sharer']));
DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'system', 'disable_cw', !intval($_POST['enable_cw']));
DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'system', 'enable_cw_self', intval($_POST['enable_cw_self']));
DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'system', 'no_intelligent_shortening', !intval($_POST['enable_smart_shortening']));
DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'system', 'simple_shortening', intval($_POST['simple_shortening']));
DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'system', 'attach_link_title', intval($_POST['attach_link_title']));
@ -242,6 +243,7 @@ function settings_content(App $a)
if ((DI::args()->getArgc() > 1) && (DI::args()->getArgv()[1] === 'connectors')) {
$accept_only_sharer = intval(DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'system', 'accept_only_sharer'));
$enable_cw = !intval(DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'system', 'disable_cw'));
$enable_cw_self = intval(DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'system', 'enable_cw_self'));
$enable_smart_shortening = !intval(DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'system', 'no_intelligent_shortening'));
$simple_shortening = intval(DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'system', 'simple_shortening'));
$attach_link_title = intval(DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'system', 'attach_link_title'));
@ -326,6 +328,7 @@ function settings_content(App $a)
]
],
'$enable_cw' => ['enable_cw', DI::l10n()->t('Enable Content Warning'), $enable_cw, DI::l10n()->t('Users on networks like Mastodon or Pleroma are able to set a content warning field which collapse their post by default. This enables the automatic collapsing instead of setting the content warning as the post title. Doesn\'t affect any other content filtering you eventually set up.')],
'$enable_cw_self' => ['enable_cw_self', DI::l10n()->t('Show content warnings on own posts'), $enable_cw_self, DI::l10n()->t('Normally Friendica only displays content warnings on posts created by other users. If this option is enabled it will also display content warnings on your own posts.')],
'$enable_smart_shortening' => ['enable_smart_shortening', DI::l10n()->t('Enable intelligent shortening'), $enable_smart_shortening, DI::l10n()->t('Normally the system tries to find the best link to add to shortened posts. If disabled, every shortened post will always point to the original friendica post.')],
'$simple_shortening' => ['simple_shortening', DI::l10n()->t('Enable simple text shortening'), $simple_shortening, DI::l10n()->t('Normally the system shortens posts at the next line feed. If this option is enabled then the system will shorten the text at the maximum character limit.')],
'$attach_link_title' => ['attach_link_title', DI::l10n()->t('Attach the link title'), $attach_link_title, DI::l10n()->t('When activated, the title of the attached link will be added as a title on posts to Diaspora. This is mostly helpful with "remote-self" contacts that share feed content.')],

View File

@ -3020,7 +3020,7 @@ class Item
// Compile eventual content filter reasons
$filter_reasons = [];
if (!$is_preview && DI::userSession()->getPublicContactId() != $item['author-id']) {
if (!$is_preview && (DI::userSession()->getPublicContactId() != $item['author-id'] || DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'system', 'enable_cw_self', false))) {
if (!empty($item['content-warning']) && (!DI::userSession()->getLocalUserId() || !DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'system', 'disable_cw', false))) {
$filter_reasons[] = DI::l10n()->t('Content warning: %s', $item['content-warning']);
}

View File

@ -1174,15 +1174,15 @@ msgid_plural "Errors"
msgstr[0] ""
msgstr[1] ""
#: mod/settings.php:122
#: mod/settings.php:123
msgid "Failed to connect with email account using the settings provided."
msgstr ""
#: mod/settings.php:175
#: mod/settings.php:176
msgid "Connected Apps"
msgstr ""
#: mod/settings.php:176 src/Module/Admin/Blocklist/Contact.php:106
#: mod/settings.php:177 src/Module/Admin/Blocklist/Contact.php:106
#: src/Module/Admin/Users/Active.php:129 src/Module/Admin/Users/Blocked.php:130
#: src/Module/Admin/Users/Create.php:71 src/Module/Admin/Users/Deleted.php:88
#: src/Module/Admin/Users/Index.php:142 src/Module/Admin/Users/Index.php:162
@ -1190,20 +1190,20 @@ msgstr ""
msgid "Name"
msgstr ""
#: mod/settings.php:177 src/Content/Nav.php:214
#: mod/settings.php:178 src/Content/Nav.php:214
msgid "Home Page"
msgstr ""
#: mod/settings.php:178 src/Module/Admin/Queue.php:78
#: mod/settings.php:179 src/Module/Admin/Queue.php:78
msgid "Created"
msgstr ""
#: mod/settings.php:179
#: mod/settings.php:180
msgid "Remove authorization"
msgstr ""
#: mod/settings.php:205 mod/settings.php:237 mod/settings.php:268
#: mod/settings.php:352 src/Module/Admin/Addons/Index.php:69
#: mod/settings.php:206 mod/settings.php:238 mod/settings.php:270
#: mod/settings.php:355 src/Module/Admin/Addons/Index.php:69
#: src/Module/Admin/Features.php:87 src/Module/Admin/Logs/Settings.php:81
#: src/Module/Admin/Site.php:432 src/Module/Admin/Themes/Index.php:113
#: src/Module/Admin/Tos.php:83 src/Module/Settings/Account.php:563
@ -1211,83 +1211,83 @@ msgstr ""
msgid "Save Settings"
msgstr ""
#: mod/settings.php:213
#: mod/settings.php:214
msgid "Addon Settings"
msgstr ""
#: mod/settings.php:214
#: mod/settings.php:215
msgid "No Addon settings configured"
msgstr ""
#: mod/settings.php:235
#: mod/settings.php:236
msgid "Additional Features"
msgstr ""
#: mod/settings.php:273
#: mod/settings.php:275
msgid "Diaspora (Socialhome, Hubzilla)"
msgstr ""
#: mod/settings.php:273 mod/settings.php:274
#: mod/settings.php:275 mod/settings.php:276
msgid "enabled"
msgstr ""
#: mod/settings.php:273 mod/settings.php:274
#: mod/settings.php:275 mod/settings.php:276
msgid "disabled"
msgstr ""
#: mod/settings.php:273 mod/settings.php:274
#: mod/settings.php:275 mod/settings.php:276
#, php-format
msgid "Built-in support for %s connectivity is %s"
msgstr ""
#: mod/settings.php:274
#: mod/settings.php:276
msgid "OStatus (GNU Social)"
msgstr ""
#: mod/settings.php:300
#: mod/settings.php:302
msgid "Email access is disabled on this site."
msgstr ""
#: mod/settings.php:305 mod/settings.php:350
#: mod/settings.php:307 mod/settings.php:353
msgid "None"
msgstr ""
#: mod/settings.php:311 src/Module/BaseSettings.php:78
#: mod/settings.php:313 src/Module/BaseSettings.php:78
msgid "Social Networks"
msgstr ""
#: mod/settings.php:316
#: mod/settings.php:318
msgid "General Social Media Settings"
msgstr ""
#: mod/settings.php:319
#: mod/settings.php:321
msgid "Followed content scope"
msgstr ""
#: mod/settings.php:321
#: mod/settings.php:323
msgid ""
"By default, conversations in which your follows participated but didn't "
"start will be shown in your timeline. You can turn this behavior off, or "
"expand it to the conversations in which your follows liked a post."
msgstr ""
#: mod/settings.php:323
#: mod/settings.php:325
msgid "Only conversations my follows started"
msgstr ""
#: mod/settings.php:324
#: mod/settings.php:326
msgid "Conversations my follows started or commented on (default)"
msgstr ""
#: mod/settings.php:325
#: mod/settings.php:327
msgid "Any conversation my follows interacted with, including likes"
msgstr ""
#: mod/settings.php:328
#: mod/settings.php:330
msgid "Enable Content Warning"
msgstr ""
#: mod/settings.php:328
#: mod/settings.php:330
msgid ""
"Users on networks like Mastodon or Pleroma are able to set a content warning "
"field which collapse their post by default. This enables the automatic "
@ -1295,108 +1295,119 @@ msgid ""
"affect any other content filtering you eventually set up."
msgstr ""
#: mod/settings.php:329
#: mod/settings.php:331
msgid "Show content warnings on own posts"
msgstr ""
#: mod/settings.php:331
msgid ""
"Normally Friendica only displays content warnings on posts created by other "
"users. If this option is enabled it will also display content warnings on "
"your own posts."
msgstr ""
#: mod/settings.php:332
msgid "Enable intelligent shortening"
msgstr ""
#: mod/settings.php:329
#: mod/settings.php:332
msgid ""
"Normally the system tries to find the best link to add to shortened posts. "
"If disabled, every shortened post will always point to the original "
"friendica post."
msgstr ""
#: mod/settings.php:330
#: mod/settings.php:333
msgid "Enable simple text shortening"
msgstr ""
#: mod/settings.php:330
#: mod/settings.php:333
msgid ""
"Normally the system shortens posts at the next line feed. If this option is "
"enabled then the system will shorten the text at the maximum character limit."
msgstr ""
#: mod/settings.php:331
#: mod/settings.php:334
msgid "Attach the link title"
msgstr ""
#: mod/settings.php:331
#: mod/settings.php:334
msgid ""
"When activated, the title of the attached link will be added as a title on "
"posts to Diaspora. This is mostly helpful with \"remote-self\" contacts that "
"share feed content."
msgstr ""
#: mod/settings.php:332
#: mod/settings.php:335
msgid "Your legacy ActivityPub/GNU Social account"
msgstr ""
#: mod/settings.php:332
#: mod/settings.php:335
msgid ""
"If you enter your old account name from an ActivityPub based system or your "
"GNU Social/Statusnet account name here (in the format user@domain.tld), your "
"contacts will be added automatically. The field will be emptied when done."
msgstr ""
#: mod/settings.php:335
#: mod/settings.php:338
msgid "Repair OStatus subscriptions"
msgstr ""
#: mod/settings.php:339
#: mod/settings.php:342
msgid "Email/Mailbox Setup"
msgstr ""
#: mod/settings.php:340
#: mod/settings.php:343
msgid ""
"If you wish to communicate with email contacts using this service "
"(optional), please specify how to connect to your mailbox."
msgstr ""
#: mod/settings.php:341
#: mod/settings.php:344
msgid "Last successful email check:"
msgstr ""
#: mod/settings.php:343
#: mod/settings.php:346
msgid "IMAP server name:"
msgstr ""
#: mod/settings.php:344
#: mod/settings.php:347
msgid "IMAP port:"
msgstr ""
#: mod/settings.php:345
#: mod/settings.php:348
msgid "Security:"
msgstr ""
#: mod/settings.php:346
#: mod/settings.php:349
msgid "Email login name:"
msgstr ""
#: mod/settings.php:347
#: mod/settings.php:350
msgid "Email password:"
msgstr ""
#: mod/settings.php:348
#: mod/settings.php:351
msgid "Reply-to address:"
msgstr ""
#: mod/settings.php:349
#: mod/settings.php:352
msgid "Send public posts to all email contacts:"
msgstr ""
#: mod/settings.php:350
#: mod/settings.php:353
msgid "Action after import:"
msgstr ""
#: mod/settings.php:350 src/Content/Nav.php:282
#: mod/settings.php:353 src/Content/Nav.php:282
msgid "Mark as seen"
msgstr ""
#: mod/settings.php:350
#: mod/settings.php:353
msgid "Move to folder"
msgstr ""
#: mod/settings.php:351
#: mod/settings.php:354
msgid "Move to folder:"
msgstr ""

View File

@ -13,6 +13,7 @@
{{include file="field_select.tpl" field=$accept_only_sharer}}
{{include file="field_checkbox.tpl" field=$enable_cw}}
{{include file="field_checkbox.tpl" field=$enable_cw_self}}
{{include file="field_checkbox.tpl" field=$enable_smart_shortening}}
{{include file="field_checkbox.tpl" field=$simple_shortening}}
{{include file="field_checkbox.tpl" field=$attach_link_title}}

View File

@ -22,6 +22,8 @@
{{include file="field_checkbox.tpl" field=$enable_cw}}
{{include file="field_checkbox.tpl" field=$enable_cw_self}}
{{include file="field_checkbox.tpl" field=$enable_smart_shortening}}
{{include file="field_checkbox.tpl" field=$simple_shortening}}