fix: harden backend synchronization

This commit is contained in:
Marek Miklewicz
2026-06-02 21:06:25 +02:00
parent 4b531a4c24
commit 64b62a5793
20 changed files with 254 additions and 16 deletions
+3 -1
View File
@@ -9,7 +9,9 @@ return static function (AppContext $ctx): void {
if ($rule === null) {
throw new RuntimeException($ctx->t('Rule not found'));
}
$ctx->rules->update($ctx->daUser->username(), $id, ['enabled' => empty($rule['enabled'])]);
$next = ['enabled' => empty($rule['enabled'])];
enforce_rule_backend_constraints($ctx, $id, $next);
$ctx->rules->update($ctx->daUser->username(), $id, $next);
$ctx->syncActiveBackend();
Http::redirect($ctx->url('index.html', ['status' => 'toggled']));
};