Skip to content

Commit 6e2b0ca

Browse files
committed
Add validation for when feedname already exists
1 parent 493e6f1 commit 6e2b0ca

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

application/forms/FeedForm.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,15 @@ protected function assemble(): void
5252
$validator->addMessage($this->translate('The name must only contain alphanumeric characters'));
5353
return false;
5454
}
55-
5655
return true;
57-
})
56+
}),
57+
new CallbackValidator(function (string $value, CallbackValidator $validator) {
58+
if ($this->storage->getFeedByName($value) !== null) {
59+
$validator->addMessage($this->translate(sprintf("A feed with the name %s already exists", $value)));
60+
return false;
61+
}
62+
return true;
63+
}),
5864
],
5965
]);
6066

0 commit comments

Comments
 (0)