"Please Refresh" Notifications
Summary: Based off D2704. Adds humane.js and a bit of plumbing. Currently does not seem to load notification.css (which causes notifications not to display) for reasons entirely opaque to me. Test Plan: tried locally. currently works except for the actual display due to css loading difficulties Reviewers: epriestley Reviewed By: epriestley CC: allenjohnashton, keebuhm, aran, Korvin Differential Revision: https://secure.phabricator.com/D2705
This commit is contained in:
@@ -772,7 +772,7 @@ celerity_register_resource_map(array(
|
|||||||
),
|
),
|
||||||
'javelin-behavior-aphlict-listen' =>
|
'javelin-behavior-aphlict-listen' =>
|
||||||
array(
|
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',
|
'type' => 'js',
|
||||||
'requires' =>
|
'requires' =>
|
||||||
array(
|
array(
|
||||||
@@ -781,6 +781,7 @@ celerity_register_resource_map(array(
|
|||||||
2 => 'javelin-util',
|
2 => 'javelin-util',
|
||||||
3 => 'javelin-stratcom',
|
3 => 'javelin-stratcom',
|
||||||
4 => 'javelin-behavior-aphlict-dropdown',
|
4 => 'javelin-behavior-aphlict-dropdown',
|
||||||
|
5 => 'phabricator-notification',
|
||||||
),
|
),
|
||||||
'disk' => '/rsrc/js/application/aphlict/behavior-aphlict-listen.js',
|
'disk' => '/rsrc/js/application/aphlict/behavior-aphlict-listen.js',
|
||||||
),
|
),
|
||||||
@@ -2160,7 +2161,7 @@ celerity_register_resource_map(array(
|
|||||||
),
|
),
|
||||||
'phabricator-notification' =>
|
'phabricator-notification' =>
|
||||||
array(
|
array(
|
||||||
'uri' => '/res/8497d4b2/rsrc/js/application/core/Notification.js',
|
'uri' => '/res/253b3262/rsrc/js/application/core/Notification.js',
|
||||||
'type' => 'js',
|
'type' => 'js',
|
||||||
'requires' =>
|
'requires' =>
|
||||||
array(
|
array(
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ abstract class ManiphestController extends PhabricatorController {
|
|||||||
$page->setBaseURI('/maniphest/');
|
$page->setBaseURI('/maniphest/');
|
||||||
$page->setTitle(idx($data, 'title'));
|
$page->setTitle(idx($data, 'title'));
|
||||||
$page->setGlyph("\xE2\x9A\x93");
|
$page->setGlyph("\xE2\x9A\x93");
|
||||||
|
$page->appendPageObjects(idx($data, 'pageObjects', array()));
|
||||||
$page->appendChild($view);
|
$page->appendChild($view);
|
||||||
$page->setSearchDefaultScope(PhabricatorSearchScope::SCOPE_OPEN_TASKS);
|
$page->setSearchDefaultScope(PhabricatorSearchScope::SCOPE_OPEN_TASKS);
|
||||||
|
|
||||||
|
|||||||
@@ -523,6 +523,7 @@ final class ManiphestTaskDetailController extends ManiphestController {
|
|||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'title' => 'T'.$task->getID().' '.$task->getTitle(),
|
'title' => 'T'.$task->getID().' '.$task->getTitle(),
|
||||||
|
'pageObjects' => array($task->getPHID()),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -556,6 +556,12 @@ final class ManiphestTaskEditController extends ManiphestController {
|
|||||||
'uri' => '/maniphest/task/descriptionpreview/',
|
'uri' => '/maniphest/task/descriptionpreview/',
|
||||||
));
|
));
|
||||||
|
|
||||||
|
if ($task->getID()) {
|
||||||
|
$page_objects = array( $task->getPHID() );
|
||||||
|
} else {
|
||||||
|
$page_objects = array();
|
||||||
|
}
|
||||||
|
|
||||||
return $this->buildStandardPageResponse(
|
return $this->buildStandardPageResponse(
|
||||||
array(
|
array(
|
||||||
$error_view,
|
$error_view,
|
||||||
@@ -564,6 +570,7 @@ final class ManiphestTaskEditController extends ManiphestController {
|
|||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'title' => $header_name,
|
'title' => $header_name,
|
||||||
|
'pageObjects' => $page_objects,
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ final class PhabricatorStandardPageView extends AphrontPageView {
|
|||||||
private $isFrameable = false;
|
private $isFrameable = false;
|
||||||
private $disableConsole;
|
private $disableConsole;
|
||||||
private $searchDefaultScope;
|
private $searchDefaultScope;
|
||||||
|
private $pageObjects = array();
|
||||||
|
|
||||||
public function setIsAdminInterface($is_admin_interface) {
|
public function setIsAdminInterface($is_admin_interface) {
|
||||||
$this->isAdminInterface = $is_admin_interface;
|
$this->isAdminInterface = $is_admin_interface;
|
||||||
@@ -113,6 +114,12 @@ final class PhabricatorStandardPageView extends AphrontPageView {
|
|||||||
return $this->searchDefaultScope;
|
return $this->searchDefaultScope;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function appendPageObjects(array $objs) {
|
||||||
|
foreach ($objs as $obj) {
|
||||||
|
$this->pageObjects[] = $obj;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public function getTitle() {
|
public function getTitle() {
|
||||||
$use_glyph = true;
|
$use_glyph = true;
|
||||||
$request = $this->getRequest();
|
$request = $this->getRequest();
|
||||||
@@ -142,6 +149,9 @@ final class PhabricatorStandardPageView extends AphrontPageView {
|
|||||||
require_celerity_resource('phabricator-core-css');
|
require_celerity_resource('phabricator-core-css');
|
||||||
require_celerity_resource('phabricator-core-buttons-css');
|
require_celerity_resource('phabricator-core-buttons-css');
|
||||||
require_celerity_resource('phabricator-standard-page-view');
|
require_celerity_resource('phabricator-standard-page-view');
|
||||||
|
if (PhabricatorEnv::getEnvConfig('notification.enabled')) {
|
||||||
|
require_celerity_resource('phabricator-notification-css');
|
||||||
|
}
|
||||||
|
|
||||||
$current_token = null;
|
$current_token = null;
|
||||||
$request = $this->getRequest();
|
$request = $this->getRequest();
|
||||||
@@ -388,6 +398,7 @@ final class PhabricatorStandardPageView extends AphrontPageView {
|
|||||||
'id' => $aphlict_object_id,
|
'id' => $aphlict_object_id,
|
||||||
'server' => $server_domain,
|
'server' => $server_domain,
|
||||||
'port' => 2600,
|
'port' => 2600,
|
||||||
|
'pageObjects' => $this->pageObjects,
|
||||||
));
|
));
|
||||||
|
|
||||||
Javelin::initBehavior('aphlict-dropdown', array());
|
Javelin::initBehavior('aphlict-dropdown', array());
|
||||||
|
|||||||
@@ -5,10 +5,12 @@
|
|||||||
* javelin-util
|
* javelin-util
|
||||||
* javelin-stratcom
|
* javelin-stratcom
|
||||||
* javelin-behavior-aphlict-dropdown
|
* javelin-behavior-aphlict-dropdown
|
||||||
|
* phabricator-notification
|
||||||
*/
|
*/
|
||||||
|
|
||||||
JX.behavior('aphlict-listen', function(config) {
|
JX.behavior('aphlict-listen', function(config) {
|
||||||
function onready() {
|
function onready() {
|
||||||
|
|
||||||
var client = new JX.Aphlict(config.id, config.server, config.port)
|
var client = new JX.Aphlict(config.id, config.server, config.port)
|
||||||
.setHandler(function(type, message) {
|
.setHandler(function(type, message) {
|
||||||
if (message) {
|
if (message) {
|
||||||
@@ -16,6 +18,14 @@ JX.behavior('aphlict-listen', function(config) {
|
|||||||
var request = new JX.Request('/notification/individual/',
|
var request = new JX.Request('/notification/individual/',
|
||||||
function(response) {
|
function(response) {
|
||||||
if (response.pertinent) {
|
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, {});
|
JX.Stratcom.invoke('notification-panel-update', null, {});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user