Page MenuHomePhabricator

D18133.id43629.diff
No OneTemporary

D18133.id43629.diff

diff --git a/resources/celerity/map.php b/resources/celerity/map.php
--- a/resources/celerity/map.php
+++ b/resources/celerity/map.php
@@ -9,8 +9,8 @@
'names' => array(
'conpherence.pkg.css' => 'ff161f2d',
'conpherence.pkg.js' => 'b5b51108',
- 'core.pkg.css' => 'ab24402f',
- 'core.pkg.js' => '5d80e0db',
+ 'core.pkg.css' => '2abc4421',
+ 'core.pkg.js' => 'ab80f44d',
'darkconsole.pkg.js' => '1f9a31bc',
'differential.pkg.css' => '4ec4a37a',
'differential.pkg.js' => 'd4ab0e81',
@@ -40,7 +40,7 @@
'rsrc/css/application/almanac/almanac.css' => 'dbb9b3af',
'rsrc/css/application/auth/auth.css' => '0877ed6e',
'rsrc/css/application/base/main-menu-view.css' => '16053029',
- 'rsrc/css/application/base/notification-menu.css' => '6a697e43',
+ 'rsrc/css/application/base/notification-menu.css' => '5497b55e',
'rsrc/css/application/base/phui-theme.css' => '9f261c6b',
'rsrc/css/application/base/standard-page-view.css' => 'eb5b80c5',
'rsrc/css/application/chatlog/chatlog.css' => 'd295b020',
@@ -373,7 +373,7 @@
'rsrc/image/texture/table_header_hover.png' => '038ec3b9',
'rsrc/image/texture/table_header_tall.png' => 'd56b434f',
'rsrc/js/application/aphlict/Aphlict.js' => 'e1d4b11a',
- 'rsrc/js/application/aphlict/behavior-aphlict-dropdown.js' => 'caade6f2',
+ 'rsrc/js/application/aphlict/behavior-aphlict-dropdown.js' => 'e9978940',
'rsrc/js/application/aphlict/behavior-aphlict-listen.js' => '3c547a81',
'rsrc/js/application/aphlict/behavior-aphlict-status.js' => '5e2634b9',
'rsrc/js/application/aphlict/behavior-desktop-notifications-control.js' => 'd5a2d665',
@@ -584,7 +584,7 @@
'inline-comment-summary-css' => '51efda3a',
'javelin-aphlict' => 'e1d4b11a',
'javelin-behavior' => '61cbc29a',
- 'javelin-behavior-aphlict-dropdown' => 'caade6f2',
+ 'javelin-behavior-aphlict-dropdown' => 'e9978940',
'javelin-behavior-aphlict-listen' => '3c547a81',
'javelin-behavior-aphlict-status' => '5e2634b9',
'javelin-behavior-aphront-basic-tokenizer' => 'b3a4b884',
@@ -791,7 +791,7 @@
'phabricator-nav-view-css' => 'faf6a6fc',
'phabricator-notification' => 'ccf1cbf8',
'phabricator-notification-css' => '3f6c89c9',
- 'phabricator-notification-menu-css' => '6a697e43',
+ 'phabricator-notification-menu-css' => '5497b55e',
'phabricator-object-selector-css' => '85ee8ce6',
'phabricator-phtize' => 'd254d646',
'phabricator-prefab' => 'c5af80a2',
@@ -1943,17 +1943,6 @@
'phabricator-shaped-request',
'conpherence-thread-manager',
),
- 'caade6f2' => array(
- 'javelin-behavior',
- 'javelin-request',
- 'javelin-stratcom',
- 'javelin-vector',
- 'javelin-dom',
- 'javelin-uri',
- 'javelin-behavior-device',
- 'phabricator-title',
- 'phabricator-favicon',
- ),
'cae95e89' => array(
'syntax-default-css',
),
@@ -2101,6 +2090,17 @@
'javelin-dom',
'phabricator-draggable-list',
),
+ 'e9978940' => array(
+ 'javelin-behavior',
+ 'javelin-request',
+ 'javelin-stratcom',
+ 'javelin-vector',
+ 'javelin-dom',
+ 'javelin-uri',
+ 'javelin-behavior-device',
+ 'phabricator-title',
+ 'phabricator-favicon',
+ ),
'edf8a145' => array(
'javelin-behavior',
'javelin-uri',
diff --git a/src/applications/notification/controller/PhabricatorNotificationClearController.php b/src/applications/notification/controller/PhabricatorNotificationClearController.php
--- a/src/applications/notification/controller/PhabricatorNotificationClearController.php
+++ b/src/applications/notification/controller/PhabricatorNotificationClearController.php
@@ -6,52 +6,28 @@
public function handleRequest(AphrontRequest $request) {
$viewer = $request->getViewer();
$chrono_key = $request->getStr('chronoKey');
+ $redirect = $request->getBool('redirect');
- if ($request->isDialogFormPost()) {
- $table = new PhabricatorFeedStoryNotification();
+ $table = new PhabricatorFeedStoryNotification();
- queryfx(
- $table->establishConnection('w'),
- 'UPDATE %T SET hasViewed = 1 '.
- 'WHERE userPHID = %s AND hasViewed = 0 and chronologicalKey <= %s',
- $table->getTableName(),
- $viewer->getPHID(),
- $chrono_key);
+ queryfx(
+ $table->establishConnection('w'),
+ 'UPDATE %T SET hasViewed = 1 '.
+ 'WHERE userPHID = %s AND hasViewed = 0 and chronologicalKey <= %s',
+ $table->getTableName(),
+ $viewer->getPHID(),
+ $chrono_key);
- PhabricatorUserCache::clearCache(
- PhabricatorUserNotificationCountCacheType::KEY_COUNT,
- $viewer->getPHID());
+ PhabricatorUserCache::clearCache(
+ PhabricatorUserNotificationCountCacheType::KEY_COUNT,
+ $viewer->getPHID());
+ // Redirect back to page if on ApplicationSearch
+ if ($redirect) {
return id(new AphrontReloadResponse())
->setURI('/notification/');
}
- $dialog = new AphrontDialogView();
- $dialog->setUser($viewer);
- $dialog->addCancelButton('/notification/');
- if ($chrono_key) {
- $dialog->setTitle(pht('Really mark all notifications as read?'));
- $dialog->addHiddenInput('chronoKey', $chrono_key);
-
- $is_serious =
- PhabricatorEnv::getEnvConfig('phabricator.serious-business');
- if ($is_serious) {
- $dialog->appendChild(
- pht(
- 'All unread notifications will be marked as read. You can not '.
- 'undo this action.'));
- } else {
- $dialog->appendChild(
- pht(
- "You can't ignore your problems forever, you know."));
- }
-
- $dialog->addSubmitButton(pht('Mark All Read'));
- } else {
- $dialog->setTitle(pht('No notifications to mark as read.'));
- $dialog->appendChild(pht('You have no unread notifications.'));
- }
-
- return id(new AphrontDialogResponse())->setDialog($dialog);
+ return id(new AphrontAjaxResponse())->setContent(array());
}
}
diff --git a/src/applications/notification/controller/PhabricatorNotificationPanelController.php b/src/applications/notification/controller/PhabricatorNotificationPanelController.php
--- a/src/applications/notification/controller/PhabricatorNotificationPanelController.php
+++ b/src/applications/notification/controller/PhabricatorNotificationPanelController.php
@@ -14,27 +14,27 @@
$stories = $query->execute();
$clear_ui_class = 'phabricator-notification-clear-all';
- $clear_uri = id(new PhutilURI('/notification/clear/'));
+ $clear_ui = null;
if ($stories) {
$builder = id(new PhabricatorNotificationBuilder($stories))
->setUser($viewer);
-
$notifications_view = $builder->buildView();
$content = $notifications_view->render();
- $clear_uri->setQueryParam(
- 'chronoKey',
- head($stories)->getChronologicalKey());
+
} else {
$content = phutil_tag_div(
'phabricator-notification no-notifications',
pht('You have no notifications.'));
$clear_ui_class .= ' disabled';
}
- $clear_ui = javelin_tag(
- 'a',
+
+ $chrono_key = head($stories)->getChronologicalKey();
+ $clear_ui = phabricator_form(
+ $viewer,
array(
- 'sigil' => 'workflow',
- 'href' => (string)$clear_uri,
+ 'method' => 'POST',
+ 'action' => '/notification/clear/?chronoKey='.$chrono_key,
+ 'sigil' => 'notifications-clear-all-form',
'class' => $clear_ui_class,
),
pht('Mark All Read'));
diff --git a/src/applications/notification/query/PhabricatorNotificationSearchEngine.php b/src/applications/notification/query/PhabricatorNotificationSearchEngine.php
--- a/src/applications/notification/query/PhabricatorNotificationSearchEngine.php
+++ b/src/applications/notification/query/PhabricatorNotificationSearchEngine.php
@@ -107,6 +107,7 @@
$clear_uri = id(new PhutilURI('/notification/clear/'));
if ($notifications) {
+ $chrono_key = head($notifications)->getChronologicalKey();
$builder = id(new PhabricatorNotificationBuilder($notifications))
->setUser($viewer);
@@ -114,6 +115,9 @@
$clear_uri->setQueryParam(
'chronoKey',
head($notifications)->getChronologicalKey());
+ $clear_uri->setQueryParam(
+ 'redirect',
+ true);
} else {
$view = phutil_tag_div(
'phabricator-notification no-notifications',
diff --git a/webroot/rsrc/css/application/base/notification-menu.css b/webroot/rsrc/css/application/base/notification-menu.css
--- a/webroot/rsrc/css/application/base/notification-menu.css
+++ b/webroot/rsrc/css/application/base/notification-menu.css
@@ -100,6 +100,15 @@
color: {$anchor};
float: right;
font-weight: normal;
+ cursor: pointer;
+}
+
+.phabricator-notification-header .phabricator-notification-clear-all.disabled {
+ color: {$greytext};
+}
+
+.phabricator-notification-header .phabricator-notification-clear-all:hover {
+ text-decoration: underline;
}
.phabricator-notification-footer {
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
@@ -234,4 +234,25 @@
JX.Stratcom.listen('notification-panel-close', null, function() {
set_visible(null);
});
+
+ function onClearAllResponse(r) {
+ _updateCount(0);
+ refresh();
+ }
+
+ function _clearAllNotifications(e) {
+ e.kill();
+ var form = e.getNode('tag:form');
+ new JX.Workflow(form.getAttribute('action'), {});
+ JX.Workflow.newFromForm(form)
+ .setHandler(onClearAllResponse)
+ .start();
+ }
+
+ JX.Stratcom.listen(
+ 'click',
+ 'notifications-clear-all-form',
+ _clearAllNotifications);
+
+
});

File Metadata

Mime Type
text/plain
Expires
Sat, Apr 19, 8:56 AM (3 d, 22 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7797899
Default Alt Text
D18133.id43629.diff (9 KB)

Event Timeline