Skip to content

Commit

Permalink
Fix handling of implicit comment transaction in paste creation
Browse files Browse the repository at this point in the history
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
  • Loading branch information
epriestley committed Nov 25, 2015
1 parent c4ea1e6 commit b219285
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
16 changes: 14 additions & 2 deletions src/applications/transactions/editfield/PhabricatorEditField.php
Expand Up @@ -320,15 +320,27 @@ public function readValueFromSubmit(AphrontRequest $request) {
}

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) {
return $this->getHTTPParameterType()->getValue($request, $key);
}

protected function getDefaultValue() {
return $this->getHTTPParameterType()->getDefaultValue();
$type = $this->getHTTPParameterType();

if ($type) {
return $type->getDefaultValue();
}

return null;
}

final public function getHTTPParameterType() {
Expand Down
Expand Up @@ -1888,7 +1888,7 @@ protected function filterTransactions(
}

foreach ($no_effect as $key => $xaction) {
if ($xaction->getComment()) {
if ($xaction->hasComment()) {
$xaction->setTransactionType($type_comment);
$xaction->setOldValue(null);
$xaction->setNewValue(null);
Expand Down

0 comments on commit b219285

Please sign in to comment.