From 75360f3b8c4c2e71c79c184e19a62a3b6d167369 Mon Sep 17 00:00:00 2001 From: Philipp Date: Wed, 9 Nov 2022 22:13:02 +0100 Subject: [PATCH 1/7] Move mod/mod/msearch & mod/match to src/Module --- mod/match.php | 132 -------------- mod/msearch.php | 64 ------- src/Module/Contact/Match.php | 169 ++++++++++++++++++ src/Module/Search/Tags.php | 88 +++++++++ static/routes.config.php | 8 +- view/templates/widget/peoplefind.tpl | 4 +- .../frio/templates/widget/peoplefind.tpl | 2 +- 7 files changed, 265 insertions(+), 202 deletions(-) delete mode 100644 mod/match.php delete mode 100644 mod/msearch.php create mode 100644 src/Module/Contact/Match.php create mode 100644 src/Module/Search/Tags.php diff --git a/mod/match.php b/mod/match.php deleted file mode 100644 index ea59d7ee61..0000000000 --- a/mod/match.php +++ /dev/null @@ -1,132 +0,0 @@ -. - * - */ - -use Friendica\App; -use Friendica\Content\Widget; -use Friendica\Core\Renderer; -use Friendica\Core\Search; -use Friendica\Database\DBA; -use Friendica\DI; -use Friendica\Model\Contact; -use Friendica\Model\Profile; -use Friendica\Module\Contact as ModuleContact; - -/** - * Controller for /match. - * - * It takes keywords from your profile and queries the directory server for - * matching keywords from other profiles. - * - * @param App $a App - * - * @return string - * @throws ImagickException - * @throws \Friendica\Network\HTTPException\InternalServerErrorException - * @throws Exception - */ -function match_content(App $a) -{ - if (!DI::userSession()->getLocalUserId()) { - return ''; - } - - DI::page()['aside'] .= Widget::findPeople(); - DI::page()['aside'] .= Widget::follow(); - - $_SESSION['return_path'] = DI::args()->getCommand(); - - $profile = Profile::getByUID(DI::userSession()->getLocalUserId()); - - if (!DBA::isResult($profile)) { - return ''; - } - if (!$profile['pub_keywords'] && (!$profile['prv_keywords'])) { - DI::sysmsg()->addNotice(DI::l10n()->t('No keywords to match. Please add keywords to your profile.')); - return ''; - } - - $params = []; - $tags = trim($profile['pub_keywords'] . ' ' . $profile['prv_keywords']); - - if (DI::mode()->isMobile()) { - $limit = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'system', 'itemspage_mobile_network', - DI::config()->get('system', 'itemspage_network_mobile')); - } else { - $limit = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'system', 'itemspage_network', - DI::config()->get('system', 'itemspage_network')); - } - - $params['s'] = $tags; - $params['n'] = 100; - - $entries = []; - foreach ([Search::getGlobalDirectory(), DI::baseUrl()] as $server) { - if (empty($server)) { - continue; - } - - $msearch = json_decode(DI::httpClient()->post($server . '/msearch', $params)->getBody()); - if (!empty($msearch)) { - $entries = match_get_contacts($msearch, $entries, $limit); - } - } - - if (empty($entries)) { - DI::sysmsg()->addInfo(DI::l10n()->t('No matches')); - } - - $tpl = Renderer::getMarkupTemplate('contact/list.tpl'); - $o = Renderer::replaceMacros($tpl, [ - '$title' => DI::l10n()->t('Profile Match'), - '$contacts' => array_slice($entries, 0, $limit), - ]); - - return $o; -} - -function match_get_contacts($msearch, $entries, $limit) -{ - if (empty($msearch->results)) { - return $entries; - } - - foreach ($msearch->results as $profile) { - if (!$profile) { - continue; - } - - // Already known contact - $contact = Contact::getByURL($profile->url, null, ['rel'], DI::userSession()->getLocalUserId()); - if (!empty($contact) && in_array($contact['rel'], [Contact::FRIEND, Contact::SHARING])) { - continue; - } - - $contact = Contact::getByURLForUser($profile->url, DI::userSession()->getLocalUserId()); - if (!empty($contact)) { - $entries[$contact['id']] = ModuleContact::getContactTemplateVars($contact); - } - - if (count($entries) == $limit) { - break; - } - } - return $entries; -} \ No newline at end of file diff --git a/mod/msearch.php b/mod/msearch.php deleted file mode 100644 index 00a72ea9f7..0000000000 --- a/mod/msearch.php +++ /dev/null @@ -1,64 +0,0 @@ -. - * - */ - -use Friendica\App; -use Friendica\Core\System; -use Friendica\Database\DBA; -use Friendica\DI; -use Friendica\Model\User; -use Friendica\Util\Proxy; - -function msearch_post(App $a) -{ - $search = $_POST['s'] ?? ''; - $perpage = intval(($_POST['n'] ?? 0) ?: 80); - $page = intval(($_POST['p'] ?? 0) ?: 1); - $startrec = ($page - 1) * $perpage; - - $total = 0; - $results = []; - - if (!strlen($search)) { - $output = ['total' => 0, 'items_page' => $perpage, 'page' => $page, 'results' => $results]; - System::jsonExit($output); - } - - $total = 0; - - $condition = ["`net-publish` AND MATCH(`pub_keywords`) AGAINST (?)", $search]; - $total = DBA::count('owner-view', $condition); - - $search_stmt = DBA::select('owner-view', ['pub_keywords', 'name', 'nickname', 'uid'], $condition, ['limit' => [$startrec, $perpage]]); - while ($search_result = DBA::fetch($search_stmt)) { - $results[] = [ - 'name' => $search_result['name'], - 'url' => DI::baseUrl() . '/profile/' . $search_result['nickname'], - 'photo' => User::getAvatarUrl($search_result, Proxy::SIZE_THUMB), - 'tags' => str_replace([',', ' '], [' ', ' '], $search_result['pub_keywords']) - ]; - } - - DBA::close($search_stmt); - - $output = ['total' => $total, 'items_page' => $perpage, 'page' => $page, 'results' => $results]; - - System::jsonExit($output); -} diff --git a/src/Module/Contact/Match.php b/src/Module/Contact/Match.php new file mode 100644 index 0000000000..c03627e30f --- /dev/null +++ b/src/Module/Contact/Match.php @@ -0,0 +1,169 @@ +session = $session; + $this->database = $database; + $this->systemMessages = $systemMessages; + $this->page = $page; + $this->mode = $mode; + $this->config = $config; + $this->pConfig = $pConfig; + $this->httpClient = $httpClient; + } + + protected function content(array $request = []): string + { + if (!$this->session->getLocalUserId()) { + $this->systemMessages->addNotice($this->t('Permission denied.')); + $this->baseUrl->redirect('login&return_path=match'); + } + + $profile = Profile::getByUID($this->session->getLocalUserId()); + + if (empty($profile)) { + $this->logger->warning('Couldn\'t find Profile for user id in session.', ['uid' => $this->session->getLocalUserId()]); + throw new InternalServerErrorException($this->t('Invalid request.')); + } + + $this->page['aside'] .= Widget::findPeople(); + $this->page['aside'] .= Widget::follow(); + + if (empty($profile['pub_keywords']) && empty($profile['prv_keywords'])) { + $this->systemMessages->addNotice($this->t('No keywords to match. Please add keywords to your profile.')); + return ''; + } + + if ($this->mode->isMobile()) { + $limit = $this->pConfig->get($this->session->getLocalUserId(), 'system', 'itemspage_mobile_network') + ?? $this->config->get('system', 'itemspage_network_mobile'); + } else { + $limit = $this->pConfig->get($this->session->getLocalUserId(), 'system', 'itemspage_network') + ?? $this->config->get('system', 'itemspage_network'); + } + + $searchParameters = [ + 's' => trim($profile['pub_keywords'] . ' ' . $profile['prv_keywords']), + 'n' => self::FETCH_PER_PAGE, + ]; + + $entries = []; + + foreach ([Search::getGlobalDirectory(), $this->baseUrl] as $server) { + if (empty($server)) { + continue; + } + + $result = $this->httpClient->post($server . '/search/user/tags', $searchParameters); + if (!$result->isSuccess()) { + // try legacy endpoint + $result = $this->httpClient->post($server . '/contact/search/tags', $searchParameters); + if (!$result->isSuccess()) { + $this->logger->notice('Search-Endpoint not available for server.', ['server' => $server]); + continue; + } + } + + $entries = $this->parseContacts(json_decode($result->getBody()), $entries, $limit); + } + + if (empty($entries)) { + $this->systemMessages->addNotice($this->t('No matches')); + } + + $tpl = Renderer::getMarkupTemplate('contact/list.tpl'); + return Renderer::replaceMacros($tpl, [ + '$title' => $this->t('Profile Match'), + '$contacts' => array_slice($entries, 0, $limit), + ]); + } + + /** + * parses the JSON result and adds the new entries until the limit is reached + * + * @param $jsonResult + * @param array $entries + * @param int $limit + * + * @return array the new entries array + */ + protected function parseContacts($jsonResult, array $entries, int $limit): array + { + if (empty($jsonResult->results)) { + return $entries; + } + + foreach ($jsonResult->results as $profile) { + if (!$profile) { + continue; + } + + // Already known contact + $contact = Contact::getByURL($profile->url, null, ['rel'], $this->session->getLocalUserId()); + if (!empty($contact) && in_array($contact['rel'], [Contact::FRIEND, Contact::SHARING])) { + continue; + } + + $contact = Contact::getByURLForUser($profile->url, $this->session->getLocalUserId()); + if (!empty($contact)) { + $entries[$contact['id']] = ModuleContact::getContactTemplateVars($contact); + } + + if (count($entries) == $limit) { + break; + } + } + return $entries; + } +} diff --git a/src/Module/Search/Tags.php b/src/Module/Search/Tags.php new file mode 100644 index 0000000000..cc43d85b09 --- /dev/null +++ b/src/Module/Search/Tags.php @@ -0,0 +1,88 @@ +database = $database; + } + + protected function rawContent(array $request = []) + { + $tags = $request['s'] ?? ''; + $perPage = intval($request['n'] ?? self::DEFAULT_ITEMS_PER_PAGE); + $page = intval($request['p'] ?? 1); + $startRec = ($page - 1) * $perPage; + + $results = []; + + if (empty($tags)) { + System::jsonExit([ + 'total' => 0, + 'items_page' => $perPage, + 'page' => $page, + 'results' => $results, + ]); + } + + $condition = [ + "`net-publish` AND MATCH(`pub_keywords`) AGAINST (?)", + $tags + ]; + + $totalCount = $this->database->count('owner-view', $condition); + if ($totalCount === 0) { + System::jsonExit([ + 'total' => 0, + 'items_page' => $perPage, + 'page' => $page, + 'results' => $results, + ]); + } + + $searchStmt = $this->database->select('owner-view', + ['pub_keywords', 'name', 'nickname', 'uid'], + $condition, + ['limit' => [$startRec, $perPage]]); + + while ($searchResult = $this->database->fetch($searchStmt)) { + $results[] = [ + 'name' => $searchResult['name'], + 'url' => $this->baseUrl . '/profile/' . $searchResult['nickname'], + 'photo' => User::getAvatarUrl($searchResult, Proxy::SIZE_THUMB), + ]; + } + + $this->database->close($searchStmt); + + System::jsonExit([ + 'total' => $totalCount, + 'items_page' => $perPage, + 'page' => $page, + 'results' => $results, + ]); + } +} diff --git a/static/routes.config.php b/static/routes.config.php index 01415fb260..ee0b8d6767 100644 --- a/static/routes.config.php +++ b/static/routes.config.php @@ -384,6 +384,7 @@ return [ '/hidden' => [Module\Contact::class, [R::GET]], '/hovercard' => [Module\Contact\Hovercard::class, [R::GET]], '/ignored' => [Module\Contact::class, [R::GET]], + '/match' => [Module\Contact\Match::class, [R::GET]], '/pending' => [Module\Contact::class, [R::GET]], '/redir/{id:\d+}' => [Module\Contact\Redir::class, [R::GET]], '/suggestions' => [Module\Contact\Suggestions::class, [R::GET]], @@ -571,10 +572,11 @@ return [ '/salmon/{nickname}' => [Module\OStatus\Salmon::class, [ R::POST]], '/search' => [ - '[/]' => [Module\Search\Index::class, [R::GET]], + '[/]' => [Module\Search\Index::class, [R::GET ]], '/acl' => [Module\Search\Acl::class, [R::GET, R::POST]], - '/saved/add' => [Module\Search\Saved::class, [R::GET]], - '/saved/remove' => [Module\Search\Saved::class, [R::GET]], + '/saved/add' => [Module\Search\Saved::class, [R::GET ]], + '/saved/remove' => [Module\Search\Saved::class, [R::GET ]], + '/user/tags' => [Module\Search\Tags::class, [ R::POST]], ], '/receive' => [ diff --git a/view/templates/widget/peoplefind.tpl b/view/templates/widget/peoplefind.tpl index 7104dc6f3e..c2794b882b 100644 --- a/view/templates/widget/peoplefind.tpl +++ b/view/templates/widget/peoplefind.tpl @@ -5,8 +5,8 @@
- - + + diff --git a/view/theme/frio/templates/widget/peoplefind.tpl b/view/theme/frio/templates/widget/peoplefind.tpl index 11168eca0b..7cb84c6dfc 100644 --- a/view/theme/frio/templates/widget/peoplefind.tpl +++ b/view/theme/frio/templates/widget/peoplefind.tpl @@ -14,7 +14,7 @@ {{* Additional links *}} - + From 82c631eae34ff24385fc7f243785fea70e224ac2 Mon Sep 17 00:00:00 2001 From: Philipp Date: Wed, 9 Nov 2022 22:17:31 +0100 Subject: [PATCH 2/7] Fix Guzzle InvalidArgumentException for POST with array parameters --- .../HTTPClient/Capability/ICanSendHttpRequests.php | 3 ++- src/Network/HTTPClient/Client/HttpClient.php | 10 +++++++++- src/Network/HTTPClient/Client/HttpClientOptions.php | 6 +++++- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/Network/HTTPClient/Capability/ICanSendHttpRequests.php b/src/Network/HTTPClient/Capability/ICanSendHttpRequests.php index fb51995b3b..7c61b06cfa 100644 --- a/src/Network/HTTPClient/Capability/ICanSendHttpRequests.php +++ b/src/Network/HTTPClient/Capability/ICanSendHttpRequests.php @@ -92,7 +92,7 @@ interface ICanSendHttpRequests * Send POST request to an URL * * @param string $url URL to post - * @param mixed $params array of POST variables + * @param mixed $params POST variables (if an array is passed, it will automatically set as formular parameters) * @param array $headers HTTP headers * @param int $timeout The timeout in seconds, default system config value or 60 seconds * @@ -107,6 +107,7 @@ interface ICanSendHttpRequests * @param string $url Url to send to * @param array $opts (optional parameters) associative array with: * 'body' => (mixed) setting the body for sending data + * 'form_params' => (array) Associative array of form field names to values * 'accept_content' => (string array) supply Accept: header with 'accept_content' as the value * 'timeout' => int Timeout in seconds, default system config value or 60 seconds * 'cookiejar' => path to cookie jar file diff --git a/src/Network/HTTPClient/Client/HttpClient.php b/src/Network/HTTPClient/Client/HttpClient.php index 7974965ac3..cfc8fbfab1 100644 --- a/src/Network/HTTPClient/Client/HttpClient.php +++ b/src/Network/HTTPClient/Client/HttpClient.php @@ -140,6 +140,10 @@ class HttpClient implements ICanSendHttpRequests $conf[RequestOptions::BODY] = $opts[HttpClientOptions::BODY]; } + if (!empty($opts[HttpClientOptions::FORM_PARAMS])) { + $conf[RequestOptions::FORM_PARAMS] = $opts[HttpClientOptions::FORM_PARAMS]; + } + if (!empty($opts[HttpClientOptions::AUTH])) { $conf[RequestOptions::AUTH] = $opts[HttpClientOptions::AUTH]; } @@ -205,7 +209,11 @@ class HttpClient implements ICanSendHttpRequests { $opts = []; - $opts[HttpClientOptions::BODY] = $params; + if (!is_array($params)) { + $opts[HttpClientOptions::BODY] = $params; + } else { + $opts[HttpClientOptions::FORM_PARAMS] = $params; + } if (!empty($headers)) { $opts[HttpClientOptions::HEADERS] = $headers; diff --git a/src/Network/HTTPClient/Client/HttpClientOptions.php b/src/Network/HTTPClient/Client/HttpClientOptions.php index 9a9ee772af..f5ab4c9fb9 100644 --- a/src/Network/HTTPClient/Client/HttpClientOptions.php +++ b/src/Network/HTTPClient/Client/HttpClientOptions.php @@ -59,9 +59,13 @@ class HttpClientOptions const VERIFY = 'verify'; /** - * body: (mixed) Setting the body for sending data + * body: (string) Setting the body for sending data */ const BODY = RequestOptions::BODY; + /** + * form_params: (array) Associative array of form field names to values + */ + const FORM_PARAMS = RequestOptions::FORM_PARAMS; /** * auth: (array) Authentication settings for specific requests */ From 4998d15e85ee82f073006aaf2bce2a90df7fb78f Mon Sep 17 00:00:00 2001 From: Philipp Date: Wed, 9 Nov 2022 22:27:47 +0100 Subject: [PATCH 3/7] Update messages.po --- view/lang/C/messages.po | 52 ++++++++++++++++++++--------------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/view/lang/C/messages.po b/view/lang/C/messages.po index 685fdb605b..2e85a8b109 100644 --- a/view/lang/C/messages.po +++ b/view/lang/C/messages.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: 2022.12-dev\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-11-09 06:29-0500\n" +"POT-Creation-Date: 2022-11-09 21:27+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -47,12 +47,12 @@ msgstr "" #: src/Module/Calendar/Event/Show.php:54 src/Module/Calendar/Export.php:62 #: src/Module/Calendar/Show.php:64 src/Module/Contact/Advanced.php:60 #: src/Module/Contact/Follow.php:86 src/Module/Contact/Follow.php:158 -#: src/Module/Contact/Suggestions.php:54 src/Module/Contact/Unfollow.php:66 -#: src/Module/Contact/Unfollow.php:80 src/Module/Contact/Unfollow.php:112 -#: src/Module/Delegation.php:118 src/Module/FollowConfirm.php:38 -#: src/Module/FriendSuggest.php:57 src/Module/Group.php:40 -#: src/Module/Group.php:83 src/Module/Invite.php:42 src/Module/Invite.php:131 -#: src/Module/Notifications/Notification.php:76 +#: src/Module/Contact/Match.php:69 src/Module/Contact/Suggestions.php:54 +#: src/Module/Contact/Unfollow.php:66 src/Module/Contact/Unfollow.php:80 +#: src/Module/Contact/Unfollow.php:112 src/Module/Delegation.php:118 +#: src/Module/FollowConfirm.php:38 src/Module/FriendSuggest.php:57 +#: src/Module/Group.php:40 src/Module/Group.php:83 src/Module/Invite.php:42 +#: src/Module/Invite.php:131 src/Module/Notifications/Notification.php:76 #: src/Module/Notifications/Notification.php:107 #: src/Module/OStatus/Repair.php:60 src/Module/Profile/Attachment/Upload.php:97 #: src/Module/Profile/Common.php:55 src/Module/Profile/Contacts.php:55 @@ -436,18 +436,6 @@ msgstr "" msgid "Your password has been changed at %s" msgstr "" -#: mod/match.php:62 -msgid "No keywords to match. Please add keywords to your profile." -msgstr "" - -#: mod/match.php:93 src/Module/BaseSearch.php:119 -msgid "No matches" -msgstr "" - -#: mod/match.php:98 -msgid "Profile Match" -msgstr "" - #: mod/message.php:46 mod/message.php:129 src/Content/Nav.php:289 msgid "New Message" msgstr "" @@ -5524,6 +5512,10 @@ msgstr "" msgid "Forum Search - %s" msgstr "" +#: src/Module/BaseSearch.php:119 src/Module/Contact/Match.php:122 +msgid "No matches" +msgstr "" + #: src/Module/BaseSettings.php:80 msgid "Account" msgstr "" @@ -5981,6 +5973,21 @@ msgstr "" msgid "The contact could not be added." msgstr "" +#: src/Module/Contact/Match.php:77 src/Module/Profile/Attachment/Upload.php:80 +#: src/Module/Profile/Attachment/Upload.php:102 +#: src/Module/Profile/Photos/Upload.php:113 +#: src/Module/Profile/Photos/Upload.php:162 +msgid "Invalid request." +msgstr "" + +#: src/Module/Contact/Match.php:84 +msgid "No keywords to match. Please add keywords to your profile." +msgstr "" + +#: src/Module/Contact/Match.php:127 +msgid "Profile Match" +msgstr "" + #: src/Module/Contact/Profile.php:128 msgid "Failed to update contact record." msgstr "" @@ -8108,13 +8115,6 @@ msgstr "" msgid "Remove" msgstr "" -#: src/Module/Profile/Attachment/Upload.php:80 -#: src/Module/Profile/Attachment/Upload.php:102 -#: src/Module/Profile/Photos/Upload.php:113 -#: src/Module/Profile/Photos/Upload.php:162 -msgid "Invalid request." -msgstr "" - #: src/Module/Profile/Attachment/Upload.php:117 msgid "Sorry, maybe your upload is bigger than the PHP configuration allows" msgstr "" From a36a4b619211517192abfc6a0220af5e673fb2cb Mon Sep 17 00:00:00 2001 From: Philipp Date: Wed, 9 Nov 2022 22:28:29 +0100 Subject: [PATCH 4/7] fix link --- view/templates/widget/peoplefind.tpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/view/templates/widget/peoplefind.tpl b/view/templates/widget/peoplefind.tpl index c2794b882b..ef699d249c 100644 --- a/view/templates/widget/peoplefind.tpl +++ b/view/templates/widget/peoplefind.tpl @@ -6,7 +6,7 @@ - + From 7c66073e4bda79dbb7d1d7b52f11d597d1228a65 Mon Sep 17 00:00:00 2001 From: Philipp Date: Wed, 9 Nov 2022 22:29:43 +0100 Subject: [PATCH 5/7] Add license --- src/Module/Contact/Match.php | 19 +++++++++++++++++++ src/Module/Search/Tags.php | 19 +++++++++++++++++++ 2 files changed, 38 insertions(+) diff --git a/src/Module/Contact/Match.php b/src/Module/Contact/Match.php index c03627e30f..0e187b069b 100644 --- a/src/Module/Contact/Match.php +++ b/src/Module/Contact/Match.php @@ -1,4 +1,23 @@ . + * + */ namespace Friendica\Module\Contact; diff --git a/src/Module/Search/Tags.php b/src/Module/Search/Tags.php index cc43d85b09..d409f481f3 100644 --- a/src/Module/Search/Tags.php +++ b/src/Module/Search/Tags.php @@ -1,4 +1,23 @@ . + * + */ namespace Friendica\Module\Search; From 815d8975e61c881c17a32e62cce261942028af53 Mon Sep 17 00:00:00 2001 From: Philipp Date: Wed, 9 Nov 2022 22:36:02 +0100 Subject: [PATCH 6/7] Rename Match to MatchInterests because PHP8-lint rejects "match" --- .../Contact/{Match.php => MatchInterests.php} | 4 +- static/routes.config.php | 42 +++++++++---------- 2 files changed, 22 insertions(+), 24 deletions(-) rename src/Module/Contact/{Match.php => MatchInterests.php} (99%) diff --git a/src/Module/Contact/Match.php b/src/Module/Contact/MatchInterests.php similarity index 99% rename from src/Module/Contact/Match.php rename to src/Module/Contact/MatchInterests.php index 0e187b069b..c9601a0fdf 100644 --- a/src/Module/Contact/Match.php +++ b/src/Module/Contact/MatchInterests.php @@ -42,12 +42,10 @@ use Friendica\Util\Profiler; use Psr\Log\LoggerInterface; /** - * Controller for /match. - * * It takes keywords from your profile and queries the directory server for * matching keywords from other profiles. */ -class Match extends BaseModule +class MatchInterests extends BaseModule { const FETCH_PER_PAGE = 100; diff --git a/static/routes.config.php b/static/routes.config.php index ee0b8d6767..0958ee877b 100644 --- a/static/routes.config.php +++ b/static/routes.config.php @@ -367,28 +367,28 @@ return [ '/compose[/{type}]' => [Module\Item\Compose::class, [R::GET, R::POST]], '/contact' => [ - '[/]' => [Module\Contact::class, [R::GET]], - '/{id:\d+}[/]' => [Module\Contact\Profile::class, [R::GET, R::POST]], + '[/]' => [Module\Contact::class, [R::GET]], + '/{id:\d+}[/]' => [Module\Contact\Profile::class, [R::GET, R::POST]], '/{id:\d+}/{action:block|ignore|update|updateprofile}' - => [Module\Contact\Profile::class, [R::GET]], - '/{id:\d+}/advanced' => [Module\Contact\Advanced::class, [R::GET, R::POST]], - '/{id:\d+}/conversations' => [Module\Contact\Conversations::class, [R::GET]], - '/{id:\d+}/contacts[/{type}]' => [Module\Contact\Contacts::class, [R::GET]], - '/{id:\d+}/media' => [Module\Contact\Media::class, [R::GET]], - '/{id:\d+}/posts' => [Module\Contact\Posts::class, [R::GET]], - '/{id:\d+}/revoke' => [Module\Contact\Revoke::class, [R::GET, R::POST]], - '/archived' => [Module\Contact::class, [R::GET]], - '/batch' => [Module\Contact::class, [R::GET, R::POST]], - '/blocked' => [Module\Contact::class, [R::GET]], - '/follow' => [Module\Contact\Follow::class, [R::GET, R::POST]], - '/hidden' => [Module\Contact::class, [R::GET]], - '/hovercard' => [Module\Contact\Hovercard::class, [R::GET]], - '/ignored' => [Module\Contact::class, [R::GET]], - '/match' => [Module\Contact\Match::class, [R::GET]], - '/pending' => [Module\Contact::class, [R::GET]], - '/redir/{id:\d+}' => [Module\Contact\Redir::class, [R::GET]], - '/suggestions' => [Module\Contact\Suggestions::class, [R::GET]], - '/unfollow' => [Module\Contact\Unfollow::class, [R::GET, R::POST]], + => [Module\Contact\Profile::class, [R::GET]], + '/{id:\d+}/advanced' => [Module\Contact\Advanced::class, [R::GET, R::POST]], + '/{id:\d+}/conversations' => [Module\Contact\Conversations::class, [R::GET]], + '/{id:\d+}/contacts[/{type}]' => [Module\Contact\Contacts::class, [R::GET]], + '/{id:\d+}/media' => [Module\Contact\Media::class, [R::GET]], + '/{id:\d+}/posts' => [Module\Contact\Posts::class, [R::GET]], + '/{id:\d+}/revoke' => [Module\Contact\Revoke::class, [R::GET, R::POST]], + '/archived' => [Module\Contact::class, [R::GET]], + '/batch' => [Module\Contact::class, [R::GET, R::POST]], + '/blocked' => [Module\Contact::class, [R::GET]], + '/follow' => [Module\Contact\Follow::class, [R::GET, R::POST]], + '/hidden' => [Module\Contact::class, [R::GET]], + '/hovercard' => [Module\Contact\Hovercard::class, [R::GET]], + '/ignored' => [Module\Contact::class, [R::GET]], + '/match' => [Module\Contact\MatchInterests::class, [R::GET]], + '/pending' => [Module\Contact::class, [R::GET]], + '/redir/{id:\d+}' => [Module\Contact\Redir::class, [R::GET]], + '/suggestions' => [Module\Contact\Suggestions::class, [R::GET]], + '/unfollow' => [Module\Contact\Unfollow::class, [R::GET, R::POST]], ], '/credits' => [Module\Credits::class, [R::GET]], From 6d7cfc84502ceb2eca064eb4282cb50efd8f1415 Mon Sep 17 00:00:00 2001 From: Philipp Date: Wed, 9 Nov 2022 22:39:36 +0100 Subject: [PATCH 7/7] whops .. wrong legacy endpoint --- src/Module/Contact/MatchInterests.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Module/Contact/MatchInterests.php b/src/Module/Contact/MatchInterests.php index c9601a0fdf..9184e818f9 100644 --- a/src/Module/Contact/MatchInterests.php +++ b/src/Module/Contact/MatchInterests.php @@ -125,7 +125,7 @@ class MatchInterests extends BaseModule $result = $this->httpClient->post($server . '/search/user/tags', $searchParameters); if (!$result->isSuccess()) { // try legacy endpoint - $result = $this->httpClient->post($server . '/contact/search/tags', $searchParameters); + $result = $this->httpClient->post($server . '/msearch', $searchParameters); if (!$result->isSuccess()) { $this->logger->notice('Search-Endpoint not available for server.', ['server' => $server]); continue;