Issue 6675: Improved check for follower, removed global setting

This commit is contained in:
Michael 2019-07-21 05:56:57 +00:00
parent c6131c057b
commit a11206dbcd
4 changed files with 8 additions and 8 deletions

View file

@ -166,7 +166,6 @@ class Site extends BaseAdminModule
$nodeinfo = !empty($_POST['nodeinfo']);
$dfrn_only = !empty($_POST['dfrn_only']);
$ostatus_disabled = !empty($_POST['ostatus_disabled']);
$ostatus_full_threads = !empty($_POST['ostatus_full_threads']);
$diaspora_enabled = !empty($_POST['diaspora_enabled']);
$ssl_policy = (!empty($_POST['ssl_policy']) ? intval($_POST['ssl_policy']) : 0);
$force_ssl = !empty($_POST['force_ssl']);
@ -361,7 +360,6 @@ class Site extends BaseAdminModule
Config::set('system', 'curl_timeout' , $timeout);
Config::set('system', 'dfrn_only' , $dfrn_only);
Config::set('system', 'ostatus_disabled' , $ostatus_disabled);
Config::set('system', 'ostatus_full_threads' , $ostatus_full_threads);
Config::set('system', 'diaspora_enabled' , $diaspora_enabled);
Config::set('config', 'private_addons' , $private_addons);
@ -627,7 +625,6 @@ class Site extends BaseAdminModule
'$community_page_style' => ['community_page_style', L10n::t('Community pages for visitors'), Config::get('system', 'community_page_style'), L10n::t('Which community pages should be available for visitors. Local users always see both pages.'), $community_page_style_choices],
'$max_author_posts_community_page' => ['max_author_posts_community_page', L10n::t('Posts per user on community page'), Config::get('system', 'max_author_posts_community_page'), L10n::t('The maximum number of posts per user on the community page. (Not valid for "Global Community")')],
'$ostatus_disabled' => ['ostatus_disabled', L10n::t('Disable OStatus support'), Config::get('system', 'ostatus_disabled'), L10n::t('Disable built-in OStatus (StatusNet, GNU Social etc.) compatibility. All communications in OStatus are public, so privacy warnings will be occasionally displayed.')],
'$ostatus_full_threads' => ['ostatus_full_threads', L10n::t('Only import OStatus threads from our contacts'), Config::get('system', 'ostatus_full_threads'), L10n::t('Normally we import every content from our OStatus contacts. With this option we only store threads that are started by a contact that is known on our system.')],
'$ostatus_not_able' => L10n::t('OStatus support can only be enabled if threading is enabled.'),
'$diaspora_able' => $diaspora_able,
'$diaspora_not_able' => L10n::t('Diaspora support can\'t be enabled because Friendica was installed into a sub directory.'),

View file

@ -10,6 +10,7 @@ use Friendica\Content\Text\BBCode;
use Friendica\Content\Text\HTML;
use Friendica\Core\Cache;
use Friendica\Core\Config;
use Friendica\Core\PConfig;
use Friendica\Core\L10n;
use Friendica\Core\Logger;
use Friendica\Core\Lock;
@ -19,6 +20,7 @@ use Friendica\Database\DBA;
use Friendica\Model\Contact;
use Friendica\Model\Conversation;
use Friendica\Model\GContact;
use Friendica\Model\APContact;
use Friendica\Model\Item;
use Friendica\Model\User;
use Friendica\Network\Probe;
@ -113,6 +115,8 @@ class OStatus
if (DBA::isResult($contact)) {
if ($contact['blocked']) {
$contact['id'] = -1;
} elseif (!empty(APContact::getByURL($contact['url'], false))) {
ActivityPub\Receiver::switchContact($contact['id'], $importer['uid'], $contact['url']);
}
$author["contact-id"] = $contact["id"];
}
@ -486,10 +490,11 @@ class OStatus
if ($initialize && (count(self::$itemlist) > 0)) {
if (self::$itemlist[0]['uri'] == self::$itemlist[0]['parent-uri']) {
// We will import it everytime, when it is started by our contacts
$valid = !empty(self::$itemlist[0]['contact-id']);
$valid = Contact::isSharingByURL(self::$itemlist[0]['author-link'], self::$itemlist[0]['uid']);
if (!$valid) {
// If not, then it depends on this setting
$valid = !Config::get('system', 'ostatus_full_threads');
$valid = ((self::$itemlist[0]['uid'] == 0) || !PConfig::get(self::$itemlist[0]['uid'], 'system', 'accept_only_sharer', false));
if ($valid) {
Logger::log("Item with uri ".self::$itemlist[0]['uri']." will be imported due to the system settings.", Logger::DEBUG);
}
@ -501,7 +506,7 @@ class OStatus
$valid = false;
$verbs = [ACTIVITY_POST, ACTIVITY_SHARE];
foreach (self::$itemlist as $item) {
if (!empty($item['contact-id']) && in_array($item['verb'], $verbs)) {
if (in_array($item['verb'], $verbs) && Contact::isSharingByURL($item['author-link'], $item['uid'])) {
$valid = true;
}
}

View file

@ -59,7 +59,6 @@
{{include file="field_input.tpl" field=$max_author_posts_community_page}}
{{include file="field_checkbox.tpl" field=$ostatus_disabled}}
{{include file="field_checkbox.tpl" field=$ostatus_full_threads}}
{{if $diaspora_able}}
{{include file="field_checkbox.tpl" field=$diaspora_enabled}}

View file

@ -138,7 +138,6 @@
{{include file="field_input.tpl" field=$max_author_posts_community_page}}
{{include file="field_checkbox.tpl" field=$ostatus_disabled}}
{{include file="field_checkbox.tpl" field=$ostatus_full_threads}}
{{if $diaspora_able}}
{{include file="field_checkbox.tpl" field=$diaspora_enabled}}