1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-02-16 16:58:38 +01:00

Clean up a couple more URI alter() calls

Summary:
See <https://discourse.phabricator-community.org/t/create-new-phriction-document-fails-with-unhandled-exception-invalidargumentexception/2406>.

These weren't obviously nullable from a cursory `grep`, but are sometimes nullable in practice.

Test Plan: Created, then saved a new Phriction document.

Reviewers: amckinley

Reviewed By: amckinley

Differential Revision: https://secure.phabricator.com/D20184
This commit is contained in:
epriestley 2019-02-15 13:57:25 -08:00
parent c5772f51de
commit b09cf166a8
2 changed files with 23 additions and 5 deletions

View file

@ -229,9 +229,14 @@ final class PhrictionTransactionEditor
foreach ($xactions as $xaction) {
switch ($xaction->getTransactionType()) {
case PhrictionDocumentContentTransaction::TRANSACTIONTYPE:
$uri = id(new PhutilURI('/phriction/diff/'.$object->getID().'/'))
->alter('l', $this->getOldContent()->getVersion())
->alter('r', $this->getNewContent()->getVersion());
$params = array(
'l' => $this->getOldContent()->getVersion(),
'r' => $this->getNewContent()->getVersion(),
);
$path = '/phriction/diff/'.$object->getID().'/';
$uri = new PhutilURI($path, $params);
$this->contentDiffURI = (string)$uri;
break 2;
default:

View file

@ -154,8 +154,21 @@ final class PHUITimelineView extends AphrontView {
}
$uri = $this->getPager()->getNextPageURI();
$uri->replaceQueryParam('quoteTargetID', $this->getQuoteTargetID());
$uri->replaceQueryParam('quoteRef', $this->getQuoteRef());
$target_id = $this->getQuoteTargetID();
if ($target_id === null) {
$uri->removeQueryParam('quoteTargetID');
} else {
$uri->replaceQueryParam('quoteTargetID', $target_id);
}
$quote_ref = $this->getQuoteRef();
if ($quote_ref === null) {
$uri->removeQueryParam('quoteRef');
} else {
$uri->replaceQueryParam('quoteRef', $quote_ref);
}
$events[] = javelin_tag(
'div',
array(