Changeset View
Changeset View
Standalone View
Standalone View
src/view/page/PhabricatorStandardPageView.php
Show First 20 Lines • Show All 522 Lines • ▼ Show 20 Lines | protected function getTail() { | ||||
$user = $request->getUser(); | $user = $request->getUser(); | ||||
$tail = array( | $tail = array( | ||||
parent::getTail(), | parent::getTail(), | ||||
); | ); | ||||
$response = CelerityAPI::getStaticResourceResponse(); | $response = CelerityAPI::getStaticResourceResponse(); | ||||
if (PhabricatorEnv::getEnvConfig('notification.enabled')) { | |||||
if ($user && $user->isLoggedIn()) { | |||||
$client_uri = PhabricatorEnv::getEnvConfig('notification.client-uri'); | |||||
$client_uri = new PhutilURI($client_uri); | |||||
if ($client_uri->getDomain() == 'localhost') { | |||||
$this_host = $this->getRequest()->getHost(); | |||||
$this_host = new PhutilURI('http://'.$this_host.'/'); | |||||
$client_uri->setDomain($this_host->getDomain()); | |||||
} | |||||
if ($request->isHTTPS()) { | if ($request->isHTTPS()) { | ||||
$client_uri->setProtocol('wss'); | $with_protocol = 'https'; | ||||
} else { | } else { | ||||
$client_uri->setProtocol('ws'); | $with_protocol = 'http'; | ||||
} | } | ||||
$servers = PhabricatorNotificationServerRef::getEnabledClientServers( | |||||
$with_protocol); | |||||
if ($servers) { | |||||
if ($user && $user->isLoggedIn()) { | |||||
// TODO: We could be smarter about selecting a server if there are | |||||
Lint: TODO Comment: This comment has a TODO. | |||||
// multiple options available. | |||||
$server = head($servers); | |||||
$client_uri = $server->getWebsocketURI(); | |||||
Javelin::initBehavior( | Javelin::initBehavior( | ||||
'aphlict-listen', | 'aphlict-listen', | ||||
array( | array( | ||||
'websocketURI' => (string)$client_uri, | 'websocketURI' => (string)$client_uri, | ||||
) + $this->buildAphlictListenConfigData()); | ) + $this->buildAphlictListenConfigData()); | ||||
} | } | ||||
} | } | ||||
▲ Show 20 Lines • Show All 293 Lines • Show Last 20 Lines |
This comment has a TODO.