mirror of
https://we.phorge.it/source/phorge.git
synced 2025-02-02 18:08:26 +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:
parent
55e2efc6fc
commit
5138bf8bff
3 changed files with 162 additions and 55 deletions
|
@ -2,7 +2,50 @@
|
||||||
|
|
||||||
final class ReleephDefaultFieldSelector extends ReleephFieldSelector {
|
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() {
|
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(
|
return array(
|
||||||
new ReleephCommitMessageFieldSpecification(),
|
new ReleephCommitMessageFieldSpecification(),
|
||||||
new ReleephSummaryFieldSpecification(),
|
new ReleephSummaryFieldSpecification(),
|
||||||
|
@ -20,8 +63,43 @@ final class ReleephDefaultFieldSelector extends ReleephFieldSelector {
|
||||||
new ReleephDiffChurnFieldSpecification(),
|
new ReleephDiffChurnFieldSpecification(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public function arrangeFieldsForHeaderView(array $fields) {
|
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(
|
return array(
|
||||||
// Top group
|
// Top group
|
||||||
array(
|
array(
|
||||||
|
@ -52,14 +130,24 @@ final class ReleephDefaultFieldSelector extends ReleephFieldSelector {
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public function arrangeFieldsForSelectForm(array $fields) {
|
public function arrangeFieldsForSelectForm(array $fields) {
|
||||||
|
if (self::isFacebook()) {
|
||||||
|
return self::selectFields($fields, array(
|
||||||
|
'ReleephStatusFieldSpecification',
|
||||||
|
'ReleephFacebookSeverityFieldSpecification',
|
||||||
|
'ReleephRequestorFieldSpecification',
|
||||||
|
'ReleephFacebookTagFieldSpecification',
|
||||||
|
));
|
||||||
|
} else {
|
||||||
return self::selectFields($fields, array(
|
return self::selectFields($fields, array(
|
||||||
'ReleephStatusFieldSpecification',
|
'ReleephStatusFieldSpecification',
|
||||||
'ReleephSeverityFieldSpecification',
|
'ReleephSeverityFieldSpecification',
|
||||||
'ReleephRequestorFieldSpecification',
|
'ReleephRequestorFieldSpecification',
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public function sortFieldsForCommitMessage(array $fields) {
|
public function sortFieldsForCommitMessage(array $fields) {
|
||||||
return self::selectFields($fields, array(
|
return self::selectFields($fields, array(
|
||||||
|
|
|
@ -117,7 +117,15 @@ final class ReleephRequestQuery
|
||||||
if ($this->severities) {
|
if ($this->severities) {
|
||||||
$severities = array_fuse($this->severities);
|
$severities = array_fuse($this->severities);
|
||||||
foreach ($requests as $key => $request) {
|
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]);
|
unset($requests[$key]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -148,11 +148,22 @@ final class ReleephRequestSearchEngine
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getSeverityOptions() {
|
private function getSeverityOptions() {
|
||||||
|
if (ReleephDefaultFieldSelector::isFacebook()) {
|
||||||
|
return array(
|
||||||
|
'' => pht('(All Severities)'),
|
||||||
|
11 => 'HOTFIX',
|
||||||
|
12 => 'PIGGYBACK',
|
||||||
|
13 => 'RELEASE',
|
||||||
|
14 => 'DAILY',
|
||||||
|
15 => 'PARKING',
|
||||||
|
);
|
||||||
|
} else {
|
||||||
return array(
|
return array(
|
||||||
'' => pht('(All Severities)'),
|
'' => pht('(All Severities)'),
|
||||||
ReleephSeverityFieldSpecification::HOTFIX => pht('Hotfix'),
|
ReleephSeverityFieldSpecification::HOTFIX => pht('Hotfix'),
|
||||||
ReleephSeverityFieldSpecification::RELEASE => pht('Release'),
|
ReleephSeverityFieldSpecification::RELEASE => pht('Release'),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue