Add a "Mark All Read" button for notifications
Summary: Adds a button to mark everything as read. Test Plan: Clicked button. Reviewers: btrahan, jungejason, vrana Reviewed By: btrahan CC: aran Maniphest Tasks: T974 Differential Revision: https://secure.phabricator.com/D2812
This commit is contained in:
@@ -746,6 +746,7 @@ phutil_register_library_map(array(
|
|||||||
'PhabricatorMustVerifyEmailController' => 'applications/auth/controller/PhabricatorMustVerifyEmailController.php',
|
'PhabricatorMustVerifyEmailController' => 'applications/auth/controller/PhabricatorMustVerifyEmailController.php',
|
||||||
'PhabricatorMySQLFileStorageEngine' => 'applications/files/engine/PhabricatorMySQLFileStorageEngine.php',
|
'PhabricatorMySQLFileStorageEngine' => 'applications/files/engine/PhabricatorMySQLFileStorageEngine.php',
|
||||||
'PhabricatorNotificationBuilder' => 'applications/notification/builder/PhabricatorNotificationBuilder.php',
|
'PhabricatorNotificationBuilder' => 'applications/notification/builder/PhabricatorNotificationBuilder.php',
|
||||||
|
'PhabricatorNotificationClearController' => 'applications/notification/controller/PhabricatorNotificationClearController.php',
|
||||||
'PhabricatorNotificationController' => 'applications/notification/controller/PhabricatorNotificationController.php',
|
'PhabricatorNotificationController' => 'applications/notification/controller/PhabricatorNotificationController.php',
|
||||||
'PhabricatorNotificationIndividualController' => 'applications/notification/controller/PhabricatorNotificationIndividualController.php',
|
'PhabricatorNotificationIndividualController' => 'applications/notification/controller/PhabricatorNotificationIndividualController.php',
|
||||||
'PhabricatorNotificationListController' => 'applications/notification/controller/PhabricatorNotificationListController.php',
|
'PhabricatorNotificationListController' => 'applications/notification/controller/PhabricatorNotificationListController.php',
|
||||||
@@ -1722,6 +1723,7 @@ phutil_register_library_map(array(
|
|||||||
'PhabricatorMetaMTAWorker' => 'PhabricatorWorker',
|
'PhabricatorMetaMTAWorker' => 'PhabricatorWorker',
|
||||||
'PhabricatorMustVerifyEmailController' => 'PhabricatorAuthController',
|
'PhabricatorMustVerifyEmailController' => 'PhabricatorAuthController',
|
||||||
'PhabricatorMySQLFileStorageEngine' => 'PhabricatorFileStorageEngine',
|
'PhabricatorMySQLFileStorageEngine' => 'PhabricatorFileStorageEngine',
|
||||||
|
'PhabricatorNotificationClearController' => 'PhabricatorNotificationController',
|
||||||
'PhabricatorNotificationController' => 'PhabricatorController',
|
'PhabricatorNotificationController' => 'PhabricatorController',
|
||||||
'PhabricatorNotificationIndividualController' => 'PhabricatorNotificationController',
|
'PhabricatorNotificationIndividualController' => 'PhabricatorNotificationController',
|
||||||
'PhabricatorNotificationListController' => 'PhabricatorNotificationController',
|
'PhabricatorNotificationListController' => 'PhabricatorNotificationController',
|
||||||
|
|||||||
@@ -431,6 +431,7 @@ class AphrontDefaultApplicationConfiguration
|
|||||||
'panel/' => 'PhabricatorNotificationPanelController',
|
'panel/' => 'PhabricatorNotificationPanelController',
|
||||||
'individual/' => 'PhabricatorNotificationIndividualController',
|
'individual/' => 'PhabricatorNotificationIndividualController',
|
||||||
'status/' => 'PhabricatorNotificationStatusController',
|
'status/' => 'PhabricatorNotificationStatusController',
|
||||||
|
'clear/' => 'PhabricatorNotificationClearController',
|
||||||
),
|
),
|
||||||
|
|
||||||
'/flag/' => array(
|
'/flag/' => array(
|
||||||
|
|||||||
@@ -0,0 +1,50 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright 2012 Facebook, Inc.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
final class PhabricatorNotificationClearController
|
||||||
|
extends PhabricatorNotificationController {
|
||||||
|
|
||||||
|
public function processRequest() {
|
||||||
|
$request = $this->getRequest();
|
||||||
|
$user = $request->getUser();
|
||||||
|
|
||||||
|
if ($request->isDialogFormPost()) {
|
||||||
|
$table = new PhabricatorFeedStoryNotification();
|
||||||
|
|
||||||
|
queryfx(
|
||||||
|
$table->establishConnection('w'),
|
||||||
|
'UPDATE %T SET hasViewed = 1 WHERE
|
||||||
|
userPHID = %s AND hasViewed = 0',
|
||||||
|
$table->getTableName(),
|
||||||
|
$user->getPHID());
|
||||||
|
|
||||||
|
return id(new AphrontReloadResponse())
|
||||||
|
->setURI('/notification/');
|
||||||
|
}
|
||||||
|
|
||||||
|
$dialog = new AphrontDialogView();
|
||||||
|
$dialog->setUser($user);
|
||||||
|
$dialog->setTitle('Really mark all notifications as read?');
|
||||||
|
$dialog->appendChild(
|
||||||
|
"You can't ignore your problems forever, you know.");
|
||||||
|
$dialog->addCancelButton('/notification/');
|
||||||
|
$dialog->addSubmitButton('Mark All Read');
|
||||||
|
|
||||||
|
return id(new AphrontDialogResponse())->setDialog($dialog);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -43,6 +43,15 @@ final class PhabricatorNotificationListController
|
|||||||
|
|
||||||
$panel = new AphrontPanelView();
|
$panel = new AphrontPanelView();
|
||||||
$panel->setHeader('Notifications');
|
$panel->setHeader('Notifications');
|
||||||
|
$panel->addButton(
|
||||||
|
javelin_render_tag(
|
||||||
|
'a',
|
||||||
|
array(
|
||||||
|
'href' => '/notification/clear/',
|
||||||
|
'class' => 'button',
|
||||||
|
'sigil' => 'workflow',
|
||||||
|
),
|
||||||
|
'Mark All Read'));
|
||||||
$panel->appendChild($view);
|
$panel->appendChild($view);
|
||||||
$panel->appendChild($pager);
|
$panel->appendChild($pager);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user