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

Fix "reply" link in Differential

Summary:
Fixes the issue caused by rPa0af5b66437719dba6136579c051982ab275e6a0. Prior to
that patch, isCommentInNewFile() returned $comment->getIsNewFile(). While this
was often the wrong value, it came from the database and was the integer 1 if
true.

After the patch, the function returns 'true' as a boolean, which is passed to JS
and then back to PHP, interpreted as an integer, and evaluates to 0.

To avoid this issue in general, provide an isBool() method on AphrontRequest
which interprets this correctly.

I will also revert the revert of rPa0af5b66437719dba6136579c051982ab275e6a0 when
I land this.

Test Plan:
Clicked "reply" on the right hand side of a diff, got a right-hand-side inline
comment.

Reviewed By: rm
Reviewers: tuomaspelkonen, jungejason, aran, rm
CC: simpkins, aran, epriestley, rm
Differential Revision: 250
This commit is contained in:
epriestley 2011-05-07 10:42:40 -07:00
parent 3ee7b5380e
commit 3ab334af93
2 changed files with 16 additions and 2 deletions

View file

@ -68,6 +68,20 @@ class AphrontRequest {
}
}
final public function getBool($name, $default = null) {
if (isset($this->requestData[$name])) {
if ($this->requestData[$name] === 'true') {
return true;
} else if ($this->requestData[$name] === 'false') {
return false;
} else {
return (bool)$this->requestData[$name];
}
} else {
return $default;
}
}
final public function getStr($name, $default = null) {
if (isset($this->requestData[$name])) {
$str = (string)$this->requestData[$name];

View file

@ -28,8 +28,8 @@ class DifferentialInlineCommentEditController extends DifferentialController {
$request = $this->getRequest();
$changeset = $request->getInt('changeset');
$is_new = $request->getInt('is_new');
$on_right = $request->getInt('on_right');
$is_new = $request->getBool('is_new');
$on_right = $request->getBool('on_right');
$number = $request->getInt('number');
$length = $request->getInt('length');
$text = $request->getStr('text');