Send moved-card notices as Nextcloud notifications too
Build package / xml-lint (push) Successful in 33s
Build package / php-lint (8.5) (push) Successful in 1m48s
Build package / php-lint (8.4) (push) Successful in 1m50s
Build package / unit-tests (push) Successful in 1m52s
Build package / package (push) Successful in 1m38s

Each workflow now has a notify channel (mail, notification or both) next
to its recipient mode. Notifications go out per card through
OCP\Notification\IManager, so they show up in the bell and as push on the
mobile and desktop clients. Without the notifications app nothing is sent.
The one-off "workflow disabled" notice is sent as a notification as well.

Existing workflows keep mail (migration Version1004). Bumps to 35.3.0 so
the migration runs.
This commit is contained in:
Patrick Niebeling committed 2026-09-30 12:31:01 +02:00
1 parent 35903772eb
commit 7612344726
19 files changed
+585 -70

No files matched your search

+25 -1
View File
@@ -5,7 +5,7 @@ declare(strict_types=1);
namespace OCA\WorkflowDeckAutomation\Service;
/**
* Who gets a mail about a moved card — pure logic, no Nextcloud or Deck
* Who hears about a moved card, and how — pure logic, no Nextcloud or Deck
* dependencies, so it is unit-testable like WorkflowRunner::isOverdue().
*/
class NotificationPolicy {
@@ -18,6 +18,14 @@ class NotificationPolicy {
public const MODES = [self::MODE_OFF, self::MODE_OWNER, self::MODE_BOARD];
/** One mail per recipient and run. */
public const CHANNEL_MAIL = 'mail';
/** One Nextcloud notification (bell, push to the mobile apps) per card. */
public const CHANNEL_NOTIFICATION = 'notification';
public const CHANNEL_BOTH = 'both';
public const CHANNELS = [self::CHANNEL_MAIL, self::CHANNEL_NOTIFICATION, self::CHANNEL_BOTH];
/**
* Values of Deck's per-user, per-board preference
* `deck` / `board:<boardId>:notify-due` (Deck's
@@ -36,6 +44,22 @@ class NotificationPolicy {
return in_array($mode, self::MODES, true);
}
public static function isValidChannel(string $channel): bool {
return in_array($channel, self::CHANNELS, true);
}
/**
* An unknown channel counts as `mail`, the column default — mail was the
* only channel before the column existed.
*/
public static function sendsMail(string $channel): bool {
return $channel !== self::CHANNEL_NOTIFICATION;
}
public static function sendsNotification(string $channel): bool {
return $channel === self::CHANNEL_NOTIFICATION || $channel === self::CHANNEL_BOTH;
}
/**
* Mirrors Deck's own decision in NotificationHelper::sendCardDuedate():
*