Hide inactive boards, keep source and target stack apart, make the interval configurable
Build package / php-lint (8.2) (push) Successful in 46s
Build package / php-lint (8.3) (push) Successful in 40s
Build package / php-lint (8.4) (push) Successful in 35s
Build package / xml-lint (push) Successful in 13s
Build package / unit-tests (push) Successful in 46s
Build package / package (push) Successful in 1m3s

- Boards: BoardService::getUserBoards() defaults to $includeArchived = true,
  and that flag also gates the `deleted_at = 0` condition, so archived and
  trashed boards showed up in the dropdown. Request the filtered query
  instead, with a fallback to the no-arg call if the signature ever changes.
  Stacks need nothing: StackMapper::findAll() always filters deleted_at.
- Each stack dropdown now hides whatever the other one holds, so source and
  target can no longer be set to the same stack. The save-time check stays
  as the backstop for rows stored before this rule.
- RunWorkflowsJob reads its interval from config.php
  ('workflow_deck_automation.interval', seconds, default 300, clamped to a
  60s minimum). TimedJob re-reads the interval on every cron pass, so a
  changed value takes effect without any occ command.
This commit is contained in:
Patrick Niebeling
2026-08-13 14:33:28 +02:00
parent 8f3e3e694a
commit 13903f8137
5 changed files with 69 additions and 7 deletions
+25 -1
View File
@@ -8,18 +8,42 @@ use OCA\WorkflowDeckAutomation\Service\WorkflowRunner;
use OCP\AppFramework\Utility\ITimeFactory;
use OCP\BackgroundJob\IJob;
use OCP\BackgroundJob\TimedJob;
use OCP\IConfig;
class RunWorkflowsJob extends TimedJob {
/**
* config.php key holding how often (in seconds) workflows are checked.
*/
public const INTERVAL_CONFIG_KEY = 'workflow_deck_automation.interval';
public const DEFAULT_INTERVAL = 5 * 60;
/**
* Nextcloud's cron itself only ticks every 5 minutes by default, so
* anything below a minute would only add load without running more
* often. Values under this are clamped rather than rejected.
*/
public const MINIMUM_INTERVAL = 60;
public function __construct(
ITimeFactory $time,
IConfig $config,
private WorkflowRunner $runner,
) {
parent::__construct($time);
$this->setInterval(5 * 60);
// TimedJob compares against this value on every cron pass, so a
// changed config.php takes effect on the next pass — no occ command
// and no re-registration of the job needed.
$this->setInterval(self::resolveInterval($config));
$this->setTimeSensitivity(IJob::TIME_INSENSITIVE);
$this->setAllowParallelRuns(false);
}
private static function resolveInterval(IConfig $config): int {
$interval = $config->getSystemValueInt(self::INTERVAL_CONFIG_KEY, self::DEFAULT_INTERVAL);
return max(self::MINIMUM_INTERVAL, $interval);
}
protected function run($argument): void {
$this->runner->run();
}
+13 -1
View File
@@ -60,7 +60,19 @@ class DeckIntegrationService {
*/
public function listBoardsForCurrentUser(): array {
$boards = $this->call(function () {
return $this->resolve(BoardService::class)->getUserBoards();
$boardService = $this->resolve(BoardService::class);
try {
// getUserBoards(?int $since, bool $includeArchived, …): with
// the default $includeArchived = true, Deck skips the
// `archived = false AND deleted_at = 0` conditions entirely,
// so archived *and* trashed boards come back. Ask for the
// filtered query instead of sorting them out afterwards.
return $boardService->getUserBoards(null, false);
} catch (Throwable $e) {
// Older/newer Deck with a different signature: fall back to
// the unfiltered call, isBoardHidden() below still filters.
return $boardService->getUserBoards();
}
}, []);
// Deck merges own/group/circle boards, so the same board can come