Skip to content

Commit

Permalink
Fix generated fronted urls
Browse files Browse the repository at this point in the history
Signed-off-by: Julius Härtl <jus@bitgrid.net>
  • Loading branch information
juliushaertl committed May 29, 2020
1 parent 30683fd commit 6910ba9
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 11 deletions.
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

0 comments on commit 6910ba9

Please sign in to comment.