1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-19 12:00:55 +01:00

Fix handling of implicit comment transaction in paste creation

Summary:
Fixes T9850. The `getComment()` test should be a `hasComment()` test, in order to discard empty comments.

Also backport a couple of future fixes which can get you into trouble if you reconfigure forms in awkward ways.

Test Plan: Created a new paste without a comment.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T9850

Differential Revision: https://secure.phabricator.com/D14571
This commit is contained in:
epriestley 2015-11-25 08:21:24 -08:00
parent c4ea1e6e21
commit b219285999
2 changed files with 15 additions and 3 deletions

View file

@ -320,7 +320,13 @@ abstract class PhabricatorEditField extends Phobject {
}
protected function getValueExistsInSubmit(AphrontRequest $request, $key) {
return $this->getHTTPParameterType()->getExists($request, $key);
$type = $this->getHTTPParameterType();
if ($type) {
return $type->getExists($request, $key);
}
return false;
}
protected function getValueFromSubmit(AphrontRequest $request, $key) {
@ -328,7 +334,13 @@ abstract class PhabricatorEditField extends Phobject {
}
protected function getDefaultValue() {
return $this->getHTTPParameterType()->getDefaultValue();
$type = $this->getHTTPParameterType();
if ($type) {
return $type->getDefaultValue();
}
return null;
}
final public function getHTTPParameterType() {

View file

@ -1888,7 +1888,7 @@ abstract class PhabricatorApplicationTransactionEditor
}
foreach ($no_effect as $key => $xaction) {
if ($xaction->getComment()) {
if ($xaction->hasComment()) {
$xaction->setTransactionType($type_comment);
$xaction->setOldValue(null);
$xaction->setNewValue(null);