mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-21 21:10:56 +01:00
Move PhamePost to new phid stuff
Summary: Ref T2715 Test Plan: phid.query and a brief phame post read Reviewers: epriestley Reviewed By: epriestley CC: aran, Korvin Maniphest Tasks: T2715 Differential Revision: https://secure.phabricator.com/D6579
This commit is contained in:
parent
a07096daeb
commit
1457797c4a
7 changed files with 48 additions and 29 deletions
|
@ -1383,6 +1383,7 @@ phutil_register_library_map(array(
|
|||
'PhabricatorPeopleTestDataGenerator' => 'applications/people/lipsum/PhabricatorPeopleTestDataGenerator.php',
|
||||
'PhabricatorPhameConfigOptions' => 'applications/phame/config/PhabricatorPhameConfigOptions.php',
|
||||
'PhabricatorPhamePHIDTypeBlog' => 'applications/phame/phid/PhabricatorPhamePHIDTypeBlog.php',
|
||||
'PhabricatorPhamePHIDTypePost' => 'applications/phame/phid/PhabricatorPhamePHIDTypePost.php',
|
||||
'PhabricatorPholioConfigOptions' => 'applications/pholio/config/PhabricatorPholioConfigOptions.php',
|
||||
'PhabricatorPholioMockTestDataGenerator' => 'applications/pholio/lipsum/PhabricatorPholioMockTestDataGenerator.php',
|
||||
'PhabricatorPhortuneConfigOptions' => 'applications/phortune/option/PhabricatorPhortuneConfigOptions.php',
|
||||
|
@ -3417,6 +3418,7 @@ phutil_register_library_map(array(
|
|||
'PhabricatorPeopleTestDataGenerator' => 'PhabricatorTestDataGenerator',
|
||||
'PhabricatorPhameConfigOptions' => 'PhabricatorApplicationConfigOptions',
|
||||
'PhabricatorPhamePHIDTypeBlog' => 'PhabricatorPHIDType',
|
||||
'PhabricatorPhamePHIDTypePost' => 'PhabricatorPHIDType',
|
||||
'PhabricatorPholioConfigOptions' => 'PhabricatorApplicationConfigOptions',
|
||||
'PhabricatorPholioMockTestDataGenerator' => 'PhabricatorTestDataGenerator',
|
||||
'PhabricatorPhortuneConfigOptions' => 'PhabricatorApplicationConfigOptions',
|
||||
|
|
45
src/applications/phame/phid/PhabricatorPhamePHIDTypePost.php
Normal file
45
src/applications/phame/phid/PhabricatorPhamePHIDTypePost.php
Normal file
|
@ -0,0 +1,45 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @group phame
|
||||
*/
|
||||
final class PhabricatorPhamePHIDTypePost extends PhabricatorPHIDType {
|
||||
|
||||
const TYPECONST = 'POST';
|
||||
|
||||
public function getTypeConstant() {
|
||||
return self::TYPECONST;
|
||||
}
|
||||
|
||||
public function getTypeName() {
|
||||
return pht('Phame Post');
|
||||
}
|
||||
|
||||
public function newObject() {
|
||||
return new PhamePost();
|
||||
}
|
||||
|
||||
public function loadObjects(
|
||||
PhabricatorObjectQuery $query,
|
||||
array $phids) {
|
||||
|
||||
return id(new PhamePostQuery())
|
||||
->setViewer($query->getViewer())
|
||||
->withPHIDs($phids)
|
||||
->execute();
|
||||
}
|
||||
|
||||
public function loadHandles(
|
||||
PhabricatorHandleQuery $query,
|
||||
array $handles,
|
||||
array $objects) {
|
||||
|
||||
foreach ($handles as $phid => $handle) {
|
||||
$post = $objects[$phid];
|
||||
$handle->setName($post->getTitle());
|
||||
$handle->setFullName($post->getTitle());
|
||||
$handle->setURI('/phame/post/view/'.$post->getID().'/');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -81,7 +81,7 @@ final class PhamePost extends PhameDAO
|
|||
|
||||
public function generatePHID() {
|
||||
return PhabricatorPHID::generateNewPHID(
|
||||
PhabricatorPHIDConstants::PHID_TYPE_POST);
|
||||
PhabricatorPhamePHIDTypePost::TYPECONST);
|
||||
}
|
||||
|
||||
public static function getVisibilityOptionsForSelect() {
|
||||
|
|
|
@ -109,7 +109,6 @@ final class PhabricatorObjectHandle
|
|||
|
||||
static $map = array(
|
||||
PhabricatorPHIDConstants::PHID_TYPE_USER => 'User',
|
||||
PhabricatorPHIDConstants::PHID_TYPE_POST => 'Post',
|
||||
);
|
||||
|
||||
return idx($map, $this->getType(), $this->getType());
|
||||
|
|
|
@ -12,7 +12,6 @@ final class PhabricatorPHIDConstants {
|
|||
const PHID_TYPE_DRYL = 'DRYL';
|
||||
const PHID_TYPE_OASC = 'OASC';
|
||||
const PHID_TYPE_OASA = 'OASA';
|
||||
const PHID_TYPE_POST = 'POST';
|
||||
const PHID_TYPE_TOBJ = 'TOBJ';
|
||||
const PHID_TYPE_ANSW = 'ANSW';
|
||||
const PHID_TYPE_ACNT = 'ACNT';
|
||||
|
|
|
@ -90,13 +90,6 @@ final class PhabricatorObjectHandleData {
|
|||
}
|
||||
return mpull($xactions, null, 'getPHID');
|
||||
|
||||
case PhabricatorPHIDConstants::PHID_TYPE_POST:
|
||||
$posts = id(new PhamePostQuery())
|
||||
->withPHIDs($phids)
|
||||
->setViewer($this->viewer)
|
||||
->execute();
|
||||
return mpull($posts, null, 'getPHID');
|
||||
|
||||
}
|
||||
|
||||
return array();
|
||||
|
@ -215,24 +208,6 @@ final class PhabricatorObjectHandleData {
|
|||
}
|
||||
break;
|
||||
|
||||
case PhabricatorPHIDConstants::PHID_TYPE_POST:
|
||||
foreach ($phids as $phid) {
|
||||
$handle = new PhabricatorObjectHandle();
|
||||
$handle->setPHID($phid);
|
||||
$handle->setType($type);
|
||||
if (empty($objects[$phid])) {
|
||||
$handle->setName('Unknown Post');
|
||||
} else {
|
||||
$post = $objects[$phid];
|
||||
$handle->setName($post->getTitle());
|
||||
$handle->setFullName($post->getTitle());
|
||||
$handle->setURI('/phame/post/view/'.$post->getID().'/');
|
||||
$handle->setComplete(true);
|
||||
}
|
||||
$handles[$phid] = $handle;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
foreach ($phids as $phid) {
|
||||
$handle = new PhabricatorObjectHandle();
|
||||
|
|
|
@ -156,7 +156,6 @@ final class PhabricatorEdgeConfig extends PhabricatorEdgeConstants {
|
|||
static $class_map = array(
|
||||
PhabricatorPHIDConstants::PHID_TYPE_USER => 'PhabricatorUser',
|
||||
PhabricatorPHIDConstants::PHID_TYPE_TOBJ => 'HarbormasterObject',
|
||||
PhabricatorPHIDConstants::PHID_TYPE_POST => 'PhamePost',
|
||||
PhabricatorPHIDConstants::PHID_TYPE_ANSW => 'PonderAnswer',
|
||||
PhabricatorPHIDConstants::PHID_TYPE_ACNT => 'PhortuneAccount',
|
||||
PhabricatorPHIDConstants::PHID_TYPE_PRCH => 'PhortunePurchase',
|
||||
|
|
Loading…
Reference in a new issue