1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-26 00:32:42 +01:00

Allow configuring fresh and stale revision age

Summary: People will want to configure/disable this.

Test Plan: Displayed Action Required, changed numbers to 0/0, 1/0, 0/30.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

Differential Revision: https://secure.phabricator.com/D3353
This commit is contained in:
vrana 2012-08-21 14:20:21 -07:00
parent 62a238c169
commit d2fbfaa4e8
2 changed files with 28 additions and 12 deletions

View file

@ -1021,6 +1021,15 @@ return array(
// use of all of differential's features. // use of all of differential's features.
'differential.allow-self-accept' => false, 'differential.allow-self-accept' => false,
// Revisions newer than this number of days are marked as fresh in Action
// Required and Revisions Waiting on You views. Only work days (not weekends
// and holidays) are included. Set to 0 to disable this feature.
'differential.days-fresh' => 1,
// Similar to 'differential.days-fresh' but marks stale revisions. If the
// revision is even older than it is marked as old.
'differential.days-stale' => 3,
// -- Maniphest ------------------------------------------------------------- // // -- Maniphest ------------------------------------------------------------- //
'maniphest.enabled' => true, 'maniphest.enabled' => true,

View file

@ -30,9 +30,6 @@ final class DifferentialRevisionListView extends AphrontView {
private $highlightAge; private $highlightAge;
const NO_DATA_STRING = 'No revisions found.'; const NO_DATA_STRING = 'No revisions found.';
const DAYS_FRESH = 1;
const DAYS_STALE = 3;
public function setFields(array $fields) { public function setFields(array $fields) {
assert_instances_of($fields, 'DifferentialFieldSpecification'); assert_instances_of($fields, 'DifferentialFieldSpecification');
$this->fields = $fields; $this->fields = $fields;
@ -100,13 +97,23 @@ final class DifferentialRevisionListView extends AphrontView {
throw new Exception("Call setUser() before render()!"); throw new Exception("Call setUser() before render()!");
} }
$fresh = null;
$stale = null;
if ($this->highlightAge) { if ($this->highlightAge) {
$fresh = PhabricatorEnv::getEnvConfig('differential.days-fresh');
if ($fresh) {
$fresh = PhabricatorCalendarHoliday::getNthBusinessDay( $fresh = PhabricatorCalendarHoliday::getNthBusinessDay(
time(), time(),
-self::DAYS_FRESH); -$fresh);
}
$stale = PhabricatorEnv::getEnvConfig('differential.days-stale');
if ($stale) {
$stale = PhabricatorCalendarHoliday::getNthBusinessDay( $stale = PhabricatorCalendarHoliday::getNthBusinessDay(
time(), time(),
-self::DAYS_STALE); -$stale);
}
} }
Javelin::initBehavior('phabricator-tooltips', array()); Javelin::initBehavior('phabricator-tooltips', array());
@ -163,11 +170,11 @@ final class DifferentialRevisionListView extends AphrontView {
$modified = $revision->getDateModified(); $modified = $revision->getDateModified();
foreach ($this->fields as $field) { foreach ($this->fields as $field) {
if ($this->highlightAge && if (($fresh || $stale) &&
$field instanceof DifferentialDateModifiedFieldSpecification) { $field instanceof DifferentialDateModifiedFieldSpecification) {
if ($modified < $stale) { if ($stale && $modified < $stale) {
$class = 'revision-age-old'; $class = 'revision-age-old';
} else if ($modified < $fresh) { } else if ($fresh && $modified < $fresh) {
$class = 'revision-age-stale'; $class = 'revision-age-stale';
} else { } else {
$class = 'revision-age-fresh'; $class = 'revision-age-fresh';