private function buildPropertyView(NuanceItem $item) { $viewer = $this->getViewer(); $properties = id(new PHUIPropertyListView())->setUser($viewer); $properties->addProperty(pht('Date Created'), phabricator_datetime($item->getDateCreated(), $viewer)); $requestor_phid = $item->getRequestorPHID(); if ($requestor_phid) { $requestor_view = $viewer->renderHandle($requestor_phid); } else { $requestor_view = phutil_tag('em', array(), pht('None')); } $properties->addProperty(pht('Requestor'), $requestor_view); $properties->addProperty(pht('Source'), $viewer->renderHandle($item->getSourcePHID())); $queue_phid = $item->getQueuePHID(); if ($queue_phid) { $queue_view = $viewer->renderHandle($queue_phid); } else { $queue_view = phutil_tag('em', array(), pht('None')); } $properties->addProperty(pht('Queue'), $queue_view); $source = $item->getSource(); $definition = $source->getDefinition(); $definition->renderItemEditProperties($viewer, $item, $properties); return $properties; }
private function routeItem(NuanceItem $item) { $status = $item->getStatus(); if ($status != NuanceItem::STATUS_ROUTING) { return; } $source = $item->getSource(); // For now, always route items into the source's default queue. $item->setQueuePHID($source->getDefaultQueuePHID())->setStatus(NuanceItem::STATUS_OPEN)->save(); }
private function reloadExternalRef(NuanceItem $item, DoorkeeperObjectRef $ref, $local) { $source = $item->getSource(); $token = $source->getSourceProperty('github.token'); $token = new PhutilOpaqueEnvelope($token); $viewer = $this->getViewer(); $ref = id(new DoorkeeperImportEngine())->setViewer($viewer)->setRefs(array($ref))->setThrowOnMissingLink(true)->setContextProperty('github.token', $token)->needLocalOnly($local)->executeOne(); if ($ref->getSyncFailed()) { $xobj = null; } else { $xobj = $ref->getExternalObject(); } return $xobj; }