]> git.mxchange.org Git - friendica.git/commitdiff
Issue 11315: Fix for all receivers in "to"
authorMichael <heluecht@pirati.ca>
Fri, 11 Mar 2022 20:39:03 +0000 (20:39 +0000)
committerMichael <heluecht@pirati.ca>
Fri, 11 Mar 2022 20:39:03 +0000 (20:39 +0000)
src/Factory/Api/Mastodon/Status.php
src/Model/Tag.php
src/Protocol/ActivityPub/Transmitter.php

index 9015591ad354597f5313df67749c5d921e4b7265..ee74c257dfea244b2569f51bf9c5deb51ddb36a4 100644 (file)
@@ -27,6 +27,7 @@ use Friendica\Content\Text\BBCode;
 use Friendica\Database\Database;
 use Friendica\Database\DBA;
 use Friendica\Model\Post;
+use Friendica\Model\Tag as TagModel;
 use Friendica\Model\Verb;
 use Friendica\Network\HTTPException;
 use Friendica\Protocol\Activity;
@@ -127,7 +128,7 @@ class Status extends BaseFactory
                        Post\ThreadUser::getPinned($uriId, $uid)
                );
 
-               $sensitive   = $this->dba->exists('tag-view', ['uri-id' => $uriId, 'name' => 'nsfw']);
+               $sensitive   = $this->dba->exists('tag-view', ['uri-id' => $uriId, 'name' => 'nsfw', 'type' => TagModel::HASHTAG]);
                $application = new \Friendica\Object\Api\Mastodon\Application($item['app'] ?: ContactSelector::networkToName($item['network'], $item['author-link']));
 
                $mentions    = $this->mstdnMentionFactory->createFromUriId($uriId)->getArrayCopy();
index cff678d6070a05d0cb4777bd80251a64a64f2b87..1cc48bd2f7dca5572e2cafa9517d42c335e60ae2 100644 (file)
@@ -60,8 +60,8 @@ class Tag
        const TAG_CHARACTER = [
                self::HASHTAG           => '#',
                self::MENTION           => '@',
-               self::IMPLICIT_MENTION  => '%',
                self::EXCLUSIVE_MENTION => '!',
+               self::IMPLICIT_MENTION  => '%',
        ];
 
        /**
@@ -273,7 +273,7 @@ class Tag
         */
        public static function existsForPost(int $uriid)
        {
-               return DBA::exists('post-tag', ['uri-id' => $uriid, 'type' => [self::HASHTAG, self::MENTION, self::IMPLICIT_MENTION, self::EXCLUSIVE_MENTION]]);
+               return DBA::exists('post-tag', ['uri-id' => $uriid, 'type' => [self::HASHTAG, self::MENTION, self::EXCLUSIVE_MENTION, self::IMPLICIT_MENTION]]);
        }
 
        /**
@@ -355,7 +355,7 @@ class Tag
                        return;
                }
 
-               $tags = DBA::select('tag-view', ['name', 'url'], ['uri-id' => $parent_uri_id]);
+               $tags = DBA::select('tag-view', ['name', 'url'], ['uri-id' => $parent_uri_id, 'type' => [self::MENTION, self::EXCLUSIVE_MENTION, self::IMPLICIT_MENTION]]);
                while ($tag = DBA::fetch($tags)) {
                        self::store($uri_id, self::IMPLICIT_MENTION, $tag['name'], $tag['url']);
                }
@@ -370,7 +370,7 @@ class Tag
         * @return array
         * @throws \Exception
         */
-       public static function getByURIId(int $uri_id, array $type = [self::HASHTAG, self::MENTION, self::IMPLICIT_MENTION, self::EXCLUSIVE_MENTION])
+       public static function getByURIId(int $uri_id, array $type = [self::HASHTAG, self::MENTION, self::EXCLUSIVE_MENTION, self::IMPLICIT_MENTION])
        {
                $condition = ['uri-id' => $uri_id, 'type' => $type];
                return DBA::selectToArray('tag-view', ['type', 'name', 'url'], $condition);
@@ -384,7 +384,7 @@ class Tag
         * @return string tags and mentions
         * @throws \Exception
         */
-       public static function getCSVByURIId(int $uri_id, array $type = [self::HASHTAG, self::MENTION, self::IMPLICIT_MENTION, self::EXCLUSIVE_MENTION])
+       public static function getCSVByURIId(int $uri_id, array $type = [self::HASHTAG, self::MENTION, self::EXCLUSIVE_MENTION, self::IMPLICIT_MENTION])
        {
                $tag_list = [];
                $tags = self::getByURIId($uri_id, $type);
index 47c3cdaab5d1a3f40465d2dc1a7857c3d818c0ae..d17e269edf9d516bf30c0db82546c1d8221d071f 100644 (file)
@@ -1408,7 +1408,7 @@ class Transmitter
         */
        private static function isSensitive($uri_id)
        {
-               return DBA::exists('tag-view', ['uri-id' => $uri_id, 'name' => 'nsfw']);
+               return DBA::exists('tag-view', ['uri-id' => $uri_id, 'name' => 'nsfw', 'type' => Tag::HASHTAG]);
        }
 
        /**