mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-22 06:42:42 +01:00
Restrict maximum task title length to 255 characters
Summary: A task title is supposed to summarize a task. For long novels, there is the task description. Closes T15898 Test Plan: Go to http://phorge.localhost/maniphest/task/edit/form/default/ and enter a task title with multi-byte characters above the threshold, press "Enter". Reviewers: O1 Blessed Committers, valerio.bozzolan Reviewed By: O1 Blessed Committers, valerio.bozzolan Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno Maniphest Tasks: T15898 Differential Revision: https://we.phorge.it/D25759
This commit is contained in:
parent
d8b94dd87d
commit
62aaa0fcbe
1 changed files with 8 additions and 0 deletions
|
@ -4,6 +4,7 @@ final class ManiphestTaskTitleTransaction
|
||||||
extends ManiphestTaskTransactionType {
|
extends ManiphestTaskTransactionType {
|
||||||
|
|
||||||
const TRANSACTIONTYPE = 'title';
|
const TRANSACTIONTYPE = 'title';
|
||||||
|
private $maximumTaskTitleLength = 255;
|
||||||
|
|
||||||
public function generateOldValue($object) {
|
public function generateOldValue($object) {
|
||||||
return $object->getTitle();
|
return $object->getTitle();
|
||||||
|
@ -78,6 +79,13 @@ final class ManiphestTaskTitleTransaction
|
||||||
$xaction);
|
$xaction);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if (mb_strlen($new) > $this->maximumTaskTitleLength) {
|
||||||
|
$errors[] = $this->newInvalidError(
|
||||||
|
pht('Task title cannot exceed %d characters.',
|
||||||
|
$this->maximumTaskTitleLength),
|
||||||
|
$xaction);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$errors) {
|
if (!$errors) {
|
||||||
|
|
Loading…
Reference in a new issue