1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-02-02 09:58:24 +01:00

Restore fields to Releeph from prior to CustomField patch

Summary: See notes / inlines.

Test Plan: See inlines.

Reviewers: wez, btrahan

Reviewed By: btrahan

CC: btrahan, aran

Differential Revision: https://secure.phabricator.com/D6831
This commit is contained in:
epriestley 2013-08-28 13:06:29 -07:00
parent 55e2efc6fc
commit 5138bf8bff
3 changed files with 162 additions and 55 deletions

View file

@ -2,7 +2,50 @@
final class ReleephDefaultFieldSelector extends ReleephFieldSelector {
/**
* Determine if this install is Facebook.
*
* TODO: This is a giant hacky mess because I am dumb and moved forward on
* Releeph changes with partial information. Recover from this as gracefully
* as possible. This obivously is an abomination. -epriestley
*/
public static function isFacebook() {
try {
class_exists('ReleephFacebookKarmaFieldSpecification');
return true;
} catch (Exception $ex) {
return false;
}
}
/**
* @phutil-external-symbol class ReleephFacebookKarmaFieldSpecification
* @phutil-external-symbol class ReleephFacebookSeverityFieldSpecification
* @phutil-external-symbol class ReleephFacebookTagFieldSpecification
* @phutil-external-symbol class ReleephFacebookTasksFieldSpecification
*/
public function getFieldSpecifications() {
if (self::isFacebook()) {
return array(
new ReleephCommitMessageFieldSpecification(),
new ReleephSummaryFieldSpecification(),
new ReleephReasonFieldSpecification(),
new ReleephAuthorFieldSpecification(),
new ReleephRevisionFieldSpecification(),
new ReleephRequestorFieldSpecification(),
new ReleephFacebookKarmaFieldSpecification(),
new ReleephFacebookSeverityFieldSpecification(),
new ReleephOriginalCommitFieldSpecification(),
new ReleephDiffMessageFieldSpecification(),
new ReleephStatusFieldSpecification(),
new ReleephIntentFieldSpecification(),
new ReleephBranchCommitFieldSpecification(),
new ReleephDiffSizeFieldSpecification(),
new ReleephDiffChurnFieldSpecification(),
new ReleephFacebookTagFieldSpecification(),
new ReleephFacebookTasksFieldSpecification(),
);
} else {
return array(
new ReleephCommitMessageFieldSpecification(),
new ReleephSummaryFieldSpecification(),
@ -20,8 +63,43 @@ final class ReleephDefaultFieldSelector extends ReleephFieldSelector {
new ReleephDiffChurnFieldSpecification(),
);
}
}
public function arrangeFieldsForHeaderView(array $fields) {
if (self::isFacebook()) {
return array(
// Top group
array(
'left' => self::selectFields($fields, array(
'ReleephAuthorFieldSpecification',
'ReleephRevisionFieldSpecification',
'ReleephOriginalCommitFieldSpecification',
'ReleephDiffSizeFieldSpecification',
'ReleephDiffChurnFieldSpecification',
'ReleephFacebookTasksFieldSpecification',
)),
'right' => self::selectFields($fields, array(
'ReleephRequestorFieldSpecification',
'ReleephFacebookKarmaFieldSpecification',
'ReleephFacebookSeverityFieldSpecification',
'ReleephFacebookTagFieldSpecification',
'ReleephStatusFieldSpecification',
'ReleephIntentFieldSpecification',
'ReleephBranchCommitFieldSpecification',
))
),
// Bottom group
array(
'left' => self::selectFields($fields, array(
'ReleephDiffMessageFieldSpecification',
)),
'right' => self::selectFields($fields, array(
'ReleephReasonFieldSpecification',
))
)
);
} else {
return array(
// Top group
array(
@ -52,14 +130,24 @@ final class ReleephDefaultFieldSelector extends ReleephFieldSelector {
)
);
}
}
public function arrangeFieldsForSelectForm(array $fields) {
if (self::isFacebook()) {
return self::selectFields($fields, array(
'ReleephStatusFieldSpecification',
'ReleephFacebookSeverityFieldSpecification',
'ReleephRequestorFieldSpecification',
'ReleephFacebookTagFieldSpecification',
));
} else {
return self::selectFields($fields, array(
'ReleephStatusFieldSpecification',
'ReleephSeverityFieldSpecification',
'ReleephRequestorFieldSpecification',
));
}
}
public function sortFieldsForCommitMessage(array $fields) {
return self::selectFields($fields, array(

View file

@ -117,7 +117,15 @@ final class ReleephRequestQuery
if ($this->severities) {
$severities = array_fuse($this->severities);
foreach ($requests as $key => $request) {
if (empty($severities[$request->getDetail('releeph:severity')])) {
// NOTE: Facebook uses a custom field here.
if (ReleephDefaultFieldSelector::isFacebook()) {
$severity = $request->getDetail('severity');
} else {
$severity = $request->getDetail('releeph:severity');
}
if (empty($severities[$severity])) {
unset($requests[$key]);
}
}

View file

@ -148,11 +148,22 @@ final class ReleephRequestSearchEngine
}
private function getSeverityOptions() {
if (ReleephDefaultFieldSelector::isFacebook()) {
return array(
'' => pht('(All Severities)'),
11 => 'HOTFIX',
12 => 'PIGGYBACK',
13 => 'RELEASE',
14 => 'DAILY',
15 => 'PARKING',
);
} else {
return array(
'' => pht('(All Severities)'),
ReleephSeverityFieldSpecification::HOTFIX => pht('Hotfix'),
ReleephSeverityFieldSpecification::RELEASE => pht('Release'),
);
}
}
}