mirror of
https://we.phorge.it/source/phorge.git
synced 2025-01-22 12:41:19 +01:00
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:
parent
5e184ee593
commit
083cd5fd9d
4 changed files with 62 additions and 0 deletions
|
@ -746,6 +746,7 @@ phutil_register_library_map(array(
|
|||
'PhabricatorMustVerifyEmailController' => 'applications/auth/controller/PhabricatorMustVerifyEmailController.php',
|
||||
'PhabricatorMySQLFileStorageEngine' => 'applications/files/engine/PhabricatorMySQLFileStorageEngine.php',
|
||||
'PhabricatorNotificationBuilder' => 'applications/notification/builder/PhabricatorNotificationBuilder.php',
|
||||
'PhabricatorNotificationClearController' => 'applications/notification/controller/PhabricatorNotificationClearController.php',
|
||||
'PhabricatorNotificationController' => 'applications/notification/controller/PhabricatorNotificationController.php',
|
||||
'PhabricatorNotificationIndividualController' => 'applications/notification/controller/PhabricatorNotificationIndividualController.php',
|
||||
'PhabricatorNotificationListController' => 'applications/notification/controller/PhabricatorNotificationListController.php',
|
||||
|
@ -1722,6 +1723,7 @@ phutil_register_library_map(array(
|
|||
'PhabricatorMetaMTAWorker' => 'PhabricatorWorker',
|
||||
'PhabricatorMustVerifyEmailController' => 'PhabricatorAuthController',
|
||||
'PhabricatorMySQLFileStorageEngine' => 'PhabricatorFileStorageEngine',
|
||||
'PhabricatorNotificationClearController' => 'PhabricatorNotificationController',
|
||||
'PhabricatorNotificationController' => 'PhabricatorController',
|
||||
'PhabricatorNotificationIndividualController' => 'PhabricatorNotificationController',
|
||||
'PhabricatorNotificationListController' => 'PhabricatorNotificationController',
|
||||
|
|
|
@ -431,6 +431,7 @@ class AphrontDefaultApplicationConfiguration
|
|||
'panel/' => 'PhabricatorNotificationPanelController',
|
||||
'individual/' => 'PhabricatorNotificationIndividualController',
|
||||
'status/' => 'PhabricatorNotificationStatusController',
|
||||
'clear/' => 'PhabricatorNotificationClearController',
|
||||
),
|
||||
|
||||
'/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->setHeader('Notifications');
|
||||
$panel->addButton(
|
||||
javelin_render_tag(
|
||||
'a',
|
||||
array(
|
||||
'href' => '/notification/clear/',
|
||||
'class' => 'button',
|
||||
'sigil' => 'workflow',
|
||||
),
|
||||
'Mark All Read'));
|
||||
$panel->appendChild($view);
|
||||
$panel->appendChild($pager);
|
||||
|
||||
|
|
Loading…
Reference in a new issue