mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-30 01:10:58 +01:00
Show "Show Older" for transactions the user has not interacted with
Summary: Fixes T7454. We weren't triggering "Show Older" unless there were hidden events because of a previous interaction. Test Plan: - Set page size to 3. - Viewed a task with ~10 transactions. - Before patch: - Only 3 most recent transactions visible, no way to see older ones. - Saw "show older" appear, paged backward through transaction histroy. - Also, interacted with task and then viewed it, made sure "show older" still works. Reviewers: btrahan Reviewed By: btrahan Subscribers: epriestley Maniphest Tasks: T7454 Differential Revision: https://secure.phabricator.com/D11963
This commit is contained in:
parent
85cc15b56d
commit
b09168e689
2 changed files with 21 additions and 4 deletions
|
@ -79,6 +79,10 @@ final class AphrontCursorPagerView extends AphrontView {
|
||||||
return $results;
|
return $results;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final public function getHasMoreResults() {
|
||||||
|
return $this->moreResults;
|
||||||
|
}
|
||||||
|
|
||||||
public function willShowPagingControls() {
|
public function willShowPagingControls() {
|
||||||
return $this->prevPageID ||
|
return $this->prevPageID ||
|
||||||
$this->nextPageID ||
|
$this->nextPageID ||
|
||||||
|
|
|
@ -94,6 +94,9 @@ final class PHUITimelineView extends AphrontView {
|
||||||
$hide = array();
|
$hide = array();
|
||||||
$show = array();
|
$show = array();
|
||||||
|
|
||||||
|
// Bucket timeline events into events we'll hide by default (because they
|
||||||
|
// predate your most recent interaction with the object) and events we'll
|
||||||
|
// show by default.
|
||||||
foreach ($this->events as $event) {
|
foreach ($this->events as $event) {
|
||||||
if ($event->getHideByDefault()) {
|
if ($event->getHideByDefault()) {
|
||||||
$hide[] = $event;
|
$hide[] = $event;
|
||||||
|
@ -102,8 +105,18 @@ final class PHUITimelineView extends AphrontView {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If you've never interacted with the object, all the events will be shown
|
||||||
|
// by default. We may still need to paginate if there are a large number
|
||||||
|
// of events.
|
||||||
|
$more = (bool)$hide;
|
||||||
|
if ($this->getPager()) {
|
||||||
|
if ($this->getPager()->getHasMoreResults()) {
|
||||||
|
$more = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$events = array();
|
$events = array();
|
||||||
if ($hide && $this->getPager()) {
|
if ($more && $this->getPager()) {
|
||||||
$uri = $this->getPager()->getNextPageURI();
|
$uri = $this->getPager()->getNextPageURI();
|
||||||
$uri->setQueryParam('quoteTargetID', $this->getQuoteTargetID());
|
$uri->setQueryParam('quoteTargetID', $this->getQuoteTargetID());
|
||||||
$uri->setQueryParam('quoteRef', $this->getQuoteRef());
|
$uri->setQueryParam('quoteRef', $this->getQuoteRef());
|
||||||
|
@ -125,10 +138,10 @@ final class PHUITimelineView extends AphrontView {
|
||||||
),
|
),
|
||||||
pht('Show older changes.')),
|
pht('Show older changes.')),
|
||||||
));
|
));
|
||||||
}
|
|
||||||
|
|
||||||
if ($hide && $show) {
|
if ($show) {
|
||||||
$events[] = $spacer;
|
$events[] = $spacer;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($show) {
|
if ($show) {
|
||||||
|
|
Loading…
Reference in a new issue