mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-22 05:20:56 +01:00
Move PhameBlog to new phid stuff
Summary: Ref T2715 Test Plan: loaded phame and viewed all blogs link. did phid.query successfully Reviewers: epriestley Reviewed By: epriestley CC: aran, Korvin Maniphest Tasks: T2715 Differential Revision: https://secure.phabricator.com/D6578
This commit is contained in:
parent
e4e5f43a3e
commit
a07096daeb
7 changed files with 48 additions and 29 deletions
|
@ -1382,6 +1382,7 @@ phutil_register_library_map(array(
|
|||
'PhabricatorPeopleSearchEngine' => 'applications/people/query/PhabricatorPeopleSearchEngine.php',
|
||||
'PhabricatorPeopleTestDataGenerator' => 'applications/people/lipsum/PhabricatorPeopleTestDataGenerator.php',
|
||||
'PhabricatorPhameConfigOptions' => 'applications/phame/config/PhabricatorPhameConfigOptions.php',
|
||||
'PhabricatorPhamePHIDTypeBlog' => 'applications/phame/phid/PhabricatorPhamePHIDTypeBlog.php',
|
||||
'PhabricatorPholioConfigOptions' => 'applications/pholio/config/PhabricatorPholioConfigOptions.php',
|
||||
'PhabricatorPholioMockTestDataGenerator' => 'applications/pholio/lipsum/PhabricatorPholioMockTestDataGenerator.php',
|
||||
'PhabricatorPhortuneConfigOptions' => 'applications/phortune/option/PhabricatorPhortuneConfigOptions.php',
|
||||
|
@ -3415,6 +3416,7 @@ phutil_register_library_map(array(
|
|||
'PhabricatorPeopleSearchEngine' => 'PhabricatorApplicationSearchEngine',
|
||||
'PhabricatorPeopleTestDataGenerator' => 'PhabricatorTestDataGenerator',
|
||||
'PhabricatorPhameConfigOptions' => 'PhabricatorApplicationConfigOptions',
|
||||
'PhabricatorPhamePHIDTypeBlog' => 'PhabricatorPHIDType',
|
||||
'PhabricatorPholioConfigOptions' => 'PhabricatorApplicationConfigOptions',
|
||||
'PhabricatorPholioMockTestDataGenerator' => 'PhabricatorTestDataGenerator',
|
||||
'PhabricatorPhortuneConfigOptions' => 'PhabricatorApplicationConfigOptions',
|
||||
|
|
45
src/applications/phame/phid/PhabricatorPhamePHIDTypeBlog.php
Normal file
45
src/applications/phame/phid/PhabricatorPhamePHIDTypeBlog.php
Normal file
|
@ -0,0 +1,45 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @group phame
|
||||
*/
|
||||
final class PhabricatorPhamePHIDTypeBlog extends PhabricatorPHIDType {
|
||||
|
||||
const TYPECONST = 'BLOG';
|
||||
|
||||
public function getTypeConstant() {
|
||||
return self::TYPECONST;
|
||||
}
|
||||
|
||||
public function getTypeName() {
|
||||
return pht('Phame Blog');
|
||||
}
|
||||
|
||||
public function newObject() {
|
||||
return new PhameBlog();
|
||||
}
|
||||
|
||||
public function loadObjects(
|
||||
PhabricatorObjectQuery $query,
|
||||
array $phids) {
|
||||
|
||||
return id(new PhameBlogQuery())
|
||||
->setViewer($query->getViewer())
|
||||
->withPHIDs($phids)
|
||||
->execute();
|
||||
}
|
||||
|
||||
public function loadHandles(
|
||||
PhabricatorHandleQuery $query,
|
||||
array $handles,
|
||||
array $objects) {
|
||||
|
||||
foreach ($handles as $phid => $handle) {
|
||||
$blog = $objects[$phid];
|
||||
$handle->setName($blog->getName());
|
||||
$handle->setFullName($blog->getName());
|
||||
$handle->setURI('/phame/blog/view/'.$blog->getID().'/');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -37,7 +37,7 @@ final class PhameBlog extends PhameDAO
|
|||
|
||||
public function generatePHID() {
|
||||
return PhabricatorPHID::generateNewPHID(
|
||||
PhabricatorPHIDConstants::PHID_TYPE_BLOG);
|
||||
PhabricatorPhamePHIDTypeBlog::TYPECONST);
|
||||
}
|
||||
|
||||
public function getSkinRenderer(AphrontRequest $request) {
|
||||
|
|
|
@ -109,7 +109,6 @@ final class PhabricatorObjectHandle
|
|||
|
||||
static $map = array(
|
||||
PhabricatorPHIDConstants::PHID_TYPE_USER => 'User',
|
||||
PhabricatorPHIDConstants::PHID_TYPE_BLOG => 'Blog',
|
||||
PhabricatorPHIDConstants::PHID_TYPE_POST => 'Post',
|
||||
);
|
||||
|
||||
|
|
|
@ -14,7 +14,6 @@ final class PhabricatorPHIDConstants {
|
|||
const PHID_TYPE_OASA = 'OASA';
|
||||
const PHID_TYPE_POST = 'POST';
|
||||
const PHID_TYPE_TOBJ = 'TOBJ';
|
||||
const PHID_TYPE_BLOG = 'BLOG';
|
||||
const PHID_TYPE_ANSW = 'ANSW';
|
||||
const PHID_TYPE_ACNT = 'ACNT';
|
||||
const PHID_TYPE_PDCT = 'PDCT';
|
||||
|
|
|
@ -90,13 +90,6 @@ final class PhabricatorObjectHandleData {
|
|||
}
|
||||
return mpull($xactions, null, 'getPHID');
|
||||
|
||||
case PhabricatorPHIDConstants::PHID_TYPE_BLOG:
|
||||
$blogs = id(new PhameBlogQuery())
|
||||
->withPHIDs($phids)
|
||||
->setViewer($this->viewer)
|
||||
->execute();
|
||||
return mpull($blogs, null, 'getPHID');
|
||||
|
||||
case PhabricatorPHIDConstants::PHID_TYPE_POST:
|
||||
$posts = id(new PhamePostQuery())
|
||||
->withPHIDs($phids)
|
||||
|
@ -222,24 +215,6 @@ final class PhabricatorObjectHandleData {
|
|||
}
|
||||
break;
|
||||
|
||||
case PhabricatorPHIDConstants::PHID_TYPE_BLOG:
|
||||
foreach ($phids as $phid) {
|
||||
$handle = new PhabricatorObjectHandle();
|
||||
$handle->setPHID($phid);
|
||||
$handle->setType($type);
|
||||
if (empty($objects[$phid])) {
|
||||
$handle->setName('Unknown Blog');
|
||||
} else {
|
||||
$blog = $objects[$phid];
|
||||
$handle->setName($blog->getName());
|
||||
$handle->setFullName($blog->getName());
|
||||
$handle->setURI('/phame/blog/view/'.$blog->getID().'/');
|
||||
$handle->setComplete(true);
|
||||
}
|
||||
$handles[$phid] = $handle;
|
||||
}
|
||||
break;
|
||||
|
||||
case PhabricatorPHIDConstants::PHID_TYPE_POST:
|
||||
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_BLOG => 'PhameBlog',
|
||||
PhabricatorPHIDConstants::PHID_TYPE_POST => 'PhamePost',
|
||||
PhabricatorPHIDConstants::PHID_TYPE_ANSW => 'PonderAnswer',
|
||||
PhabricatorPHIDConstants::PHID_TYPE_ACNT => 'PhortuneAccount',
|
||||
|
|
Loading…
Reference in a new issue