Merge pull request #12801 from HankG/fix-mastodon-api-search
Fix mastodon api search
This commit is contained in:
commit
659fab0fe5
1 changed files with 2 additions and 3 deletions
|
@ -77,7 +77,7 @@ class Search extends BaseApi
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((empty($request['type']) || ($request['type'] == 'statuses')) && (strpos($request['q'], '@') == false)) {
|
if (empty($request['type']) || ($request['type'] == 'statuses')) {
|
||||||
$result['statuses'] = self::searchStatuses($uid, $request['q'], $request['account_id'], $request['max_id'], $request['min_id'], $limit, $request['offset']);
|
$result['statuses'] = self::searchStatuses($uid, $request['q'], $request['account_id'], $request['max_id'], $request['min_id'], $limit, $request['offset']);
|
||||||
|
|
||||||
if (!is_array($result['statuses'])) {
|
if (!is_array($result['statuses'])) {
|
||||||
|
@ -108,8 +108,7 @@ class Search extends BaseApi
|
||||||
*/
|
*/
|
||||||
private static function searchAccounts(int $uid, string $q, bool $resolve, int $limit, int $offset, bool $following)
|
private static function searchAccounts(int $uid, string $q, bool $resolve, int $limit, int $offset, bool $following)
|
||||||
{
|
{
|
||||||
if (
|
if (($offset == 0) && (strrpos($q, '@') > 0 || Network::isValidHttpUrl($q))
|
||||||
($offset == 0) && (strrpos($q, '@') > 0 || Network::isValidHttpUrl($q))
|
|
||||||
&& $id = Contact::getIdForURL($q, 0, $resolve ? null : false)
|
&& $id = Contact::getIdForURL($q, 0, $resolve ? null : false)
|
||||||
) {
|
) {
|
||||||
return DI::mstdnAccount()->createFromContactId($id, $uid);
|
return DI::mstdnAccount()->createFromContactId($id, $uid);
|
||||||
|
|
Loading…
Reference in a new issue