Files
nextcloud-workflow-deck-aut…/lib/Db/Workflow.php
T
Patrick Niebeling 578b235f08
Build package / unit-tests (push) Failing after 20s
Build package / xml-lint (push) Successful in 46s
Build package / php-lint (8.4) (push) Successful in 1m30s
Build package / php-lint (8.5) (push) Successful in 1m36s
Build package / package (push) Skipped
Notify board members about moved cards according to their Deck setting
Replaces the yes/no notify_email flag with notify_mode:
- off:   no mail
- owner: only the board owner, as before (migrated from notify_email=1)
- board: everyone with access to the board, filtered by their own Deck
         "Notifications" setting for it (board:<id>:notify-due: off /
         assigned / all), mirroring Deck's NotificationHelper rules

Recipients are resolved via PermissionService::findUsers() (owner, ACL,
groups and circles expanded), AssignmentMapper::isUserAssigned() and
IConfig, none of which reads Deck's frozen $userId. If they cannot be
resolved, no mail is sent rather than one to the wrong people.

Moved cards are collected over the whole run and each recipient gets a
single digest mail afterwards, in their own language.

Bumps to 35.2.0 so the migrations run.
2026-09-30 10:31:45 +02:00

64 lines
1.9 KiB
PHP

<?php
declare(strict_types=1);
namespace OCA\WorkflowDeckAutomation\Db;
use OCP\AppFramework\Db\Entity;
use OCP\DB\Types;
/**
* @method string getUserId()
* @method void setUserId(string $userId)
* @method string getTitle()
* @method void setTitle(string $title)
* @method int getBoardId()
* @method void setBoardId(int $boardId)
* @method int getSourceStackId()
* @method void setSourceStackId(int $sourceStackId)
* @method int getTargetStackId()
* @method void setTargetStackId(int $targetStackId)
* @method string getNotifyMode()
* @method void setNotifyMode(string $notifyMode)
* @method bool getEnabled()
* @method void setEnabled(bool $enabled)
* @method \DateTime|null getLastRun()
* @method void setLastRun(?\DateTime $lastRun)
*/
class Workflow extends Entity implements \JsonSerializable {
protected $userId;
protected $title;
protected $boardId;
protected $sourceStackId;
protected $targetStackId;
protected $notifyMode;
protected $enabled;
protected $lastRun;
public function __construct() {
$this->addType('id', Types::INTEGER);
$this->addType('userId', Types::STRING);
$this->addType('title', Types::STRING);
$this->addType('boardId', Types::INTEGER);
$this->addType('sourceStackId', Types::INTEGER);
$this->addType('targetStackId', Types::INTEGER);
$this->addType('notifyMode', Types::STRING);
$this->addType('enabled', Types::BOOLEAN);
$this->addType('lastRun', Types::DATETIME);
}
public function jsonSerialize(): array {
return [
'id' => $this->getId(),
'userId' => $this->getUserId(),
'title' => $this->getTitle(),
'boardId' => $this->getBoardId(),
'sourceStackId' => $this->getSourceStackId(),
'targetStackId' => $this->getTargetStackId(),
'notifyMode' => (string)$this->getNotifyMode(),
'enabled' => (bool)$this->getEnabled(),
'lastRun' => $this->getLastRun()?->format(\DateTimeInterface::ATOM),
];
}
}