mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-22 14:52:41 +01:00
"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:
parent
d5e61f5250
commit
e519581594
6 changed files with 33 additions and 2 deletions
|
@ -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(
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -523,6 +523,7 @@ final class ManiphestTaskDetailController extends ManiphestController {
|
|||
),
|
||||
array(
|
||||
'title' => 'T'.$task->getID().' '.$task->getTitle(),
|
||||
'pageObjects' => array($task->getPHID()),
|
||||
));
|
||||
}
|
||||
|
||||
|
|
|
@ -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,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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());
|
||||
|
|
|
@ -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, {});
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue