]> git.mxchange.org Git - friendica.git/commitdiff
Merge pull request #7389 from MrPetovan/bug/7387-local_user-int
authorPhilipp <admin+Github@philipp.info>
Tue, 16 Jul 2019 14:37:38 +0000 (16:37 +0200)
committerGitHub <noreply@github.com>
Tue, 16 Jul 2019 14:37:38 +0000 (16:37 +0200)
Ensure NULL isn't passed to Feature::isEnabled

src/Module/Login.php
src/Protocol/ActivityPub/Processor.php

index a8cb838517fa3f0ba635d2915bfbcb634ac6a6e0..966ded57faa3b94ffd6b086eb63f165914b7eb16 100644 (file)
@@ -281,7 +281,7 @@ class Login extends BaseModule
                $a = self::getApp();
                $o = '';
                $reg = false;
-               if ($register) {
+               if ($register && intval($a->getConfig()->get('config', 'register_policy')) !== Register::CLOSED) {
                        $reg = [
                                'title' => L10n::t('Create a New Account'),
                                'desc' => L10n::t('Register')
index 6ba0c8f8486179110fd7f2a02432aca50ef864d7..f2aae6af2d352547f0d9b58e5425bdc560fb7c1d 100644 (file)
@@ -373,6 +373,8 @@ class Processor
                $item['owner-link'] = $activity['actor'];
                $item['owner-id'] = Contact::getIdForURL($activity['actor'], 0, true);
 
+               $isForum = false;
+
                if (!empty($activity['thread-completion'])) {
                        // Store the original actor in the "causer" fields to enable the check for ignored or blocked contacts
                        $item['causer-link'] = $item['owner-link'];
@@ -381,6 +383,9 @@ class Processor
                        Logger::info('Ignoring actor because of thread completion.', ['actor' => $item['owner-link']]);
                        $item['owner-link'] = $item['author-link'];
                        $item['owner-id'] = $item['author-id'];
+               } else {
+                       $actor = APContact::getByURL($item['owner-link'], false);
+                       $isForum = ($actor['type'] == 'Group');
                }
 
                $item['uri'] = $activity['id'];
@@ -402,7 +407,14 @@ class Processor
 
                foreach ($activity['receiver'] as $receiver) {
                        $item['uid'] = $receiver;
-                       $item['contact-id'] = Contact::getIdForURL($activity['author'], $receiver, true);
+
+                       if ($isForum) {
+                               $item['contact-id'] = Contact::getIdForURL($activity['actor'], $receiver, true);
+                       }
+
+                       if (empty($item['contact-id'])) {
+                               $item['contact-id'] = Contact::getIdForURL($activity['author'], $receiver, true);
+                       }
 
                        if (($receiver != 0) && empty($item['contact-id'])) {
                                $item['contact-id'] = Contact::getIdForURL($activity['author'], 0, true);