1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-01-02 19:01:03 +01:00

Move Conpherence Threads to new phid stuff

Summary: Ref T2715.

Test Plan: loaded conpherence, loaded a different thread, made a conpherence. also phid.query

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

Maniphest Tasks: T2715

Differential Revision: https://secure.phabricator.com/D6577
This commit is contained in:
Bob Trahan 2013-07-26 12:07:47 -07:00
parent 0a71593e6d
commit e4e5f43a3e
7 changed files with 53 additions and 34 deletions

View file

@ -989,6 +989,7 @@ phutil_register_library_map(array(
'PhabricatorConfigTransaction' => 'applications/config/storage/PhabricatorConfigTransaction.php', 'PhabricatorConfigTransaction' => 'applications/config/storage/PhabricatorConfigTransaction.php',
'PhabricatorConfigTransactionQuery' => 'applications/config/query/PhabricatorConfigTransactionQuery.php', 'PhabricatorConfigTransactionQuery' => 'applications/config/query/PhabricatorConfigTransactionQuery.php',
'PhabricatorConfigValidationException' => 'applications/config/exception/PhabricatorConfigValidationException.php', 'PhabricatorConfigValidationException' => 'applications/config/exception/PhabricatorConfigValidationException.php',
'PhabricatorConpherencePHIDTypeThread' => 'applications/conpherence/phid/PhabricatorConpherencePHIDTypeThread.php',
'PhabricatorContentSource' => 'applications/metamta/contentsource/PhabricatorContentSource.php', 'PhabricatorContentSource' => 'applications/metamta/contentsource/PhabricatorContentSource.php',
'PhabricatorContentSourceView' => 'applications/metamta/contentsource/PhabricatorContentSourceView.php', 'PhabricatorContentSourceView' => 'applications/metamta/contentsource/PhabricatorContentSourceView.php',
'PhabricatorController' => 'applications/base/controller/PhabricatorController.php', 'PhabricatorController' => 'applications/base/controller/PhabricatorController.php',
@ -3004,6 +3005,7 @@ phutil_register_library_map(array(
'PhabricatorConfigTransaction' => 'PhabricatorApplicationTransaction', 'PhabricatorConfigTransaction' => 'PhabricatorApplicationTransaction',
'PhabricatorConfigTransactionQuery' => 'PhabricatorApplicationTransactionQuery', 'PhabricatorConfigTransactionQuery' => 'PhabricatorApplicationTransactionQuery',
'PhabricatorConfigValidationException' => 'Exception', 'PhabricatorConfigValidationException' => 'Exception',
'PhabricatorConpherencePHIDTypeThread' => 'PhabricatorPHIDType',
'PhabricatorContentSourceView' => 'AphrontView', 'PhabricatorContentSourceView' => 'AphrontView',
'PhabricatorController' => 'AphrontController', 'PhabricatorController' => 'AphrontController',
'PhabricatorCoreConfigOptions' => 'PhabricatorApplicationConfigOptions', 'PhabricatorCoreConfigOptions' => 'PhabricatorApplicationConfigOptions',

View file

@ -0,0 +1,49 @@
<?php
/**
* @group conpherence
*/
final class PhabricatorConpherencePHIDTypeThread extends PhabricatorPHIDType {
const TYPECONST = 'CONP';
public function getTypeConstant() {
return self::TYPECONST;
}
public function getTypeName() {
return pht('Conpherence Thread');
}
public function newObject() {
return new ConpherenceThread();
}
public function loadObjects(
PhabricatorObjectQuery $query,
array $phids) {
return id(new ConpherenceThreadQuery())
->withPHIDs($phids)
->setViewer($query->getViewer())
->execute();
}
public function loadHandles(
PhabricatorHandleQuery $query,
array $handles,
array $objects) {
foreach ($handles as $phid => $handle) {
$thread = $objects[$phid];
$name = $thread->getTitle();
if (!strlen($name)) {
$name = pht('[No Title]');
}
$handle->setName($name);
$handle->setFullName($name);
$handle->setURI('/conpherence/'.$thread->getID().'/');
}
}
}

View file

@ -31,7 +31,7 @@ final class ConpherenceThread extends ConpherenceDAO
public function generatePHID() { public function generatePHID() {
return PhabricatorPHID::generateNewPHID( return PhabricatorPHID::generateNewPHID(
PhabricatorPHIDConstants::PHID_TYPE_CONP); PhabricatorConpherencePHIDTypeThread::TYPECONST);
} }
public function save() { public function save() {

View file

@ -10,7 +10,7 @@ final class ConpherenceTransaction extends PhabricatorApplicationTransaction {
} }
public function getApplicationTransactionType() { public function getApplicationTransactionType() {
return PhabricatorPHIDConstants::PHID_TYPE_CONP; return PhabricatorConpherencePHIDTypeThread::TYPECONST;
} }
public function getApplicationTransactionCommentObject() { public function getApplicationTransactionCommentObject() {

View file

@ -16,7 +16,6 @@ final class PhabricatorPHIDConstants {
const PHID_TYPE_TOBJ = 'TOBJ'; const PHID_TYPE_TOBJ = 'TOBJ';
const PHID_TYPE_BLOG = 'BLOG'; const PHID_TYPE_BLOG = 'BLOG';
const PHID_TYPE_ANSW = 'ANSW'; const PHID_TYPE_ANSW = 'ANSW';
const PHID_TYPE_CONP = 'CONP';
const PHID_TYPE_ACNT = 'ACNT'; const PHID_TYPE_ACNT = 'ACNT';
const PHID_TYPE_PDCT = 'PDCT'; const PHID_TYPE_PDCT = 'PDCT';
const PHID_TYPE_PRCH = 'PRCH'; const PHID_TYPE_PRCH = 'PRCH';

View file

@ -104,13 +104,6 @@ final class PhabricatorObjectHandleData {
->execute(); ->execute();
return mpull($posts, null, 'getPHID'); return mpull($posts, null, 'getPHID');
case PhabricatorPHIDConstants::PHID_TYPE_CONP:
$confs = id(new ConpherenceThreadQuery())
->withPHIDs($phids)
->setViewer($this->viewer)
->execute();
return mpull($confs, null, 'getPHID');
} }
return array(); return array();
@ -265,29 +258,6 @@ final class PhabricatorObjectHandleData {
} }
break; break;
case PhabricatorPHIDConstants::PHID_TYPE_CONP:
foreach ($phids as $phid) {
$handle = new PhabricatorObjectHandle();
$handle->setPHID($phid);
$handle->setType($type);
if (empty($objects[$phid])) {
$handle->setName(pht('Unknown Conpherence Thread'));
} else {
$thread = $objects[$phid];
$name = $thread->getTitle();
if (!strlen($name)) {
$name = pht('[No Title]');
}
$handle->setName($name);
$handle->setFullName($name);
$handle->setURI('/conpherence/'.$thread->getID().'/');
$handle->setComplete(true);
}
$handles[$phid] = $handle;
}
break;
default: default:
foreach ($phids as $phid) { foreach ($phids as $phid) {
$handle = new PhabricatorObjectHandle(); $handle = new PhabricatorObjectHandle();

View file

@ -159,7 +159,6 @@ final class PhabricatorEdgeConfig extends PhabricatorEdgeConstants {
PhabricatorPHIDConstants::PHID_TYPE_BLOG => 'PhameBlog', PhabricatorPHIDConstants::PHID_TYPE_BLOG => 'PhameBlog',
PhabricatorPHIDConstants::PHID_TYPE_POST => 'PhamePost', PhabricatorPHIDConstants::PHID_TYPE_POST => 'PhamePost',
PhabricatorPHIDConstants::PHID_TYPE_ANSW => 'PonderAnswer', PhabricatorPHIDConstants::PHID_TYPE_ANSW => 'PonderAnswer',
PhabricatorPHIDConstants::PHID_TYPE_CONP => 'ConpherenceThread',
PhabricatorPHIDConstants::PHID_TYPE_ACNT => 'PhortuneAccount', PhabricatorPHIDConstants::PHID_TYPE_ACNT => 'PhortuneAccount',
PhabricatorPHIDConstants::PHID_TYPE_PRCH => 'PhortunePurchase', PhabricatorPHIDConstants::PHID_TYPE_PRCH => 'PhortunePurchase',
PhabricatorPHIDConstants::PHID_TYPE_CHRG => 'PhortuneCharge', PhabricatorPHIDConstants::PHID_TYPE_CHRG => 'PhortuneCharge',