The tag table is now really used
This commit is contained in:
parent
af97df96bd
commit
5df5e9521b
9 changed files with 121 additions and 93 deletions
|
@ -36,7 +36,7 @@ use Friendica\Model\Conversation;
|
|||
use Friendica\Model\Item;
|
||||
use Friendica\Model\Profile;
|
||||
use Friendica\Model\Photo;
|
||||
use Friendica\Model\Term;
|
||||
use Friendica\Model\Tag;
|
||||
use Friendica\Model\User;
|
||||
use Friendica\Protocol\Activity;
|
||||
use Friendica\Protocol\ActivityPub;
|
||||
|
@ -405,7 +405,7 @@ class Transmitter
|
|||
$actor_profile = APContact::getByURL($item['author-link']);
|
||||
}
|
||||
|
||||
$terms = Term::tagArrayFromItemId($item['id'], [Term::MENTION, Term::IMPLICIT_MENTION]);
|
||||
$terms = Tag::ArrayFromURIId($item['uri-id'], [Tag::MENTION, Tag::IMPLICIT_MENTION, Tag::EXCLUSIVE_MENTION]);
|
||||
|
||||
if ($item['private'] != Item::PRIVATE) {
|
||||
// Directly mention the original author upon a quoted reshare.
|
||||
|
@ -1007,12 +1007,12 @@ class Transmitter
|
|||
{
|
||||
$tags = [];
|
||||
|
||||
$terms = Term::tagArrayFromItemId($item['id'], [Term::HASHTAG, Term::MENTION, Term::IMPLICIT_MENTION]);
|
||||
$terms = Tag::ArrayFromURIId($item['uri-id'], [Tag::HASHTAG, Tag::MENTION, Tag::IMPLICIT_MENTION, Tag::EXCLUSIVE_MENTION]);
|
||||
foreach ($terms as $term) {
|
||||
if ($term['type'] == Term::HASHTAG) {
|
||||
if ($term['type'] == Tag::HASHTAG) {
|
||||
$url = DI::baseUrl() . '/search?tag=' . urlencode($term['term']);
|
||||
$tags[] = ['type' => 'Hashtag', 'href' => $url, 'name' => '#' . $term['term']];
|
||||
} elseif ($term['type'] == Term::MENTION || $term['type'] == Term::IMPLICIT_MENTION) {
|
||||
} else {
|
||||
$contact = Contact::getDetailsByURL($term['url']);
|
||||
if (!empty($contact['addr'])) {
|
||||
$mention = '@' . $contact['addr'];
|
||||
|
@ -1211,15 +1211,14 @@ class Transmitter
|
|||
/**
|
||||
* Returns if the post contains sensitive content ("nsfw")
|
||||
*
|
||||
* @param integer $item_id
|
||||
* @param integer $uri_id
|
||||
*
|
||||
* @return boolean
|
||||
* @throws \Exception
|
||||
*/
|
||||
private static function isSensitive($item_id)
|
||||
private static function isSensitive($uri_id)
|
||||
{
|
||||
$condition = ['otype' => Term::OBJECT_TYPE_POST, 'oid' => $item_id, 'type' => Term::HASHTAG, 'term' => 'nsfw'];
|
||||
return DBA::exists('term', $condition);
|
||||
return DBA::exists('tag-view', ['uri-id' => $uri_id, 'name' => 'nsfw']);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1301,7 +1300,7 @@ class Transmitter
|
|||
|
||||
$data['url'] = $item['plink'];
|
||||
$data['attributedTo'] = $item['author-link'];
|
||||
$data['sensitive'] = self::isSensitive($item['id']);
|
||||
$data['sensitive'] = self::isSensitive($item['uri-id']);
|
||||
$data['context'] = self::fetchContextURLForItem($item);
|
||||
|
||||
if (!empty($item['title'])) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue