1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-01-10 14:51:06 +01:00

(stable) Promote 2018 Week 29

This commit is contained in:
epriestley 2018-07-20 16:27:13 -07:00
commit 6f8ce2bc90
20 changed files with 181 additions and 66 deletions

View file

@ -211,9 +211,14 @@ final class PhabricatorConduitAPIController
->withIsActive(true)
->executeOne();
if (!$stored_key) {
$key_summary = id(new PhutilUTF8StringTruncator())
->setMaximumBytes(64)
->truncateString($raw_key);
return array(
'ERR-INVALID-AUTH',
pht('No user or device is associated with that public key.'),
pht(
'No user or device is associated with the public key "%s".',
$key_summary),
);
}

View file

@ -20,13 +20,22 @@ final class PhabricatorDashboardPanelDatasource
return $this->filterResultsAgainstTokens($results);
}
protected function renderSpecialTokens(array $values) {
return $this->renderTokensFromResults($this->buildResults(), $values);
}
public function buildResults() {
$query = id(new PhabricatorDashboardPanelQuery());
$query = new PhabricatorDashboardPanelQuery();
$raw_query = $this->getRawQuery();
if (preg_match('/^[wW]\d+\z/', $raw_query)) {
$id = trim($raw_query, 'wW');
$id = (int)$id;
$query->withIDs(array($id));
} else {
$query->withNameNgrams($raw_query);
}
$panels = $this->executeQuery($query);
$results = array();

View file

@ -33,7 +33,7 @@ final class DifferentialRevisionDependedOnByRevisionEdgeType
$add_edges) {
return pht(
'%s added %s dependent revision(s): %s.',
'%s added %s child revision(s): %s.',
$actor,
$add_count,
$add_edges);
@ -45,7 +45,7 @@ final class DifferentialRevisionDependedOnByRevisionEdgeType
$rem_edges) {
return pht(
'%s removed %s dependent revision(s): %s.',
'%s removed %s child revision(s): %s.',
$actor,
$rem_count,
$rem_edges);
@ -60,7 +60,7 @@ final class DifferentialRevisionDependedOnByRevisionEdgeType
$rem_edges) {
return pht(
'%s edited dependent revision(s), added %s: %s; removed %s: %s.',
'%s edited child revision(s), added %s: %s; removed %s: %s.',
$actor,
$add_count,
$add_edges,
@ -75,7 +75,7 @@ final class DifferentialRevisionDependedOnByRevisionEdgeType
$add_edges) {
return pht(
'%s added %s dependent revision(s) for %s: %s.',
'%s added %s child revision(s) for %s: %s.',
$actor,
$add_count,
$object,
@ -89,7 +89,7 @@ final class DifferentialRevisionDependedOnByRevisionEdgeType
$rem_edges) {
return pht(
'%s removed %s dependent revision(s) for %s: %s.',
'%s removed %s child revision(s) for %s: %s.',
$actor,
$rem_count,
$object,
@ -106,7 +106,7 @@ final class DifferentialRevisionDependedOnByRevisionEdgeType
$rem_edges) {
return pht(
'%s edited dependent revision(s) for %s, added %s: %s; removed %s: %s.',
'%s edited child revision(s) for %s, added %s: %s; removed %s: %s.',
$actor,
$object,
$add_count,

View file

@ -36,7 +36,7 @@ final class DifferentialRevisionDependsOnRevisionEdgeType
$add_edges) {
return pht(
'%s added %s dependencie(s): %s.',
'%s added %s parent revision(s): %s.',
$actor,
$add_count,
$add_edges);
@ -48,7 +48,7 @@ final class DifferentialRevisionDependsOnRevisionEdgeType
$rem_edges) {
return pht(
'%s removed %s dependencie(s): %s.',
'%s removed %s parent revision(s): %s.',
$actor,
$rem_count,
$rem_edges);
@ -63,7 +63,7 @@ final class DifferentialRevisionDependsOnRevisionEdgeType
$rem_edges) {
return pht(
'%s edited dependencie(s), added %s: %s; removed %s: %s.',
'%s edited parent revision(s), added %s: %s; removed %s: %s.',
$actor,
$add_count,
$add_edges,
@ -78,7 +78,7 @@ final class DifferentialRevisionDependsOnRevisionEdgeType
$add_edges) {
return pht(
'%s added %s dependencie(s) for %s: %s.',
'%s added %s parent revision(s) for %s: %s.',
$actor,
$add_count,
$object,
@ -92,7 +92,7 @@ final class DifferentialRevisionDependsOnRevisionEdgeType
$rem_edges) {
return pht(
'%s removed %s dependencie(s) for %s: %s.',
'%s removed %s parent revision(s) for %s: %s.',
$actor,
$rem_count,
$object,
@ -109,7 +109,7 @@ final class DifferentialRevisionDependsOnRevisionEdgeType
$rem_edges) {
return pht(
'%s edited dependencie(s) for %s, added %s: %s; removed %s: %s.',
'%s edited parent revision(s) for %s, added %s: %s; removed %s: %s.',
$actor,
$object,
$add_count,

View file

@ -1148,6 +1148,10 @@ final class DifferentialRevision extends DifferentialDAO
->setKey('summary')
->setType('string')
->setDescription(pht('Revision summary.')),
id(new PhabricatorConduitSearchFieldSpecification())
->setKey('testPlan')
->setType('string')
->setDescription(pht('Revision test plan.')),
);
}
@ -1167,6 +1171,7 @@ final class DifferentialRevision extends DifferentialDAO
'repositoryPHID' => $this->getRepositoryPHID(),
'diffPHID' => $this->getActiveDiffPHID(),
'summary' => $this->getSummary(),
'testPlan' => $this->getTestPlan(),
);
}

View file

@ -86,4 +86,12 @@ final class DifferentialRevisionAbandonTransaction
$this->renderObject());
}
public function getTransactionTypeForConduit($xaction) {
return 'abandon';
}
public function getFieldValuesForConduit($object, $data) {
return array();
}
}

View file

@ -234,4 +234,12 @@ final class DifferentialRevisionAcceptTransaction
$this->renderObject());
}
public function getTransactionTypeForConduit($xaction) {
return 'accept';
}
public function getFieldValuesForConduit($object, $data) {
return array();
}
}

View file

@ -154,5 +154,4 @@ final class DifferentialRevisionCloseTransaction
);
}
}

View file

@ -87,4 +87,12 @@ final class DifferentialRevisionCommandeerTransaction
$this->renderObject());
}
public function getTransactionTypeForConduit($xaction) {
return 'commandeer';
}
public function getFieldValuesForConduit($object, $data) {
return array();
}
}

View file

@ -119,4 +119,12 @@ final class DifferentialRevisionPlanChangesTransaction
return (bool)$this->getMetadataValue('draft.demote');
}
public function getTransactionTypeForConduit($xaction) {
return 'plan-changes';
}
public function getFieldValuesForConduit($object, $data) {
return array();
}
}

View file

@ -85,4 +85,12 @@ final class DifferentialRevisionReclaimTransaction
$this->renderObject());
}
public function getTransactionTypeForConduit($xaction) {
return 'reclaim';
}
public function getFieldValuesForConduit($object, $data) {
return array();
}
}

View file

@ -99,4 +99,12 @@ final class DifferentialRevisionRejectTransaction
$this->renderObject());
}
public function getTransactionTypeForConduit($xaction) {
return 'request-changes';
}
public function getFieldValuesForConduit($object, $data) {
return array();
}
}

View file

@ -72,4 +72,12 @@ final class DifferentialRevisionReopenTransaction
$this->renderObject());
}
public function getTransactionTypeForConduit($xaction) {
return 'reopen';
}
public function getFieldValuesForConduit($object, $data) {
return array();
}
}

View file

@ -84,4 +84,12 @@ final class DifferentialRevisionRequestReviewTransaction
$this->renderObject());
}
public function getTransactionTypeForConduit($xaction) {
return 'request-review';
}
public function getFieldValuesForConduit($object, $data) {
return array();
}
}

View file

@ -93,4 +93,12 @@ final class DifferentialRevisionResignTransaction
$this->renderObject());
}
public function getTransactionTypeForConduit($xaction) {
return 'resign';
}
public function getFieldValuesForConduit($object, $data) {
return array();
}
}

View file

@ -85,22 +85,23 @@ final class TransactionSearchConduitAPIMethod
$xactions = $xaction_query->executeWithCursorPager($pager);
$comment_map = array();
if ($xactions) {
$template = head($xactions)->getApplicationTransactionCommentObject();
if ($template) {
$query = new PhabricatorApplicationTransactionTemplatedCommentQuery();
$query = new PhabricatorApplicationTransactionTemplatedCommentQuery();
$comment_map = $query
->setViewer($viewer)
->setTemplate($template)
->withTransactionPHIDs(mpull($xactions, 'getPHID'))
->execute();
$comment_map = $query
->setViewer($viewer)
->setTemplate($template)
->withTransactionPHIDs(mpull($xactions, 'getPHID'))
->execute();
$comment_map = msort($comment_map, 'getCommentVersion');
$comment_map = array_reverse($comment_map);
$comment_map = mgroup($comment_map, 'getTransactionPHID');
} else {
$comment_map = array();
$comment_map = msort($comment_map, 'getCommentVersion');
$comment_map = array_reverse($comment_map);
$comment_map = mgroup($comment_map, 'getTransactionPHID');
}
}
$modular_classes = array();

View file

@ -38,9 +38,6 @@ options:
phabricator/ $ ./bin/webhook call --id 42 --object D123
```
You can use a tool like [[ https://requestb.in | RequestBin ]] to inspect
the headers and payload for calls to hooks.
Verifying Requests
==================
@ -157,6 +154,20 @@ Hooks that are interested in changes should generally make a call to
`transaction.search`, passing the transaction PHIDs as a constraint to retrieve
details about the transactions.
For example, your call to `transaction.search` may look something like this:
```lang=json
{
"objectIdentifier": "PHID-XXXX-abcdef",
"constraints": {
"phids": [
"PHID-XACT-XXXX-11111111",
"PHID-XACT-XXXX-22222222"
]
}
}
```
The `phid.query` method can also be used to retrieve generic information about
a list of objects.

View file

@ -221,6 +221,10 @@ final class PhabricatorEnv extends Phobject {
foreach ($site_sources as $site_source) {
$stack->pushSource($site_source);
// If the site source did anything which reads config, throw it away
// to make sure any additional site sources get clean reads.
self::dropConfigCache();
}
$masters = PhabricatorDatabaseRef::getMasterDatabaseRefs();
@ -259,6 +263,10 @@ final class PhabricatorEnv extends Phobject {
throw $ex;
}
}
// Drop the config cache one final time to make sure we're getting clean
// reads now that we've finished building the stack.
self::dropConfigCache();
}
public static function repairConfig($key, $value) {

View file

@ -595,70 +595,80 @@ final class PhabricatorUSEnglishTranslation
'%s changed files, attached: %3$s; detached: %5$s.',
'%s added %s dependencie(s): %s.' => array(
'%s added %s parent revision(s): %s.' => array(
array(
'%s added a dependency: %3$s.',
'%s added dependencies: %3$s.',
'%s added a parent revision: %3$s.',
'%s added parent revisions: %3$s.',
),
),
'%s added %s dependencie(s) for %s: %s.' => array(
'%s added %s parent revision(s) for %s: %s.' => array(
array(
'%s added a dependency for %3$s: %4$s.',
'%s added dependencies for %3$s: %4$s.',
'%s added a parent revision for %3$s: %4$s.',
'%s added parent revisions for %3$s: %4$s.',
),
),
'%s removed %s dependencie(s): %s.' => array(
'%s removed %s parent revision(s): %s.' => array(
array(
'%s removed a dependency: %3$s.',
'%s removed dependencies: %3$s.',
'%s removed a parent revision: %3$s.',
'%s removed parent revisions: %3$s.',
),
),
'%s removed %s dependencie(s) for %s: %s.' => array(
'%s removed %s parent revision(s) for %s: %s.' => array(
array(
'%s removed a dependency for %3$s: %4$s.',
'%s removed dependencies for %3$s: %4$s.',
'%s removed a parent revision for %3$s: %4$s.',
'%s removed parent revisions for %3$s: %4$s.',
),
),
'%s edited dependencie(s), added %s: %s; removed %s: %s.' => array(
'%s edited dependencies, added: %3$s; removed: %5$s.',
'%s edited parent revision(s), added %s: %s; removed %s: %s.' => array(
'%s edited parent revisions, added: %3$s; removed: %5$s.',
),
'%s edited dependencie(s) for %s, added %s: %s; removed %s: %s.' => array(
'%s edited dependencies for %s, added: %3$s; removed: %5$s.',
'%s edited parent revision(s) for %s, '.
'added %s: %s; removed %s: %s.' => array(
'%s edited parent revisions for %s, added: %3$s; removed: %5$s.',
),
'%s added %s dependent revision(s): %s.' => array(
'%s added %s child revision(s): %s.' => array(
array(
'%s added a dependent revision: %3$s.',
'%s added dependent revisions: %3$s.',
'%s added a child revision: %3$s.',
'%s added child revisions: %3$s.',
),
),
'%s added %s dependent revision(s) for %s: %s.' => array(
'%s added %s child revision(s) for %s: %s.' => array(
array(
'%s added a dependent revision for %3$s: %4$s.',
'%s added dependent revisions for %3$s: %4$s.',
'%s added a child revision for %3$s: %4$s.',
'%s added child revisions for %3$s: %4$s.',
),
),
'%s removed %s dependent revision(s): %s.' => array(
'%s removed %s child revision(s): %s.' => array(
array(
'%s removed a dependent revision: %3$s.',
'%s removed dependent revisions: %3$s.',
'%s removed a child revision: %3$s.',
'%s removed child revisions: %3$s.',
),
),
'%s removed %s dependent revision(s) for %s: %s.' => array(
'%s removed %s child revision(s) for %s: %s.' => array(
array(
'%s removed a dependent revision for %3$s: %4$s.',
'%s removed dependent revisions for %3$s: %4$s.',
'%s removed a child revision for %3$s: %4$s.',
'%s removed child revisions for %3$s: %4$s.',
),
),
'%s edited child revision(s), added %s: %s; removed %s: %s.' => array(
'%s edited child revisions, added: %3$s; removed: %5$s.',
),
'%s edited child revision(s) for %s, '.
'added %s: %s; removed %s: %s.' => array(
'%s edited child revisions for %s, added: %3$s; removed: %5$s.',
),
'%s added %s commit(s): %s.' => array(
array(
'%s added a commit: %3$s.',

View file

@ -103,10 +103,9 @@ for (ii = 0; ii < config.servers.length; ii++) {
if (spec['ssl.cert']){
spec['ssl.cert'] = fs.readFileSync(spec['ssl.cert']);
}
if (spec['ssl.chain']){
spec['ssl.chain'] = fs.readFileSync(spec['ssl.chain']);
if (spec['ssl.chain']){
spec['ssl.cert'] += "\n" + fs.readFileSync(spec['ssl.chain']);
}
}
servers.push(spec);
@ -140,10 +139,6 @@ for (ii = 0; ii < servers.length; ii++) {
cert: server['ssl.cert'],
};
if (server['ssl.chain']) {
https_config.ca = server['ssl.chain'];
}
http_server = https.createServer(https_config);
} else {
http_server = http.createServer();