mirror of
https://github.com/friendica/friendica
synced 2025-04-22 00:30:10 +00:00
Merge remote-tracking branch 'upstream/develop' into issue-8550
This commit is contained in:
commit
7de6e60328
76 changed files with 5833 additions and 1079 deletions
|
@ -48,14 +48,14 @@ class Source extends BaseAdmin
|
|||
$item_id = '';
|
||||
$terms = [];
|
||||
if (!empty($guid)) {
|
||||
$item = Model\Item::selectFirst(['id', 'guid', 'uri'], ['guid' => $guid]);
|
||||
$item = Model\Item::selectFirst(['id', 'uri-id', 'guid', 'uri'], ['guid' => $guid]);
|
||||
|
||||
$conversation = Model\Conversation::getByItemUri($item['uri']);
|
||||
|
||||
$item_id = $item['id'];
|
||||
$item_uri = $item['uri'];
|
||||
$source = $conversation['source'];
|
||||
$terms = Model\Term::tagArrayFromItemId($item['id'], [Model\Term::HASHTAG, Model\Term::MENTION, Model\Term::IMPLICIT_MENTION]);
|
||||
$terms = Model\Tag::getByURIId($item['uri-id'], [Model\Tag::HASHTAG, Model\Tag::MENTION, Model\Tag::IMPLICIT_MENTION]);
|
||||
}
|
||||
|
||||
$tpl = Renderer::getMarkupTemplate('admin/item/source.tpl');
|
||||
|
|
|
@ -25,14 +25,12 @@ use Friendica\BaseModule;
|
|||
use Friendica\Core\System;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Util\Strings;
|
||||
use Friendica\Model\Term;
|
||||
|
||||
/**
|
||||
* Hashtag module.
|
||||
*/
|
||||
class Hashtag extends BaseModule
|
||||
{
|
||||
|
||||
public static function content(array $parameters = [])
|
||||
{
|
||||
$result = [];
|
||||
|
@ -42,12 +40,9 @@ class Hashtag extends BaseModule
|
|||
System::jsonExit($result);
|
||||
}
|
||||
|
||||
$taglist = DBA::p("SELECT DISTINCT(`term`) FROM `term` WHERE `term` LIKE ? AND `type` = ? ORDER BY `term`",
|
||||
$t . '%',
|
||||
intval(Term::HASHTAG)
|
||||
);
|
||||
$taglist = DBA::select('tag', ['name'], ["`name` LIKE ?", $t . "%"], ['order' => ['name'], 'limit' => 100]);
|
||||
while ($tag = DBA::fetch($taglist)) {
|
||||
$result[] = ['text' => $tag['term']];
|
||||
$result[] = ['text' => $tag['name']];
|
||||
}
|
||||
DBA::close($taglist);
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ use Friendica\Database\DBA;
|
|||
use Friendica\DI;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\Profile as ProfileModel;
|
||||
use Friendica\Model\Term;
|
||||
use Friendica\Model\Tag;
|
||||
use Friendica\Model\User;
|
||||
use Friendica\Module\BaseProfile;
|
||||
use Friendica\Module\Security\Login;
|
||||
|
@ -184,7 +184,7 @@ class Profile extends BaseProfile
|
|||
foreach (explode(',', $a->profile['pub_keywords']) as $tag_label) {
|
||||
$tags[] = [
|
||||
'url' => '/search?tag=' . $tag_label,
|
||||
'label' => Term::TAG_CHARACTER[Term::HASHTAG] . $tag_label,
|
||||
'label' => Tag::TAG_CHARACTER[Tag::HASHTAG] . $tag_label,
|
||||
];
|
||||
}
|
||||
|
||||
|
|
|
@ -147,8 +147,8 @@ class Status extends BaseProfile
|
|||
}
|
||||
|
||||
if (!empty($hashtags)) {
|
||||
$sql_post_table .= sprintf("INNER JOIN (SELECT `oid` FROM `term` WHERE `term` = '%s' AND `otype` = %d AND `type` = %d AND `uid` = %d ORDER BY `tid` DESC) AS `term` ON `item`.`id` = `term`.`oid` ",
|
||||
DBA::escape(Strings::protectSprintf($hashtags)), intval(Term::OBJECT_TYPE_POST), intval(Term::HASHTAG), intval($a->profile['uid']));
|
||||
$sql_post_table .= sprintf("INNER JOIN (SELECT `uri-id` FROM `tag-search-view` WHERE `name` = '%s' AND `uid` = %d ORDER BY `uri-id` DESC) AS `tag-search` ON `item`.`uri-id` = `tag-search`.`uri-id` ",
|
||||
DBA::escape(Strings::protectSprintf($hashtags)), intval($a->profile['uid']));
|
||||
}
|
||||
|
||||
if (!empty($datequery)) {
|
||||
|
|
|
@ -33,7 +33,7 @@ use Friendica\Database\DBA;
|
|||
use Friendica\DI;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\Item;
|
||||
use Friendica\Model\Term;
|
||||
use Friendica\Model\Tag;
|
||||
use Friendica\Module\BaseSearch;
|
||||
use Friendica\Network\HTTPException;
|
||||
use Friendica\Util\Strings;
|
||||
|
@ -149,28 +149,11 @@ class Index extends BaseSearch
|
|||
|
||||
if ($tag) {
|
||||
Logger::info('Start tag search.', ['q' => $search]);
|
||||
$uriids = Tag::getURIIdListByTag($search, local_user(), $pager->getStart(), $pager->getItemsPerPage());
|
||||
|
||||
$condition = [
|
||||
"(`uid` = 0 OR (`uid` = ? AND NOT `global`))
|
||||
AND `otype` = ? AND `type` = ? AND `term` = ?",
|
||||
local_user(), Term::OBJECT_TYPE_POST, Term::HASHTAG, $search
|
||||
];
|
||||
$params = [
|
||||
'order' => ['received' => true],
|
||||
'limit' => [$pager->getStart(), $pager->getItemsPerPage()]
|
||||
];
|
||||
$terms = DBA::select('term', ['oid'], $condition, $params);
|
||||
|
||||
$itemids = [];
|
||||
while ($term = DBA::fetch($terms)) {
|
||||
$itemids[] = $term['oid'];
|
||||
}
|
||||
|
||||
DBA::close($terms);
|
||||
|
||||
if (!empty($itemids)) {
|
||||
$params = ['order' => ['id' => true]];
|
||||
$items = Item::selectForUser(local_user(), [], ['id' => $itemids], $params);
|
||||
if (!empty($uriids)) {
|
||||
$params = ['order' => ['id' => true], 'group_by' => ['uri-id']];
|
||||
$items = Item::selectForUser(local_user(), [], ['uri-id' => $uriids], $params);
|
||||
$r = Item::inArray($items);
|
||||
} else {
|
||||
$r = [];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue