1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-09-20 09:18:48 +02: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:
epriestley 2015-03-04 10:36:01 -08:00
parent 85cc15b56d
commit b09168e689
2 changed files with 21 additions and 4 deletions

View file

@ -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 ||

View file

@ -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,11 +138,11 @@ final class PHUITimelineView extends AphrontView {
),
pht('Show older changes.')),
));
}
if ($hide && $show) {
if ($show) {
$events[] = $spacer;
}
}
if ($show) {
$events[] = phutil_implode_html($spacer, $show);