1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-26 15:30:58 +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.
'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.enabled' => true,

View file

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