]> git.mxchange.org Git - friendica.git/commitdiff
Issue 6675: Improved check for follower, removed global setting
authorMichael <heluecht@pirati.ca>
Sun, 21 Jul 2019 05:56:57 +0000 (05:56 +0000)
committerMichael <heluecht@pirati.ca>
Sun, 21 Jul 2019 05:56:57 +0000 (05:56 +0000)
src/Module/Admin/Site.php
src/Protocol/OStatus.php
view/templates/admin/site.tpl
view/theme/frio/templates/admin/site.tpl

index 8e36d865056e6539a30999a7a8930a234b5e8ef7..c899729f8e7a7b684d5978d3cbd757e965914dd5 100644 (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.'),
index 127773f3c6ce1a15dd7ee61a76f191544c0dbf6d..b3685a147522e586e0e01df7218ff60452d55319 100644 (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;
                                                        }
                                                }
index 823753768eba3291c96ae961dc004259ba644175..19774b42553cd07ab800e1dfe0b19369d15999c6 100644 (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}}
index 4c0a6ce06667a241cd9add9be8ac16547975e4d7..410f9443f73d633d3acbe6b45a894617083452b1 100644 (file)
                                        {{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}}