mirror of
https://we.phorge.it/source/phorge.git
synced 2025-03-28 12:08:14 +01:00
Pull some constants out of the Asana bridge
Summary: Ref T2852. Reduce the number of magical strings in use, and prepare the Asana bridge for eventual workspace/project support (a little bit). Test Plan: Verified enriched links still work properly. Reviewers: btrahan, chad Reviewed By: btrahan CC: aran Maniphest Tasks: T2852 Differential Revision: https://secure.phabricator.com/D6301
This commit is contained in:
parent
d4ca508d2b
commit
9e82c01a8a
2 changed files with 23 additions and 4 deletions
|
@ -2,10 +2,24 @@
|
|||
|
||||
final class DoorkeeperBridgeAsana extends DoorkeeperBridge {
|
||||
|
||||
const APPTYPE_ASANA = 'asana';
|
||||
const APPDOMAIN_ASANA = 'asana.com';
|
||||
const OBJTYPE_TASK = 'asana:task';
|
||||
|
||||
public function canPullRef(DoorkeeperObjectRef $ref) {
|
||||
return ($ref->getApplicationType() == 'asana') &&
|
||||
($ref->getApplicationDomain() == 'asana.com') &&
|
||||
($ref->getObjectType() == 'asana:task');
|
||||
if ($ref->getApplicationType() != self::APPTYPE_ASANA) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($ref->getApplicationDomain() != self::APPDOMAIN_ASANA) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$types = array(
|
||||
self::OBJTYPE_TASK => true,
|
||||
);
|
||||
|
||||
return isset($types[$ref->getObjectType()]);
|
||||
}
|
||||
|
||||
public function pullRefs(array $refs) {
|
||||
|
|
|
@ -23,7 +23,12 @@ final class DoorkeeperRemarkupRuleAsana
|
|||
'token' => $token,
|
||||
'href' => $matches[0],
|
||||
'tag' => array(
|
||||
'ref' => array('asana', 'asana.com', 'asana:task', $matches[2]),
|
||||
'ref' => array(
|
||||
DoorkeeperBridgeAsana::APPTYPE_ASANA,
|
||||
DoorkeeperBridgeAsana::APPDOMAIN_ASANA,
|
||||
DoorkeeperBridgeAsana::OBJTYPE_TASK,
|
||||
$matches[2],
|
||||
),
|
||||
'extra' => array(
|
||||
'asana.context' => $matches[1],
|
||||
),
|
||||
|
|
Loading…
Add table
Reference in a new issue