fix: generate fixed link for activity emails

Signed-off-by: Luka Trovic <luka@nextcloud.com>

fix: generate fixed link for activity emails

Signed-off-by: Luka Trovic <luka@nextcloud.com>

Fix tests

Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
Luka Trovic
2022-02-28 10:39:04 +01:00
committed by backportbot[bot]
parent 84943c5889
commit 4e937bd03a
9 changed files with 104 additions and 10 deletions

View File

@@ -46,6 +46,7 @@ use OCA\Deck\BadRequestException;
use OCP\Comments\ICommentsManager;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\IUserManager;
use OCP\IURLGenerator;
class CardService {
private $cardMapper;
@@ -63,6 +64,7 @@ class CardService {
private $changeHelper;
private $eventDispatcher;
private $userManager;
private $urlGenerator;
public function __construct(
CardMapper $cardMapper,
@@ -79,6 +81,7 @@ class CardService {
IUserManager $userManager,
ChangeHelper $changeHelper,
IEventDispatcher $eventDispatcher,
IURLGenerator $urlGenerator,
$userId
) {
$this->cardMapper = $cardMapper;
@@ -96,6 +99,7 @@ class CardService {
$this->changeHelper = $changeHelper;
$this->eventDispatcher = $eventDispatcher;
$this->currentUser = $userId;
$this->urlGenerator = $urlGenerator;
}
public function enrich($card) {
@@ -602,4 +606,14 @@ class CardService {
$this->eventDispatcher->dispatchTyped(new CardUpdatedEvent($card));
}
public function getCardUrl($cardId) {
$boardId = $this->cardMapper->findBoardId($cardId);
return $this->urlGenerator->linkToRouteAbsolute('deck.page.index') . "#/board/$boardId/card/$cardId";
}
public function getRedirectUrlForCard($cardId) {
return $this->urlGenerator->linkToRouteAbsolute('deck.page.index') . "card/$cardId";
}
}