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
|
@ -160,6 +160,33 @@ final class PhameBlogEditor
|
||||||
$error->setIsMissingFieldError(true);
|
$error->setIsMissingFieldError(true);
|
||||||
$errors[] = $error;
|
$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;
|
break;
|
||||||
case PhameBlogTransaction::TYPE_PARENTDOMAIN:
|
case PhameBlogTransaction::TYPE_PARENTDOMAIN:
|
||||||
if (!$xactions) {
|
if (!$xactions) {
|
||||||
|
|
Loading…
Reference in a new issue