mirror of
https://we.phorge.it/source/phorge.git
synced 2025-01-01 18:30:59 +01:00
Update Notifications for handleRequest
Summary: Updates Notifcations for handleRequest Test Plan: Test as much as I could, mark all, view, lists. Reviewers: epriestley Reviewed By: epriestley Subscribers: epriestley, Korvin Maniphest Tasks: T8628 Differential Revision: https://secure.phabricator.com/D13767
This commit is contained in:
parent
ba2cc4f2ee
commit
f5be68c59c
6 changed files with 20 additions and 28 deletions
|
@ -3,10 +3,9 @@
|
||||||
final class PhabricatorNotificationClearController
|
final class PhabricatorNotificationClearController
|
||||||
extends PhabricatorNotificationController {
|
extends PhabricatorNotificationController {
|
||||||
|
|
||||||
public function processRequest() {
|
public function handleRequest(AphrontRequest $request) {
|
||||||
$request = $this->getRequest();
|
$viewer = $request->getViewer();
|
||||||
$chrono_key = $request->getStr('chronoKey');
|
$chrono_key = $request->getStr('chronoKey');
|
||||||
$user = $request->getUser();
|
|
||||||
|
|
||||||
if ($request->isDialogFormPost()) {
|
if ($request->isDialogFormPost()) {
|
||||||
$table = new PhabricatorFeedStoryNotification();
|
$table = new PhabricatorFeedStoryNotification();
|
||||||
|
@ -16,7 +15,7 @@ final class PhabricatorNotificationClearController
|
||||||
'UPDATE %T SET hasViewed = 1 '.
|
'UPDATE %T SET hasViewed = 1 '.
|
||||||
'WHERE userPHID = %s AND hasViewed = 0 and chronologicalKey <= %s',
|
'WHERE userPHID = %s AND hasViewed = 0 and chronologicalKey <= %s',
|
||||||
$table->getTableName(),
|
$table->getTableName(),
|
||||||
$user->getPHID(),
|
$viewer->getPHID(),
|
||||||
$chrono_key);
|
$chrono_key);
|
||||||
|
|
||||||
return id(new AphrontReloadResponse())
|
return id(new AphrontReloadResponse())
|
||||||
|
@ -24,7 +23,7 @@ final class PhabricatorNotificationClearController
|
||||||
}
|
}
|
||||||
|
|
||||||
$dialog = new AphrontDialogView();
|
$dialog = new AphrontDialogView();
|
||||||
$dialog->setUser($user);
|
$dialog->setUser($viewer);
|
||||||
$dialog->addCancelButton('/notification/');
|
$dialog->addCancelButton('/notification/');
|
||||||
if ($chrono_key) {
|
if ($chrono_key) {
|
||||||
$dialog->setTitle(pht('Really mark all notifications as read?'));
|
$dialog->setTitle(pht('Really mark all notifications as read?'));
|
||||||
|
|
|
@ -3,9 +3,8 @@
|
||||||
final class PhabricatorNotificationIndividualController
|
final class PhabricatorNotificationIndividualController
|
||||||
extends PhabricatorNotificationController {
|
extends PhabricatorNotificationController {
|
||||||
|
|
||||||
public function processRequest() {
|
public function handleRequest(AphrontRequest $request) {
|
||||||
$request = $this->getRequest();
|
$viewer = $request->getViewer();
|
||||||
$viewer = $request->getUser();
|
|
||||||
|
|
||||||
$stories = id(new PhabricatorNotificationQuery())
|
$stories = id(new PhabricatorNotificationQuery())
|
||||||
->setViewer($viewer)
|
->setViewer($viewer)
|
||||||
|
|
|
@ -3,15 +3,11 @@
|
||||||
final class PhabricatorNotificationListController
|
final class PhabricatorNotificationListController
|
||||||
extends PhabricatorNotificationController {
|
extends PhabricatorNotificationController {
|
||||||
|
|
||||||
private $queryKey;
|
public function handleRequest(AphrontRequest $request) {
|
||||||
|
$querykey = $request->getURIData('queryKey');
|
||||||
|
|
||||||
public function willProcessRequest(array $data) {
|
|
||||||
$this->queryKey = idx($data, 'queryKey');
|
|
||||||
}
|
|
||||||
|
|
||||||
public function processRequest() {
|
|
||||||
$controller = id(new PhabricatorApplicationSearchController())
|
$controller = id(new PhabricatorApplicationSearchController())
|
||||||
->setQueryKey($this->queryKey)
|
->setQueryKey($querykey)
|
||||||
->setSearchEngine(new PhabricatorNotificationSearchEngine())
|
->setSearchEngine(new PhabricatorNotificationSearchEngine())
|
||||||
->setNavigation($this->buildSideNavView());
|
->setNavigation($this->buildSideNavView());
|
||||||
|
|
||||||
|
@ -19,13 +15,13 @@ final class PhabricatorNotificationListController
|
||||||
}
|
}
|
||||||
|
|
||||||
public function buildSideNavView() {
|
public function buildSideNavView() {
|
||||||
$user = $this->getRequest()->getUser();
|
$viewer = $this->getViewer();
|
||||||
|
|
||||||
$nav = new AphrontSideNavFilterView();
|
$nav = new AphrontSideNavFilterView();
|
||||||
$nav->setBaseURI(new PhutilURI($this->getApplicationURI()));
|
$nav->setBaseURI(new PhutilURI($this->getApplicationURI()));
|
||||||
|
|
||||||
id(new PhabricatorNotificationSearchEngine())
|
id(new PhabricatorNotificationSearchEngine())
|
||||||
->setViewer($user)
|
->setViewer($viewer)
|
||||||
->addNavigationItems($nav->getMenu());
|
->addNavigationItems($nav->getMenu());
|
||||||
$nav->selectFilter(null);
|
$nav->selectFilter(null);
|
||||||
|
|
||||||
|
|
|
@ -3,14 +3,12 @@
|
||||||
final class PhabricatorNotificationPanelController
|
final class PhabricatorNotificationPanelController
|
||||||
extends PhabricatorNotificationController {
|
extends PhabricatorNotificationController {
|
||||||
|
|
||||||
public function processRequest() {
|
public function handleRequest(AphrontRequest $request) {
|
||||||
|
$viewer = $request->getViewer();
|
||||||
$request = $this->getRequest();
|
|
||||||
$user = $request->getUser();
|
|
||||||
|
|
||||||
$query = id(new PhabricatorNotificationQuery())
|
$query = id(new PhabricatorNotificationQuery())
|
||||||
->setViewer($user)
|
->setViewer($viewer)
|
||||||
->withUserPHIDs(array($user->getPHID()))
|
->withUserPHIDs(array($viewer->getPHID()))
|
||||||
->setLimit(15);
|
->setLimit(15);
|
||||||
|
|
||||||
$stories = $query->execute();
|
$stories = $query->execute();
|
||||||
|
@ -81,7 +79,7 @@ final class PhabricatorNotificationPanelController
|
||||||
$connection_ui);
|
$connection_ui);
|
||||||
|
|
||||||
$unread_count = id(new PhabricatorFeedStoryNotification())
|
$unread_count = id(new PhabricatorFeedStoryNotification())
|
||||||
->countUnread($user);
|
->countUnread($viewer);
|
||||||
|
|
||||||
$json = array(
|
$json = array(
|
||||||
'content' => $content,
|
'content' => $content,
|
||||||
|
|
|
@ -3,7 +3,8 @@
|
||||||
final class PhabricatorNotificationStatusController
|
final class PhabricatorNotificationStatusController
|
||||||
extends PhabricatorNotificationController {
|
extends PhabricatorNotificationController {
|
||||||
|
|
||||||
public function processRequest() {
|
public function handleRequest(AphrontRequest $request) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$status = PhabricatorNotificationClient::getServerStatus();
|
$status = PhabricatorNotificationClient::getServerStatus();
|
||||||
$status = $this->renderServerStatus($status);
|
$status = $this->renderServerStatus($status);
|
||||||
|
|
|
@ -3,9 +3,8 @@
|
||||||
final class PhabricatorNotificationTestController
|
final class PhabricatorNotificationTestController
|
||||||
extends PhabricatorNotificationController {
|
extends PhabricatorNotificationController {
|
||||||
|
|
||||||
public function processRequest() {
|
public function handleRequest(AphrontRequest $request) {
|
||||||
$request = $this->getRequest();
|
$viewer = $request->getViewer();
|
||||||
$viewer = $request->getUser();
|
|
||||||
|
|
||||||
$story_type = 'PhabricatorNotificationTestFeedStory';
|
$story_type = 'PhabricatorNotificationTestFeedStory';
|
||||||
$story_data = array(
|
$story_data = array(
|
||||||
|
|
Loading…
Reference in a new issue