Skip to content

Commit

Permalink
Merge pull request #763 from nextcloud/fix/search_provider_links
Browse files Browse the repository at this point in the history
fix(backend): remove duplicate `/` from links to app in search providers
  • Loading branch information
mejo- authored Jul 5, 2023
2 parents 640428d + 7cd827e commit fff1ff6
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 12 deletions.
4 changes: 2 additions & 2 deletions lib/Search/CollectiveProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public function getName(): string {
* @return int
*/
public function getOrder(string $route, array $routeParameters): int {
if ($route === 'collectives.Start.index') {
if ($route === 'collectives.start.index') {
// Collectives first when the app is active
return -3;
}
Expand Down Expand Up @@ -98,7 +98,7 @@ public function search(IUser $user, ISearchQuery $query): SearchResult {
'',
$this->collectiveService->getCollectiveNameWithEmoji($collective),
'',
$this->urlGenerator->linkToRoute('collectives.start.index') . '/' . rawurlencode($collective->getName()),
$this->urlGenerator->linkToRoute('collectives.start.index') . rawurlencode($collective->getName()),
'icon-collectives'
);
}
Expand Down
7 changes: 2 additions & 5 deletions lib/Search/PageContentProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public function getName(): string {
* @return int
*/
public function getOrder(string $route, array $routeParameters): int {
if ($route === 'collectives.Start.index') {
if ($route === 'collectives.start.index') {
return -1;
}
return 4;
Expand Down Expand Up @@ -139,10 +139,7 @@ public function search(IUser $user, ISearchQuery $query): SearchResult {
'',
$highlighter->extractRelevant($query->getTerm(), $page->getContent(), $highlightLength, 5, ''),
$collective->getName() . ' / ' . $pageInfo->getTitle(),
implode('/', array_filter([
$this->urlGenerator->linkToRoute('collectives.start.index'),
$this->pageService->getPageLink($collective->getName(), $pageInfo)
])),
$this->urlGenerator->linkToRoute('collectives.start.index') . $this->pageService->getPageLink($collective->getName(), $pageInfo),
'icon-collectives-page'
);
}
Expand Down
7 changes: 2 additions & 5 deletions lib/Search/PageProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public function getName(): string {
* @return int
*/
public function getOrder(string $route, array $routeParameters): int {
if ($route === 'collectives.Start.index') {
if ($route === 'collectives.start.index') {
// Collective pages second when the app is active
return -2;
}
Expand Down Expand Up @@ -106,10 +106,7 @@ public function search(IUser $user, ISearchQuery $query): SearchResult {
),
$this->getPageTitle($pageInfo),
$this->l10n->t('In collective %1$s', [$this->collectiveService->getCollectiveNameWithEmoji($collective)]),
implode('/', array_filter([
$this->urlGenerator->linkToRouteAbsolute('collectives.start.index'),
$this->pageService->getPageLink($collective->getName(), $pageInfo)
])),
$this->urlGenerator->linkToRoute('collectives.start.index') . $this->pageService->getPageLink($collective->getName(), $pageInfo),
'icon-collectives-page'
);
}
Expand Down

0 comments on commit fff1ff6

Please sign in to comment.