Link the card title instead of an extra button in the mail
Build package / xml-lint (push) Successful in 1m14s
Build package / php-lint (8.4) (push) Successful in 2m14s
Build package / php-lint (8.5) (push) Successful in 2m15s
Build package / unit-tests (push) Successful in 2m17s
Build package / package (push) Successful in 59s

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 ebf48b0707
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).
]]></description>
<version>35.2.1</version>
<version>35.2.2</version>
<licence>agpl</licence>
<author mail="patrick@niebel.ing">Patrick Niebeling</author>
<namespace>WorkflowDeckAutomation</namespace>
+24 -11
View File
@@ -98,21 +98,34 @@ class NotificationMailer {
* @param array{board: string, sourceStack: string, targetStack: string} $targets
*/
private function addCard(IEMailTemplate $template, Workflow $workflow, Card $card, array $targets): void {
// Single-argument addBodyText() runs htmlspecialchars() itself, so
// these card-, workflow-, board- and stack-titles (user input) are
// safe as-is. The card description and the workflow's name are
// deliberately left out — the mail only says what moved where.
$template->addBodyText(sprintf(
'„%1$s“ (Board „%2$s“) ist überfällig und wurde von „%3$s“ nach „%4$s“ verschoben.',
// The card description and the workflow's name are deliberately left
// out — the mail only says what moved where. The card title itself is
// the link to the card.
$sentence = '„%1$s“ (Board „%2$s“) ist überfällig und wurde von „%3$s“ nach „%4$s“ verschoben.';
$url = $this->urlGenerator->getAbsoluteURL('/apps/deck/board/' . $workflow->getBoardId() . '/card/' . $card->getId());
// 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(),
$targets['board'],
$targets['sourceStack'],
$targets['targetStack'],
));
$template->addBodyButton(
'Karte öffnen',
$this->urlGenerator->getAbsoluteURL('/apps/deck/board/' . $workflow->getBoardId() . '/card/' . $card->getId()),
);
) . PHP_EOL . $url;
$template->addBodyText($html, $plain);
}
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",
"version": "35.2.1",
"version": "35.2.2",
"private": true,
"type": "module",
"description": "Automates moving overdue Deck cards between stacks, configurable per user.",