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.
64 lines
1.9 KiB
PHP
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),
|
|
];
|
|
}
|
|
}
|