Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix generated fronted urls #1925

Merged
merged 1 commit into from
Jun 2, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/Activity/DeckProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,6 @@ private function parseParamForChanges($subjectParams, $params, $event) {
}

public function deckUrl($endpoint) {
return $this->urlGenerator->linkToRouteAbsolute('deck.page.index') . '#!' . $endpoint;
return $this->urlGenerator->linkToRouteAbsolute('deck.page.index') . '#' . $endpoint;
}
}
2 changes: 1 addition & 1 deletion lib/Collaboration/Resources/ResourceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public function getType(): string {
*/
public function getResourceRichObject(IResource $resource): array {
$board = $this->getBoard($resource);
$link = \OC::$server->getURLGenerator()->linkToRoute('deck.page.index') . '#!/board/' . $resource->getId();
$link = \OC::$server->getURLGenerator()->linkToRoute('deck.page.index') . '#/board/' . $resource->getId();

return [
'type' => self::RESOURCE_TYPE,
Expand Down
2 changes: 1 addition & 1 deletion lib/Collaboration/Resources/ResourceProviderCard.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public function getResourceRichObject(IResource $resource): array {
throw new ResourceException('No unique card found for resource, this should never happen');
}

$link = $this->urlGenerator->linkToRoute('deck.page.index') . '#/board/' . $board->getId() . '/cards/' . $resource->getId();
$link = $this->urlGenerator->linkToRoute('deck.page.index') . '#/board/' . $board->getId() . '/card/' . $resource->getId();

return [
'type' => self::RESOURCE_TYPE,
Expand Down
8 changes: 4 additions & 4 deletions lib/Notification/Notifier.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,15 +115,15 @@ public function prepare(INotification $notification, string $languageCode): INot
]
]
);
$notification->setLink($this->url->linkToRouteAbsolute('deck.page.index') . '#!/board/' . $boardId . '/card/' . $cardId . '');
$notification->setLink($this->url->linkToRouteAbsolute('deck.page.index') . '#/board/' . $boardId . '/card/' . $cardId . '');
break;
case 'card-overdue':
$cardId = $notification->getObjectId();
$boardId = $this->cardMapper->findBoardId($cardId);
$notification->setParsedSubject(
(string) $l->t('The card "%s" on "%s" has reached its due date.', $params)
);
$notification->setLink($this->url->linkToRouteAbsolute('deck.page.index') . '#!/board/' . $boardId . '/card/' . $cardId . '');
$notification->setLink($this->url->linkToRouteAbsolute('deck.page.index') . '#/board/' . $boardId . '/card/' . $cardId . '');
break;
case 'card-comment-mentioned':
$cardId = $notification->getObjectId();
Expand All @@ -150,7 +150,7 @@ public function prepare(INotification $notification, string $languageCode): INot
if ($notification->getMessage() === '{message}') {
$notification->setParsedMessage($notification->getMessageParameters()['message']);
}
$notification->setLink($this->url->linkToRouteAbsolute('deck.page.index') . '#!/board/' . $boardId . '/card/' . $cardId . '');
$notification->setLink($this->url->linkToRouteAbsolute('deck.page.index') . '#/board/' . $boardId . '/card/' . $cardId . '');
break;
case 'board-shared':
$boardId = $notification->getObjectId();
Expand All @@ -173,7 +173,7 @@ public function prepare(INotification $notification, string $languageCode): INot
]
]
);
$notification->setLink($this->url->linkToRouteAbsolute('deck.page.index') . '#!/board/' . $boardId . '/');
$notification->setLink($this->url->linkToRouteAbsolute('deck.page.index') . '#/board/' . $boardId . '/');
break;
}
return $notification;
Expand Down
2 changes: 1 addition & 1 deletion lib/Provider/DeckProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ public function improveSearchResult(ISearchResult $searchResult) {
try {
$board =
$this->fullTextSearchService->getBoardFromCardId((int)$document->getId());
$path = '#!/board/' . $board->getId() . '//card/' . $document->getId();
$path = '#/board/' . $board->getId() . '/card/' . $document->getId();
$document->setLink($this->urlGenerator->linkToRoute('deck.page.index') . $path);
} catch (DoesNotExistException $e) {
} catch (MultipleObjectsReturnedException $e) {
Expand Down
6 changes: 3 additions & 3 deletions tests/unit/Activity/DeckProviderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ public function testDeckUrl() {
->with('deck.page.index')
->willReturn('http://localhost/index.php/apps/deck/');
$this->assertEquals(
'http://localhost/index.php/apps/deck/#!board/1/card/1',
'http://localhost/index.php/apps/deck/#board/1/card/1',
$this->provider->deckUrl('board/1/card/1')
);
}
Expand Down Expand Up @@ -186,7 +186,7 @@ public function testParseObjectTypeBoard() {
'type' => 'highlight',
'id' => 1,
'name' => 'Board',
'link' => '#!/board/1',
'link' => '#/board/1',
],
'user' => [
'type' => 'user',
Expand Down Expand Up @@ -303,7 +303,7 @@ public function testParseParamForBoard() {
'type' => 'highlight',
'id' => 1,
'name' => 'Board name',
'link' => '#!/board/1/',
'link' => '#/board/1/',
],
];
$actual = $this->invokePrivate($this->provider, 'parseParamForBoard', ['board', $subjectParams, $params]);
Expand Down