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:
@@ -79,6 +79,10 @@ final class AphrontCursorPagerView extends AphrontView {
|
||||
return $results;
|
||||
}
|
||||
|
||||
final public function getHasMoreResults() {
|
||||
return $this->moreResults;
|
||||
}
|
||||
|
||||
public function willShowPagingControls() {
|
||||
return $this->prevPageID ||
|
||||
$this->nextPageID ||
|
||||
|
||||
@@ -94,6 +94,9 @@ final class PHUITimelineView extends AphrontView {
|
||||
$hide = 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) {
|
||||
if ($event->getHideByDefault()) {
|
||||
$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();
|
||||
if ($hide && $this->getPager()) {
|
||||
if ($more && $this->getPager()) {
|
||||
$uri = $this->getPager()->getNextPageURI();
|
||||
$uri->setQueryParam('quoteTargetID', $this->getQuoteTargetID());
|
||||
$uri->setQueryParam('quoteRef', $this->getQuoteRef());
|
||||
@@ -125,10 +138,10 @@ final class PHUITimelineView extends AphrontView {
|
||||
),
|
||||
pht('Show older changes.')),
|
||||
));
|
||||
}
|
||||
|
||||
if ($hide && $show) {
|
||||
$events[] = $spacer;
|
||||
if ($show) {
|
||||
$events[] = $spacer;
|
||||
}
|
||||
}
|
||||
|
||||
if ($show) {
|
||||
|
||||
Reference in New Issue
Block a user