]> git.mxchange.org Git - friendica.git/blobdiff - src/Model/Item.php
Move follow revoke protocol to worker task
[friendica.git] / src / Model / Item.php
index 1d8d57ab8c9a2e3df26dbab9ae836daeb0545eb7..4a3b6ed580df7d732e4520ec0746b10bdd15c9ec 100644 (file)
@@ -1236,9 +1236,11 @@ class Item
                        return;
                }
 
-               $self = Contact::selectFirst(['id'], ['uid' => $item['uid'], 'self' => true]);
+               $self_contact = Contact::selectFirst(['id'], ['uid' => $item['uid'], 'self' => true]);
+               $self = !empty($self_contact) ? $self_contact['id'] : 0;
+               
                $cid = Contact::getIdForURL($author['url'], $item['uid']);
-               if (empty($cid) || (!Contact::isSharing($cid, $item['uid']) && ($cid != $self['id']))) {
+               if (empty($cid) || (!Contact::isSharing($cid, $item['uid']) && ($cid != $self))) {
                        Logger::info('The resharer is not a following contact: quit', ['resharer' => $author['url'], 'uid' => $item['uid'], 'cid' => $cid]);
                        return;
                }
@@ -1409,7 +1411,7 @@ class Item
                $is_reshare = ($item['gravity'] == GRAVITY_ACTIVITY) && ($item['verb'] == Activity::ANNOUNCE);
 
                if ((($item['gravity'] == GRAVITY_PARENT) || $is_reshare) &&
-                       DI::pConfig()->get($uid, 'system', 'accept_only_sharer') === self::COMPLETION_NONE &&
+                       DI::pConfig()->get($uid, 'system', 'accept_only_sharer') == self::COMPLETION_NONE &&
                        !Contact::isSharingByURL($item['author-link'], $uid) &&
                        !Contact::isSharingByURL($item['owner-link'], $uid)) {
                        Logger::info('Contact is not a follower, thread will not be stored', ['author' => $item['author-link'], 'uid' => $uid]);
@@ -1472,7 +1474,7 @@ class Item
                }
 
                // When the post belongs to a a forum then all forum users are allowed to access it
-               foreach (Tag::getByURIId($uriid, [Tag::EXCLUSIVE_MENTION]) as $tag) {
+               foreach (Tag::getByURIId($uriid, [Tag::MENTION, Tag::EXCLUSIVE_MENTION]) as $tag) {
                        if (DBA::exists('contact', ['uid' => $uid, 'nurl' => Strings::normaliseLink($tag['url']), 'contact-type' => Contact::TYPE_COMMUNITY])) {
                                $target_uid = User::getIdForURL($tag['url']);
                                if (!empty($target_uid)) {