Link the card title instead of an extra button in the mail

The plain-text part gets the card URL on its own line. Bumps to 35.2.2.
This commit is contained in:
Patrick Niebeling committed 2026-09-30 11:05:22 +02:00
1 parent 30e644a001
commit b10cb08ba5
3 files changed
+26 -13

No files matched your search

+1 -1
View File
@@ -24,7 +24,7 @@ This app lets every user configure Deck automation workflows for the boards they
A background job periodically evaluates all enabled workflows and moves cards whose due date has passed, using Deck's own internal PHP classes only (no HTTP/OCS calls). A background job periodically evaluates all enabled workflows and moves cards whose due date has passed, using Deck's own internal PHP classes only (no HTTP/OCS calls).
]]></description> ]]></description>
<version>35.2.1</version> <version>35.2.2</version>
<licence>agpl</licence> <licence>agpl</licence>
<author mail="patrick@niebel.ing">Patrick Niebeling</author> <author mail="patrick@niebel.ing">Patrick Niebeling</author>
<namespace>WorkflowDeckAutomation</namespace> <namespace>WorkflowDeckAutomation</namespace>
+24 -11
View File
@@ -98,21 +98,34 @@ class NotificationMailer {
* @param array{board: string, sourceStack: string, targetStack: string} $targets * @param array{board: string, sourceStack: string, targetStack: string} $targets
*/ */
private function addCard(IEMailTemplate $template, Workflow $workflow, Card $card, array $targets): void { private function addCard(IEMailTemplate $template, Workflow $workflow, Card $card, array $targets): void {
// Single-argument addBodyText() runs htmlspecialchars() itself, so // The card description and the workflow's name are deliberately left
// these card-, workflow-, board- and stack-titles (user input) are // out — the mail only says what moved where. The card title itself is
// safe as-is. The card description and the workflow's name are // the link to the card.
// deliberately left out — the mail only says what moved where. $sentence = '„%1$s“ (Board „%2$s“) ist überfällig und wurde von „%3$s“ nach „%4$s“ verschoben.';
$template->addBodyText(sprintf( $url = $this->urlGenerator->getAbsoluteURL('/apps/deck/board/' . $workflow->getBoardId() . '/card/' . $card->getId());
'„%1$s“ (Board „%2$s“) ist überfällig und wurde von „%3$s“ nach „%4$s“ verschoben.',
// With both parts passed, addBodyText() escapes nothing: every title
// is user input and has to be escaped here for the HTML part.
$html = sprintf(
$sentence,
'<a href="' . self::escape($url) . '">' . self::escape($card->getTitle()) . '</a>',
self::escape($targets['board']),
self::escape($targets['sourceStack']),
self::escape($targets['targetStack']),
);
$plain = sprintf(
$sentence,
$card->getTitle(), $card->getTitle(),
$targets['board'], $targets['board'],
$targets['sourceStack'], $targets['sourceStack'],
$targets['targetStack'], $targets['targetStack'],
)); ) . PHP_EOL . $url;
$template->addBodyButton(
'Karte öffnen', $template->addBodyText($html, $plain);
$this->urlGenerator->getAbsoluteURL('/apps/deck/board/' . $workflow->getBoardId() . '/card/' . $card->getId()), }
);
private static function escape(string $text): string {
return htmlspecialchars($text, ENT_QUOTES, 'UTF-8');
} }
/** /**
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "workflow_deck_automation", "name": "workflow_deck_automation",
"version": "35.2.1", "version": "35.2.2",
"private": true, "private": true,
"type": "module", "type": "module",
"description": "Automates moving overdue Deck cards between stacks, configurable per user.", "description": "Automates moving overdue Deck cards between stacks, configurable per user.",