Notifications: Do not use rich text for board/card

Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
Julius Härtl
2017-10-01 18:12:17 +02:00
committed by Julius Härtl
parent e8ecfce134
commit ed55b0db51
2 changed files with 15 additions and 28 deletions

View File

@@ -49,8 +49,7 @@ class Notifier implements INotifier {
IURLGenerator $url,
IUserManager $userManager,
CardMapper $cardMapper,
BoardMapper $boardMapper,
Definitions $definitions
BoardMapper $boardMapper
) {
$this->l10nFactory = $l10nFactory;
$this->url = $url;
@@ -67,10 +66,10 @@ class Notifier implements INotifier {
* @since 9.0.0
*/
public function prepare(INotification $notification, $languageCode) {
$l = $this->l10nFactory->get('deck', $languageCode);
if($notification->getApp() !== 'deck') {
throw new \InvalidArgumentException();
}
$l = $this->l10nFactory->get('deck', $languageCode);
$notification->setIcon($this->url->getAbsoluteURL($this->url->imagePath('deck', 'deck-dark.svg')));
$params = $notification->getSubjectParameters();
@@ -79,28 +78,13 @@ class Notifier implements INotifier {
$cardId = $notification->getObjectId();
$boardId = $this->cardMapper->findBoardId($cardId);
$notification->setParsedSubject(
(string) $l->t('The card "%s" on "%s" has reached its due date.', $notification->getSubjectParameters())
);
$notification->setRichSubject(
(string) $l->t('The card {card} on {board} has reached its due date.'),
[
'card' => [
'id' => null,
'type' => 'announcement',
'name' => $params[0],
],
'board' => [
'id' => null,
'type' => 'announcement',
'name' => $params[1],
],
]
(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.'');
break;
case 'board-shared':
$boardId = $notification->getObjectId();
$initiator = \OC::$server->getUserManager()->get($params[1]);
$initiator = $this->userManager->get($params[1]);
if($initiator !== null) {
$dn = $initiator->getDisplayName();
} else {
@@ -108,19 +92,15 @@ class Notifier implements INotifier {
}
$notification->setParsedSubject(
(string) $l->t('The board "%s" has been shared with you by %s.', [$params[0], $dn])
)->setRichSubject(
(string) $l->t('{user} has shared the board {board} with you.'),
);
$notification->setRichSubject(
(string) $l->t('{user} has shared the board %s with you.', [$params[0]]),
[
'user' => [
'type' => 'user',
'id' => $params[1],
'name' => $dn,
],
'board' => [
'id' => null,
'type' => 'announcement',
'name' => $params[0],
],
]
]
);
$notification->setLink($this->url->linkToRouteAbsolute('deck.page.index') . '#!/board/'.$boardId.'/');