diff --git a/src/__celerity_resource_map__.php b/src/__celerity_resource_map__.php index 350005420a..8932ff220e 100644 --- a/src/__celerity_resource_map__.php +++ b/src/__celerity_resource_map__.php @@ -772,7 +772,7 @@ celerity_register_resource_map(array( ), 'javelin-behavior-aphlict-listen' => array( - 'uri' => '/res/0ba6b119/rsrc/js/application/aphlict/behavior-aphlict-listen.js', + 'uri' => '/res/4b1dc678/rsrc/js/application/aphlict/behavior-aphlict-listen.js', 'type' => 'js', 'requires' => array( @@ -781,6 +781,7 @@ celerity_register_resource_map(array( 2 => 'javelin-util', 3 => 'javelin-stratcom', 4 => 'javelin-behavior-aphlict-dropdown', + 5 => 'phabricator-notification', ), 'disk' => '/rsrc/js/application/aphlict/behavior-aphlict-listen.js', ), @@ -2160,7 +2161,7 @@ celerity_register_resource_map(array( ), 'phabricator-notification' => array( - 'uri' => '/res/8497d4b2/rsrc/js/application/core/Notification.js', + 'uri' => '/res/253b3262/rsrc/js/application/core/Notification.js', 'type' => 'js', 'requires' => array( diff --git a/src/applications/maniphest/controller/ManiphestController.php b/src/applications/maniphest/controller/ManiphestController.php index ce90b40b4f..471b229fac 100644 --- a/src/applications/maniphest/controller/ManiphestController.php +++ b/src/applications/maniphest/controller/ManiphestController.php @@ -30,6 +30,7 @@ abstract class ManiphestController extends PhabricatorController { $page->setBaseURI('/maniphest/'); $page->setTitle(idx($data, 'title')); $page->setGlyph("\xE2\x9A\x93"); + $page->appendPageObjects(idx($data, 'pageObjects', array())); $page->appendChild($view); $page->setSearchDefaultScope(PhabricatorSearchScope::SCOPE_OPEN_TASKS); diff --git a/src/applications/maniphest/controller/ManiphestTaskDetailController.php b/src/applications/maniphest/controller/ManiphestTaskDetailController.php index b94429e7fa..6353a0f19f 100644 --- a/src/applications/maniphest/controller/ManiphestTaskDetailController.php +++ b/src/applications/maniphest/controller/ManiphestTaskDetailController.php @@ -523,6 +523,7 @@ final class ManiphestTaskDetailController extends ManiphestController { ), array( 'title' => 'T'.$task->getID().' '.$task->getTitle(), + 'pageObjects' => array($task->getPHID()), )); } diff --git a/src/applications/maniphest/controller/ManiphestTaskEditController.php b/src/applications/maniphest/controller/ManiphestTaskEditController.php index 42b8d36192..c35d26bb02 100644 --- a/src/applications/maniphest/controller/ManiphestTaskEditController.php +++ b/src/applications/maniphest/controller/ManiphestTaskEditController.php @@ -556,6 +556,12 @@ final class ManiphestTaskEditController extends ManiphestController { 'uri' => '/maniphest/task/descriptionpreview/', )); + if ($task->getID()) { + $page_objects = array( $task->getPHID() ); + } else { + $page_objects = array(); + } + return $this->buildStandardPageResponse( array( $error_view, @@ -564,6 +570,7 @@ final class ManiphestTaskEditController extends ManiphestController { ), array( 'title' => $header_name, + 'pageObjects' => $page_objects, )); } } diff --git a/src/view/page/PhabricatorStandardPageView.php b/src/view/page/PhabricatorStandardPageView.php index a2e9ae8b78..85651b8361 100644 --- a/src/view/page/PhabricatorStandardPageView.php +++ b/src/view/page/PhabricatorStandardPageView.php @@ -30,6 +30,7 @@ final class PhabricatorStandardPageView extends AphrontPageView { private $isFrameable = false; private $disableConsole; private $searchDefaultScope; + private $pageObjects = array(); public function setIsAdminInterface($is_admin_interface) { $this->isAdminInterface = $is_admin_interface; @@ -113,6 +114,12 @@ final class PhabricatorStandardPageView extends AphrontPageView { return $this->searchDefaultScope; } + public function appendPageObjects(array $objs) { + foreach ($objs as $obj) { + $this->pageObjects[] = $obj; + } + } + public function getTitle() { $use_glyph = true; $request = $this->getRequest(); @@ -142,6 +149,9 @@ final class PhabricatorStandardPageView extends AphrontPageView { require_celerity_resource('phabricator-core-css'); require_celerity_resource('phabricator-core-buttons-css'); require_celerity_resource('phabricator-standard-page-view'); + if (PhabricatorEnv::getEnvConfig('notification.enabled')) { + require_celerity_resource('phabricator-notification-css'); + } $current_token = null; $request = $this->getRequest(); @@ -388,6 +398,7 @@ final class PhabricatorStandardPageView extends AphrontPageView { 'id' => $aphlict_object_id, 'server' => $server_domain, 'port' => 2600, + 'pageObjects' => $this->pageObjects, )); Javelin::initBehavior('aphlict-dropdown', array()); diff --git a/webroot/rsrc/js/application/aphlict/behavior-aphlict-listen.js b/webroot/rsrc/js/application/aphlict/behavior-aphlict-listen.js index ddf3cf155a..585fd30fd3 100644 --- a/webroot/rsrc/js/application/aphlict/behavior-aphlict-listen.js +++ b/webroot/rsrc/js/application/aphlict/behavior-aphlict-listen.js @@ -5,10 +5,12 @@ * javelin-util * javelin-stratcom * javelin-behavior-aphlict-dropdown + * phabricator-notification */ JX.behavior('aphlict-listen', function(config) { function onready() { + var client = new JX.Aphlict(config.id, config.server, config.port) .setHandler(function(type, message) { if (message) { @@ -16,6 +18,14 @@ JX.behavior('aphlict-listen', function(config) { var request = new JX.Request('/notification/individual/', function(response) { if (response.pertinent) { + if (config.pageObjects.indexOf(response.primaryObjectPHID) + > -1) { + var notification = new JX.Notification() + .setContent('Page updated. Please refresh.') + .setDuration(0) // never timeout + .show(); + } + JX.Stratcom.invoke('notification-panel-update', null, {}); } });