]> git.mxchange.org Git - friendica.git/blobdiff - src/Model/Item.php
Use public contact ID in Model\Post\UserNotification::insertNotification
[friendica.git] / src / Model / Item.php
index 8425d5dc3477dea7762734a643a965b976cb95ce..09abf959975cd0b1be641d8d0dcbe8cf65938a20 100644 (file)
@@ -1076,6 +1076,13 @@ class Item
                        unset($item['causer-id']);
                }
 
+               if (in_array($item['network'], [Protocol::ACTIVITYPUB, Protocol::DFRN])) {
+                       $content_warning = BBCode::getAbstract($item['body'], Protocol::ACTIVITYPUB);
+                       if (!empty($content_warning) && empty($item['content-warning'])) {
+                               $item['content-warning'] = $content_warning;
+                       }
+               }
+
                Post::insert($item['uri-id'], $item);
 
                if ($item['gravity'] == GRAVITY_PARENT) {
@@ -1238,7 +1245,7 @@ class Item
 
                $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))) {
                        Logger::info('The resharer is not a following contact: quit', ['resharer' => $author['url'], 'uid' => $item['uid'], 'cid' => $cid]);
@@ -1411,7 +1418,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]);
@@ -1474,7 +1481,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)) {