Merge pull request #11318 from annando/issue-11315

Issue 11315: Fix for all receivers in "to"
This commit is contained in:
Hypolite Petovan 2022-03-11 15:52:42 -05:00 committed by GitHub
commit 0c4f1eadb8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 7 deletions

View file

@ -27,6 +27,7 @@ use Friendica\Content\Text\BBCode;
use Friendica\Database\Database; use Friendica\Database\Database;
use Friendica\Database\DBA; use Friendica\Database\DBA;
use Friendica\Model\Post; use Friendica\Model\Post;
use Friendica\Model\Tag as TagModel;
use Friendica\Model\Verb; use Friendica\Model\Verb;
use Friendica\Network\HTTPException; use Friendica\Network\HTTPException;
use Friendica\Protocol\Activity; use Friendica\Protocol\Activity;
@ -127,7 +128,7 @@ class Status extends BaseFactory
Post\ThreadUser::getPinned($uriId, $uid) 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'])); $application = new \Friendica\Object\Api\Mastodon\Application($item['app'] ?: ContactSelector::networkToName($item['network'], $item['author-link']));
$mentions = $this->mstdnMentionFactory->createFromUriId($uriId)->getArrayCopy(); $mentions = $this->mstdnMentionFactory->createFromUriId($uriId)->getArrayCopy();

View file

@ -60,8 +60,8 @@ class Tag
const TAG_CHARACTER = [ const TAG_CHARACTER = [
self::HASHTAG => '#', self::HASHTAG => '#',
self::MENTION => '@', self::MENTION => '@',
self::IMPLICIT_MENTION => '%',
self::EXCLUSIVE_MENTION => '!', self::EXCLUSIVE_MENTION => '!',
self::IMPLICIT_MENTION => '%',
]; ];
/** /**
@ -273,7 +273,7 @@ class Tag
*/ */
public static function existsForPost(int $uriid) 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; 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)) { while ($tag = DBA::fetch($tags)) {
self::store($uri_id, self::IMPLICIT_MENTION, $tag['name'], $tag['url']); self::store($uri_id, self::IMPLICIT_MENTION, $tag['name'], $tag['url']);
} }
@ -370,7 +370,7 @@ class Tag
* @return array * @return array
* @throws \Exception * @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]; $condition = ['uri-id' => $uri_id, 'type' => $type];
return DBA::selectToArray('tag-view', ['type', 'name', 'url'], $condition); return DBA::selectToArray('tag-view', ['type', 'name', 'url'], $condition);
@ -384,7 +384,7 @@ class Tag
* @return string tags and mentions * @return string tags and mentions
* @throws \Exception * @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 = []; $tag_list = [];
$tags = self::getByURIId($uri_id, $type); $tags = self::getByURIId($uri_id, $type);

View file

@ -1408,7 +1408,7 @@ class Transmitter
*/ */
private static function isSensitive($uri_id) 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]);
} }
/** /**