Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F17852806
D12498.id30005.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
15 KB
Referenced Files
None
Subscribers
None
D12498.id30005.diff
View Options
diff --git a/resources/celerity/map.php b/resources/celerity/map.php
--- a/resources/celerity/map.php
+++ b/resources/celerity/map.php
@@ -8,7 +8,7 @@
return array(
'names' => array(
'core.pkg.css' => 'a2a90172',
- 'core.pkg.js' => '328a9980',
+ 'core.pkg.js' => '2f39c4d1',
'darkconsole.pkg.js' => '8ab24e01',
'differential.pkg.css' => '3500921f',
'differential.pkg.js' => 'c0506961',
@@ -205,7 +205,7 @@
'rsrc/externals/javelin/lib/JSON.js' => '69adf288',
'rsrc/externals/javelin/lib/Leader.js' => '331b1611',
'rsrc/externals/javelin/lib/Mask.js' => '8a41885b',
- 'rsrc/externals/javelin/lib/Quicksand.js' => '97720512',
+ 'rsrc/externals/javelin/lib/Quicksand.js' => '25437884',
'rsrc/externals/javelin/lib/Request.js' => '94b750d2',
'rsrc/externals/javelin/lib/Resource.js' => '44959b73',
'rsrc/externals/javelin/lib/Routable.js' => 'b3e7d692',
@@ -350,7 +350,7 @@
'rsrc/image/texture/table_header_hover.png' => '038ec3b9',
'rsrc/image/texture/table_header_tall.png' => 'd56b434f',
'rsrc/js/application/aphlict/Aphlict.js' => '30a6303c',
- 'rsrc/js/application/aphlict/behavior-aphlict-dropdown.js' => '00def500',
+ 'rsrc/js/application/aphlict/behavior-aphlict-dropdown.js' => '0f37b6fc',
'rsrc/js/application/aphlict/behavior-aphlict-listen.js' => 'b1a59974',
'rsrc/js/application/aphlict/behavior-aphlict-status.js' => 'ea681761',
'rsrc/js/application/auth/behavior-persona-login.js' => '9414ff18',
@@ -550,7 +550,7 @@
'inline-comment-summary-css' => 'eb5f8e8c',
'javelin-aphlict' => '30a6303c',
'javelin-behavior' => '61cbc29a',
- 'javelin-behavior-aphlict-dropdown' => '00def500',
+ 'javelin-behavior-aphlict-dropdown' => '0f37b6fc',
'javelin-behavior-aphlict-listen' => 'b1a59974',
'javelin-behavior-aphlict-status' => 'ea681761',
'javelin-behavior-aphront-basic-tokenizer' => 'b3a4b884',
@@ -677,7 +677,7 @@
'javelin-leader' => '331b1611',
'javelin-magical-init' => '3010e992',
'javelin-mask' => '8a41885b',
- 'javelin-quicksand' => '97720512',
+ 'javelin-quicksand' => '25437884',
'javelin-reactor' => '2b8de964',
'javelin-reactor-dom' => 'c90a04fc',
'javelin-reactor-node-calmer' => '76f4ebed',
@@ -842,16 +842,6 @@
'unhandled-exception-css' => '37d4f9a2',
),
'requires' => array(
- '00def500' => array(
- 'javelin-behavior',
- 'javelin-request',
- 'javelin-stratcom',
- 'javelin-vector',
- 'javelin-dom',
- 'javelin-uri',
- 'javelin-behavior-device',
- 'phabricator-title',
- ),
'029a133d' => array(
'aphront-dialog-view-css',
),
@@ -917,6 +907,16 @@
'javelin-stratcom',
'phuix-dropdown-menu',
),
+ '0f37b6fc' => array(
+ 'javelin-behavior',
+ 'javelin-request',
+ 'javelin-stratcom',
+ 'javelin-vector',
+ 'javelin-dom',
+ 'javelin-uri',
+ 'javelin-behavior-device',
+ 'phabricator-title',
+ ),
'0f764c35' => array(
'javelin-install',
'javelin-util',
@@ -1009,6 +1009,9 @@
'javelin-request',
'javelin-workflow',
),
+ 25437884 => array(
+ 'javelin-install',
+ ),
'2818f5ce' => array(
'javelin-install',
'javelin-util',
@@ -1600,9 +1603,6 @@
'javelin-resource',
'javelin-routable',
),
- 97720512 => array(
- 'javelin-install',
- ),
'988040b4' => array(
'javelin-install',
'javelin-dom',
diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -93,6 +93,7 @@
'AlmanacServiceTransactionQuery' => 'applications/almanac/query/AlmanacServiceTransactionQuery.php',
'AlmanacServiceType' => 'applications/almanac/servicetype/AlmanacServiceType.php',
'AlmanacServiceViewController' => 'applications/almanac/controller/AlmanacServiceViewController.php',
+ 'AphlictDropdownDataQuery' => 'applications/aphlict/query/AphlictDropdownDataQuery.php',
'Aphront304Response' => 'aphront/response/Aphront304Response.php',
'Aphront400Response' => 'aphront/response/Aphront400Response.php',
'Aphront403Response' => 'aphront/response/Aphront403Response.php',
diff --git a/src/applications/aphlict/query/AphlictDropdownDataQuery.php b/src/applications/aphlict/query/AphlictDropdownDataQuery.php
new file mode 100644
--- /dev/null
+++ b/src/applications/aphlict/query/AphlictDropdownDataQuery.php
@@ -0,0 +1,109 @@
+<?php
+
+final class AphlictDropdownDataQuery {
+
+ private $viewer;
+ private $needContent;
+ private $notificationData;
+ private $conpherenceData;
+
+ public function setViewer(PhabricatorUser $viewer) {
+ $this->viewer = $viewer;
+ return $this;
+ }
+
+ public function getViewer() {
+ return $this->viewer;
+ }
+
+ public function withNeedContent($bool) {
+ $this->needContent = $bool;
+ return $this;
+ }
+
+ private function setNotificationData(array $data) {
+ $this->notificationData = $data;
+ return $this;
+ }
+
+ public function getNotificationData() {
+ if ($this->notificationData === null) {
+ throw new Exception('You must execute() first!');
+ }
+ return $this->notificationData;
+ }
+
+ private function setConpherenceData(array $data) {
+ $this->conpherenceData = $data;
+ return $this;
+ }
+
+ public function getConpherenceData() {
+ if ($this->conpherenceData === null) {
+ throw new Exception('You must execute() first!');
+ }
+ return $this->conpherenceData;
+ }
+
+ public function execute() {
+ $viewer = $this->getViewer();
+
+ $conpherence_app = 'PhabricatorConpherenceApplication';
+ $is_c_installed = PhabricatorApplication::isClassInstalledForViewer(
+ $conpherence_app,
+ $viewer);
+ $raw_message_count_number = null;
+ $message_count_number = null;
+ if ($is_c_installed) {
+ $unread_status = ConpherenceParticipationStatus::BEHIND;
+ $unread = id(new ConpherenceParticipantCountQuery())
+ ->withParticipantPHIDs(array($viewer->getPHID()))
+ ->withParticipationStatus($unread_status)
+ ->execute();
+ $raw_message_count_number = idx($unread, $viewer->getPHID(), 0);
+ $message_count_number = $this->formatNumber($raw_message_count_number);
+ }
+ $conpherence_data = array(
+ 'isInstalled' => $is_c_installed,
+ 'countType' => 'messages',
+ 'count' => $message_count_number,
+ 'rawCount' => $raw_message_count_number,
+ );
+ $this->setConpherenceData($conpherence_data);
+
+ $notification_app = 'PhabricatorNotificationsApplication';
+ $is_n_installed = PhabricatorApplication::isClassInstalledForViewer(
+ $notification_app,
+ $viewer);
+ $notification_count_number = null;
+ $raw_notification_count_number = null;
+ if ($is_n_installed) {
+ $raw_notification_count_number =
+ id(new PhabricatorFeedStoryNotification())
+ ->countUnread($viewer);
+ $notification_count_number = $this->formatNumber(
+ $raw_notification_count_number);
+ }
+ $notification_data = array(
+ 'isInstalled' => $is_n_installed,
+ 'countType' => 'notifications',
+ 'count' => $notification_count_number,
+ 'rawCount' => $raw_notification_count_number,
+ );
+ $this->setNotificationData($notification_data);
+
+ return array(
+ $notification_app => $this->getNotificationData(),
+ $conpherence_app => $this->getConpherenceData(),
+ );
+ }
+
+ private function formatNumber($number) {
+ $formatted = $number;
+ if ($number > 999) {
+ $formatted = "\xE2\x88\x9E";
+ }
+ return $formatted;
+ }
+
+}
diff --git a/src/view/page/PhabricatorStandardPageView.php b/src/view/page/PhabricatorStandardPageView.php
--- a/src/view/page/PhabricatorStandardPageView.php
+++ b/src/view/page/PhabricatorStandardPageView.php
@@ -583,8 +583,19 @@
}
private function buildQuicksandConfig() {
+ $user = $this->getRequest()->getUser();
+
+ $dropdown_query = id(new AphlictDropdownDataQuery())
+ ->setViewer($user)
+ ->withNeedContent(true);
+ $dropdown_query->execute();
+
return array(
'title' => $this->getTitle(),
+ 'aphlictDropdownData' => array(
+ $dropdown_query->getNotificationData(),
+ $dropdown_query->getConpherenceData(),
+ ),
) + $this->buildAphlictListenConfigData();
}
diff --git a/src/view/page/menu/PhabricatorMainMenuView.php b/src/view/page/menu/PhabricatorMainMenuView.php
--- a/src/view/page/menu/PhabricatorMainMenuView.php
+++ b/src/view/page/menu/PhabricatorMainMenuView.php
@@ -298,22 +298,20 @@
$container_classes = array('alert-notifications');
$aural = array();
+ $dropdown_query = id(new AphlictDropdownDataQuery())
+ ->setViewer($user);
+ $dropdown_data = $dropdown_query->execute();
+
$message_tag = '';
$message_notification_dropdown = '';
- $conpherence = 'PhabricatorConpherenceApplication';
- if (PhabricatorApplication::isClassInstalledForViewer(
- $conpherence,
- $user)) {
+ $conpherence_app = 'PhabricatorConpherenceApplication';
+ $conpherence_data = $dropdown_data[$conpherence_app];
+ if ($conpherence_data['isInstalled']) {
$message_id = celerity_generate_unique_node_id();
$message_count_id = celerity_generate_unique_node_id();
$message_dropdown_id = celerity_generate_unique_node_id();
- $unread_status = ConpherenceParticipationStatus::BEHIND;
- $unread = id(new ConpherenceParticipantCountQuery())
- ->withParticipantPHIDs(array($user->getPHID()))
- ->withParticipationStatus($unread_status)
- ->execute();
- $message_count_number = idx($unread, $user->getPHID(), 0);
+ $message_count_number = $conpherence_data['rawCount'];
if ($message_count_number) {
$aural[] = phutil_tag(
@@ -328,17 +326,13 @@
$aural[] = pht('No messages.');
}
- if ($message_count_number > 999) {
- $message_count_number = "\xE2\x88\x9E";
- }
-
$message_count_tag = phutil_tag(
'span',
array(
'id' => $message_count_id,
'class' => 'phabricator-main-menu-message-count',
),
- $message_count_number);
+ $conpherence_data['count']);
$message_icon_tag = javelin_tag(
'span',
@@ -373,7 +367,7 @@
'dropdownID' => $message_dropdown_id,
'loadingText' => pht('Loading...'),
'uri' => '/conpherence/panel/',
- 'countType' => 'messages',
+ 'countType' => $conpherence_data['countType'],
'countNumber' => $message_count_number,
'unreadClass' => 'message-unread',
));
@@ -392,15 +386,13 @@
$bubble_tag = '';
$notification_dropdown = '';
$notification_app = 'PhabricatorNotificationsApplication';
- if (PhabricatorApplication::isClassInstalledForViewer(
- $notification_app,
- $user)) {
+ $notification_data = $dropdown_data[$notification_app];
+ if ($notification_data['isInstalled']) {
$count_id = celerity_generate_unique_node_id();
$dropdown_id = celerity_generate_unique_node_id();
$bubble_id = celerity_generate_unique_node_id();
- $count_number = id(new PhabricatorFeedStoryNotification())
- ->countUnread($user);
+ $count_number = $notification_data['rawCount'];
if ($count_number) {
$aural[] = phutil_tag(
@@ -415,17 +407,13 @@
$aural[] = pht('No notifications.');
}
- if ($count_number > 999) {
- $count_number = "\xE2\x88\x9E";
- }
-
$count_tag = phutil_tag(
'span',
array(
'id' => $count_id,
'class' => 'phabricator-main-menu-alert-count',
),
- $count_number);
+ $notification_data['count']);
$icon_tag = javelin_tag(
'span',
@@ -457,7 +445,7 @@
'dropdownID' => $dropdown_id,
'loadingText' => pht('Loading...'),
'uri' => '/notification/panel/',
- 'countType' => 'notifications',
+ 'countType' => $notification_data['countType'],
'countNumber' => $count_number,
'unreadClass' => 'alert-unread',
));
diff --git a/webroot/rsrc/externals/javelin/lib/Quicksand.js b/webroot/rsrc/externals/javelin/lib/Quicksand.js
--- a/webroot/rsrc/externals/javelin/lib/Quicksand.js
+++ b/webroot/rsrc/externals/javelin/lib/Quicksand.js
@@ -36,6 +36,7 @@
_frameNode: null,
_contentNode: null,
_uriPatternBlacklist: [],
+ _lastActionBackNav: false,
/**
* Start Quicksand, accepting a fate of eternal torment.
@@ -140,10 +141,12 @@
// the forward button would do something) and we're navigating forward,
// all the stuff ahead of us is about to become unreachable when we
// navigate. Throw it away.
+ self._lastActionBackNav = false;
var discard = (self._history.length - self._cursor) - 1;
for (var ii = 0; ii < discard; ii++) {
var obsolete = self._history.pop();
self._responses[obsolete.id] = false;
+ self._lastActionBackNav = true;
}
// Set up the new state and fire a request to fetch the page data.
@@ -234,7 +237,8 @@
null,
{
newResponse: self._responses[self._current],
- oldResponse: self._responses[self._onpage]
+ oldResponse: self._responses[self._onpage],
+ backNav: self._lastActionBackNav
});
self._onpage = self._current;
diff --git a/webroot/rsrc/js/application/aphlict/behavior-aphlict-dropdown.js b/webroot/rsrc/js/application/aphlict/behavior-aphlict-dropdown.js
--- a/webroot/rsrc/js/application/aphlict/behavior-aphlict-dropdown.js
+++ b/webroot/rsrc/js/application/aphlict/behavior-aphlict-dropdown.js
@@ -28,6 +28,19 @@
JX.Title.setCount(config.countType, config.countNumber);
+ function _updateCount(number) {
+ JX.Title.setCount(config.countType, number);
+
+ var display = (number > 999) ? '\u221E' : number;
+
+ JX.DOM.setContent(count, display);
+ if (number === 0) {
+ JX.DOM.alterClass(bubble, config.unreadClass, false);
+ } else {
+ JX.DOM.alterClass(bubble, config.unreadClass, true);
+ }
+ }
+
function refresh() {
if (dirty) {
JX.DOM.setContent(dropdown, config.loadingText);
@@ -43,16 +56,8 @@
}
request = new JX.Request(config.uri, function(response) {
- JX.Title.setCount(config.countType, response.number);
-
- var display = (response.number > 999) ? '\u221E' : response.number;
-
- JX.DOM.setContent(count, display);
- if (response.number === 0) {
- JX.DOM.alterClass(bubble, config.unreadClass, false);
- } else {
- JX.DOM.alterClass(bubble, config.unreadClass, true);
- }
+ var number = response.number;
+ _updateCount(number);
dirty = false;
JX.DOM.alterClass(
dropdown,
@@ -64,6 +69,35 @@
request.send();
}
+ JX.Stratcom.listen(
+ 'quicksand-redraw',
+ null,
+ function (e) {
+ if (config.local) {
+ return;
+ }
+
+ var data = e.getData();
+ if (data.backNav) {
+ return;
+ }
+ var updated = false;
+ var new_data = data.newResponse.aphlictDropdownData;
+ for (var ii = 0; ii < new_data.length; ii++) {
+ if (new_data[ii].countType != config.countType) {
+ continue;
+ }
+ if (!new_data[ii].isInstalled) {
+ continue;
+ }
+ updated = true;
+ _updateCount(parseInt(new_data[ii].count));
+ }
+ if (updated) {
+ dirty = true;
+ }
+ });
+
function set_visible(menu, icon) {
if (menu) {
statics.visible = {menu: menu, icon: icon};
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Jul 28, 1:05 PM (3 d, 14 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
8675093
Default Alt Text
D12498.id30005.diff (15 KB)
Attached To
Mode
D12498: Quicksand - make notification and message counts update as you navigate around
Attached
Detach File
Event Timeline
Log In to Comment