1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-16 11:52:40 +01:00
phorge-phorge/src/applications/flag/conduit/ConduitAPI_flag_Method.php
Joshua Spence 86c399b657 Rename PhabricatorApplication subclasses
Summary: Ref T5655. Some discussion in D9839. Generally speaking, `Phabricator{$name}Application` is clearer than `PhabricatorApplication{$name}`.

Test Plan:
# Pinned and uninstalled some applications.
# Applied patch and performed migrations.
# Verified that the pinned applications were still pinned and that the uninstalled applications were still uninstalled.
# Performed a sanity check on the database contents.

Reviewers: btrahan, epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: hach-que, epriestley, Korvin

Maniphest Tasks: T5655

Differential Revision: https://secure.phabricator.com/D9982
2014-07-23 10:03:09 +10:00

40 lines
1.3 KiB
PHP

<?php
abstract class ConduitAPI_flag_Method extends ConduitAPIMethod {
public function getApplication() {
return PhabricatorApplication::getByClass('PhabricatorFlagsApplication');
}
protected function attachHandleToFlag($flag, PhabricatorUser $user) {
$handle = id(new PhabricatorHandleQuery())
->setViewer($user)
->withPHIDs(array($flag->getObjectPHID()))
->executeOne();
$flag->attachHandle($handle);
}
protected function buildFlagInfoDictionary($flag) {
$color = $flag->getColor();
$uri = PhabricatorEnv::getProductionURI($flag->getHandle()->getURI());
return array(
'id' => $flag->getID(),
'ownerPHID' => $flag->getOwnerPHID(),
'type' => $flag->getType(),
'objectPHID' => $flag->getObjectPHID(),
'reasonPHID' => $flag->getReasonPHID(),
'color' => $color,
'colorName' => PhabricatorFlagColor::getColorName($color),
'note' => $flag->getNote(),
'handle' => array(
'uri' => $uri,
'name' => $flag->getHandle()->getName(),
'fullname' => $flag->getHandle()->getFullName(),
),
'dateCreated' => $flag->getDateCreated(),
'dateModified' => $flag->getDateModified(),
);
}
}