From b09cf166a8bde2283b2de2fc3803b605430d8aa3 Mon Sep 17 00:00:00 2001 From: epriestley Date: Fri, 15 Feb 2019 13:57:25 -0800 Subject: [PATCH] Clean up a couple more URI alter() calls Summary: See . 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 --- .../editor/PhrictionTransactionEditor.php | 11 ++++++++--- src/view/phui/PHUITimelineView.php | 17 +++++++++++++++-- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/src/applications/phriction/editor/PhrictionTransactionEditor.php b/src/applications/phriction/editor/PhrictionTransactionEditor.php index d09ff5d556..1476b24c46 100644 --- a/src/applications/phriction/editor/PhrictionTransactionEditor.php +++ b/src/applications/phriction/editor/PhrictionTransactionEditor.php @@ -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: diff --git a/src/view/phui/PHUITimelineView.php b/src/view/phui/PHUITimelineView.php index d8c06d6a9f..2e6d8298c8 100644 --- a/src/view/phui/PHUITimelineView.php +++ b/src/view/phui/PHUITimelineView.php @@ -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(