mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-18 12:52:42 +01:00
Raise human-readable error messages for overlong Phame blog titles and subtitles
Summary: Fixes T11358. Entering a too-long title/subtitle currently raises an unfriendly (database-level) error. Raise a friendlier error. Test Plan: {F1731533} Reviewers: chad Reviewed By: chad Maniphest Tasks: T11358 Differential Revision: https://secure.phabricator.com/D16313
This commit is contained in:
parent
56bd762dd3
commit
c27ba19da3
1 changed files with 27 additions and 0 deletions
|
@ -160,6 +160,33 @@ final class PhameBlogEditor
|
|||
$error->setIsMissingFieldError(true);
|
||||
$errors[] = $error;
|
||||
}
|
||||
|
||||
foreach ($xactions as $xaction) {
|
||||
$new = $xaction->getNewValue();
|
||||
if (phutil_utf8_strlen($new) > 64) {
|
||||
$errors[] = new PhabricatorApplicationTransactionValidationError(
|
||||
$type,
|
||||
pht('Invalid'),
|
||||
pht(
|
||||
'The selected blog title is too long. The maximum length '.
|
||||
'of a blog title is 64 characters.'),
|
||||
$xaction);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case PhameBlogTransaction::TYPE_SUBTITLE:
|
||||
foreach ($xactions as $xaction) {
|
||||
$new = $xaction->getNewValue();
|
||||
if (phutil_utf8_strlen($new) > 64) {
|
||||
$errors[] = new PhabricatorApplicationTransactionValidationError(
|
||||
$type,
|
||||
pht('Invalid'),
|
||||
pht(
|
||||
'The selected blog subtitle is too long. The maximum length '.
|
||||
'of a blog subtitle is 64 characters.'),
|
||||
$xaction);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case PhameBlogTransaction::TYPE_PARENTDOMAIN:
|
||||
if (!$xactions) {
|
||||
|
|
Loading…
Reference in a new issue