1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-21 04:50:55 +01:00

Don't run "aphlict-listen" behavior if real-time notifications are disabled

Summary: Fixes T5277. We incorrectly ran this unconditionally.

Test Plan: Toggled setting on/off, verified behavior ran or did not run.

Reviewers: joshuaspence

Reviewed By: joshuaspence

Subscribers: epriestley

Maniphest Tasks: T5277

Differential Revision: https://secure.phabricator.com/D9418
This commit is contained in:
epriestley 2014-06-07 13:05:01 -07:00
parent 61af2e313b
commit 96d5a9b4c2

View file

@ -352,50 +352,51 @@ final class PhabricatorStandardPageView extends PhabricatorBarePageView {
$request = $this->getRequest(); $request = $this->getRequest();
$user = $request->getUser(); $user = $request->getUser();
$container = null; $tail = array(
if ($user && $user->isLoggedIn()) { parent::getTail(),
);
$aphlict_object_id = celerity_generate_unique_node_id(); if (PhabricatorEnv::getEnvConfig('notification.enabled')) {
$aphlict_container_id = celerity_generate_unique_node_id(); if ($user && $user->isLoggedIn()) {
$client_uri = PhabricatorEnv::getEnvConfig('notification.client-uri'); $aphlict_object_id = celerity_generate_unique_node_id();
$client_uri = new PhutilURI($client_uri); $aphlict_container_id = celerity_generate_unique_node_id();
if ($client_uri->getDomain() == 'localhost') {
$this_host = $this->getRequest()->getHost(); $client_uri = PhabricatorEnv::getEnvConfig('notification.client-uri');
$this_host = new PhutilURI('http://'.$this_host.'/'); $client_uri = new PhutilURI($client_uri);
$client_uri->setDomain($this_host->getDomain()); if ($client_uri->getDomain() == 'localhost') {
$this_host = $this->getRequest()->getHost();
$this_host = new PhutilURI('http://'.$this_host.'/');
$client_uri->setDomain($this_host->getDomain());
}
$enable_debug = PhabricatorEnv::getEnvConfig('notification.debug');
Javelin::initBehavior(
'aphlict-listen',
array(
'id' => $aphlict_object_id,
'containerID' => $aphlict_container_id,
'server' => $client_uri->getDomain(),
'port' => $client_uri->getPort(),
'debug' => $enable_debug,
'pageObjects' => array_fill_keys($this->pageObjects, true),
));
$tail[] = phutil_tag(
'div',
array(
'id' => $aphlict_container_id,
'style' =>
'position: absolute; width: 0; height: 0; overflow: hidden;',
),
'');
} }
$enable_debug = PhabricatorEnv::getEnvConfig('notification.debug');
Javelin::initBehavior(
'aphlict-listen',
array(
'id' => $aphlict_object_id,
'containerID' => $aphlict_container_id,
'server' => $client_uri->getDomain(),
'port' => $client_uri->getPort(),
'debug' => $enable_debug,
'pageObjects' => array_fill_keys($this->pageObjects, true),
));
$container = phutil_tag(
'div',
array(
'id' => $aphlict_container_id,
'style' =>
'position: absolute; width: 0; height: 0; overflow: hidden;',
),
'');
} }
$response = CelerityAPI::getStaticResourceResponse(); $response = CelerityAPI::getStaticResourceResponse();
$tail[] = $response->renderHTMLFooter();
$tail = array( return $tail;
parent::getTail(),
$container,
$response->renderHTMLFooter(),
);
return phutil_implode_html("\n", $tail);
} }
protected function getBodyClasses() { protected function getBodyClasses() {