1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-12 18:02:40 +01:00

Enable notifications by default

Summary: I think we've sorted out enough of the problems with these to turn them on for everyone. The real-time component remains configuration-dependent.

Test Plan: Turned off "notification.enabled", still saw notifications.

Reviewers: btrahan, chad

Reviewed By: btrahan

CC: aran

Differential Revision: https://secure.phabricator.com/D4120
This commit is contained in:
epriestley 2012-12-07 16:27:01 -08:00
parent 92678eb050
commit bf9bc885b7
6 changed files with 37 additions and 39 deletions

View file

@ -191,7 +191,10 @@ return array(
// -- Notifications --------------------------------------------------------- // // -- Notifications --------------------------------------------------------- //
'notification.enabled' => false, // Set this to true to enable real-time notifications. You must also run a
// notification server for this to work. Consult the documentation in
// "Notifications User Guide: Setup and Configuration" for instructions.
'notification.enabled' => false,
// Client port for the realtime server to listen on, and for realtime clients // Client port for the realtime server to listen on, and for realtime clients
// to connect to. Use "localhost" if you are running the notification server // to connect to. Use "localhost" if you are running the notification server

View file

@ -99,8 +99,8 @@ final class PhabricatorFeedStoryPublisher {
implode(', ', $sql)); implode(', ', $sql));
} }
$this->insertNotifications($chrono_key);
if (PhabricatorEnv::getEnvConfig('notification.enabled')) { if (PhabricatorEnv::getEnvConfig('notification.enabled')) {
$this->insertNotifications($chrono_key);
$this->sendNotification($chrono_key); $this->sendNotification($chrono_key);
} }

View file

@ -18,25 +18,23 @@ final class PhabricatorFeedStoryNotification extends PhabricatorFeedDAO {
PhabricatorUser $user, PhabricatorUser $user,
$object_phid) { $object_phid) {
if (PhabricatorEnv::getEnvConfig('notification.enabled')) { $unguarded = AphrontWriteGuard::beginScopedUnguardedWrites();
$unguarded = AphrontWriteGuard::beginScopedUnguardedWrites();
$notification_table = new PhabricatorFeedStoryNotification(); $notification_table = new PhabricatorFeedStoryNotification();
$conn = $notification_table->establishConnection('w'); $conn = $notification_table->establishConnection('w');
queryfx( queryfx(
$conn, $conn,
"UPDATE %T "UPDATE %T
SET hasViewed = 1 SET hasViewed = 1
WHERE userPHID = %s WHERE userPHID = %s
AND primaryObjectPHID = %s AND primaryObjectPHID = %s
AND hasViewed = 0", AND hasViewed = 0",
$notification_table->getTableName(), $notification_table->getTableName(),
$user->getPHID(), $user->getPHID(),
$object_phid); $object_phid);
unset($unguarded); unset($unguarded);
}
} }
public function countUnread(PhabricatorUser $user) { public function countUnread(PhabricatorUser $user) {

View file

@ -5,19 +5,20 @@ Guide to setting up notifications.
= Overview = = Overview =
Phabricator can be configured to notify users when events happen in real time, By default, Phabricator delivers information about events (like users creating
so they'll get a message in their browser window if something has happened or tasks or commenting on code reviews) through email and in-application
the object they're looking at has been updated. notifications.
NOTE: This feature is new and still needs some work. Phabricator can also be configured to deliver notifications in real time, by
popping up by popping up a message in any open browser windows if something has
happened or an object has been updated.
= Enabling Notifications = To enable real-time notifications:
To enable notifications, set `notification.enabled` to `true` in your - Set `notification.enabled` in your configuration to true.
configuration. This will enable the notification menu in the menu bar, and - Run the notification server, as described below.
notifications will be published when users take actions.
NOTE: This setting will be turned on for everyone soon. This document describes the process in detail.
= Running the Aphlict Server = = Running the Aphlict Server =
@ -52,7 +53,7 @@ You may want to adjust these settings:
aphlict is restarted. aphlict is restarted.
In most cases, the defaults are appropriate, except that you should set In most cases, the defaults are appropriate, except that you should set
`notification.user` to some valid user so Aphlict isn't running as root. `notification.user` to some valid system user so Aphlict isn't running as root.
== Verifying Server Status == == Verifying Server Status ==
@ -62,13 +63,11 @@ server is working. If it isn't working, you should see an error.
== Testing the Server == == Testing the Server ==
The easiest way to test the server is to open a Maniphest Task or Differential The easiest way to test the server is to have two users login and comment on
Revision in two browser windows at the same time, then comment on it with one. the same Maniphest Task or Differential Revision. They should receive in-browser
You should get a notification in the other window. notifications about the other user's activity.
NOTE: This will stop working soon, since we'll soon stop delivering NOTE: This is cumbersome. There will be better testing tools at some point.
notifications about your own actions. We'll provide an alternate way to test
operation when this stops working.
== Debugging Server Problems == == Debugging Server Problems ==
@ -85,4 +84,4 @@ output in your browser.
The server also generates a log, by default in `/var/log/aphlict.log`. You can The server also generates a log, by default in `/var/log/aphlict.log`. You can
change this location by changing `notification.log` in your configuration. The change this location by changing `notification.log` in your configuration. The
log may contain information useful in resolving issues. log may contain information useful in resolving issues.

View file

@ -323,8 +323,7 @@ final class PhabricatorStandardPageView extends PhabricatorBarePageView {
$user = $request->getUser(); $user = $request->getUser();
$container = null; $container = null;
if (PhabricatorEnv::getEnvConfig('notification.enabled') && if ($user->isLoggedIn()) {
$user->isLoggedIn()) {
$aphlict_object_id = celerity_generate_unique_node_id(); $aphlict_object_id = celerity_generate_unique_node_id();
$aphlict_container_id = celerity_generate_unique_node_id(); $aphlict_container_id = celerity_generate_unique_node_id();

View file

@ -52,8 +52,7 @@ final class PhabricatorMainMenuView extends AphrontView {
$menus = array(); $menus = array();
$alerts = array(); $alerts = array();
if (PhabricatorEnv::getEnvConfig('notification.enabled') && if ($user->isLoggedIn()) {
$user->isLoggedIn()) {
list($menu, $dropdown) = $this->renderNotificationMenu(); list($menu, $dropdown) = $this->renderNotificationMenu();
$alerts[] = $menu; $alerts[] = $menu;
$menus[] = $dropdown; $menus[] = $dropdown;