Page MenuHomePhabricator

D15028.id36298.diff
No OneTemporary

D15028.id36298.diff

diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -1201,6 +1201,7 @@
'HeraldTranscriptDestructionEngineExtension' => 'applications/herald/engineextension/HeraldTranscriptDestructionEngineExtension.php',
'HeraldTranscriptGarbageCollector' => 'applications/herald/garbagecollector/HeraldTranscriptGarbageCollector.php',
'HeraldTranscriptListController' => 'applications/herald/controller/HeraldTranscriptListController.php',
+ 'HeraldTranscriptPHIDType' => 'applications/herald/phid/HeraldTranscriptPHIDType.php',
'HeraldTranscriptQuery' => 'applications/herald/query/HeraldTranscriptQuery.php',
'HeraldTranscriptSearchEngine' => 'applications/herald/query/HeraldTranscriptSearchEngine.php',
'HeraldTranscriptTestCase' => 'applications/herald/storage/__tests__/HeraldTranscriptTestCase.php',
@@ -5297,6 +5298,7 @@
'HeraldTranscriptDestructionEngineExtension' => 'PhabricatorDestructionEngineExtension',
'HeraldTranscriptGarbageCollector' => 'PhabricatorGarbageCollector',
'HeraldTranscriptListController' => 'HeraldController',
+ 'HeraldTranscriptPHIDType' => 'PhabricatorPHIDType',
'HeraldTranscriptQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
'HeraldTranscriptSearchEngine' => 'PhabricatorApplicationSearchEngine',
'HeraldTranscriptTestCase' => 'PhabricatorTestCase',
diff --git a/src/applications/herald/phid/HeraldTranscriptPHIDType.php b/src/applications/herald/phid/HeraldTranscriptPHIDType.php
new file mode 100644
--- /dev/null
+++ b/src/applications/herald/phid/HeraldTranscriptPHIDType.php
@@ -0,0 +1,42 @@
+<?php
+
+final class HeraldTranscriptPHIDType extends PhabricatorPHIDType {
+
+ const TYPECONST = 'HLXS';
+
+ public function getTypeName() {
+ return pht('Herald Transcript');
+ }
+
+ public function newObject() {
+ return new HeraldTranscript();
+ }
+
+ public function getPHIDTypeApplicationClass() {
+ return 'PhabricatorHeraldApplication';
+ }
+
+ protected function buildQueryForObjects(
+ PhabricatorObjectQuery $query,
+ array $phids) {
+
+ return id(new HeraldTranscriptQuery())
+ ->withPHIDs($phids);
+ }
+
+ public function loadHandles(
+ PhabricatorHandleQuery $query,
+ array $handles,
+ array $objects) {
+
+ foreach ($handles as $phid => $handle) {
+ $xscript = $objects[$phid];
+
+ $id = $xscript->getID();
+
+ $handle->setName(pht('Transcript %s', $id));
+ $handle->setURI("/herald/transcript/${id}/");
+ }
+ }
+
+}
diff --git a/src/applications/herald/query/HeraldTranscriptQuery.php b/src/applications/herald/query/HeraldTranscriptQuery.php
--- a/src/applications/herald/query/HeraldTranscriptQuery.php
+++ b/src/applications/herald/query/HeraldTranscriptQuery.php
@@ -4,6 +4,7 @@
extends PhabricatorCursorPagedPolicyAwareQuery {
private $ids;
+ private $phids;
private $objectPHIDs;
private $needPartialRecords;
@@ -12,6 +13,11 @@
return $this;
}
+ public function withPHIDs(array $phids) {
+ $this->phids = $phids;
+ return $this;
+ }
+
public function withObjectPHIDs(array $phids) {
$this->objectPHIDs = $phids;
return $this;
@@ -95,6 +101,13 @@
$this->ids);
}
+ if ($this->phids) {
+ $where[] = qsprintf(
+ $conn_r,
+ 'phid IN (%Ls)',
+ $this->phids);
+ }
+
if ($this->objectPHIDs) {
$where[] = qsprintf(
$conn_r,
diff --git a/src/applications/herald/storage/transcript/HeraldTranscript.php b/src/applications/herald/storage/transcript/HeraldTranscript.php
--- a/src/applications/herald/storage/transcript/HeraldTranscript.php
+++ b/src/applications/herald/storage/transcript/HeraldTranscript.php
@@ -190,7 +190,8 @@
}
public function generatePHID() {
- return PhabricatorPHID::generateNewPHID('HLXS');
+ return PhabricatorPHID::generateNewPHID(
+ HeraldTranscriptPHIDType::TYPECONST);
}
/* -( PhabricatorPolicyInterface )----------------------------------------- */

File Metadata

Mime Type
text/plain
Expires
Fri, Feb 28, 3:11 AM (32 m, 6 s)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7213191
Default Alt Text
D15028.id36298.diff (4 KB)

Event Timeline