Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14014632
D16733.id40293.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
7 KB
Referenced Files
None
Subscribers
None
D16733.id40293.diff
View Options
diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -2280,6 +2280,7 @@
'PhabricatorConpherenceColumnMinimizeSetting' => 'applications/settings/setting/PhabricatorConpherenceColumnMinimizeSetting.php',
'PhabricatorConpherenceColumnVisibleSetting' => 'applications/settings/setting/PhabricatorConpherenceColumnVisibleSetting.php',
'PhabricatorConpherenceNotificationsSetting' => 'applications/settings/setting/PhabricatorConpherenceNotificationsSetting.php',
+ 'PhabricatorConpherenceParticipantSetting' => 'applications/settings/setting/PhabricatorConpherenceParticipantSetting.php',
'PhabricatorConpherencePreferencesSettingsPanel' => 'applications/settings/panel/PhabricatorConpherencePreferencesSettingsPanel.php',
'PhabricatorConpherenceThreadPHIDType' => 'applications/conpherence/phid/PhabricatorConpherenceThreadPHIDType.php',
'PhabricatorConpherenceWidgetVisibleSetting' => 'applications/settings/setting/PhabricatorConpherenceWidgetVisibleSetting.php',
@@ -7142,6 +7143,7 @@
'PhabricatorConpherenceColumnMinimizeSetting' => 'PhabricatorInternalSetting',
'PhabricatorConpherenceColumnVisibleSetting' => 'PhabricatorInternalSetting',
'PhabricatorConpherenceNotificationsSetting' => 'PhabricatorSelectSetting',
+ 'PhabricatorConpherenceParticipantSetting' => 'PhabricatorSelectSetting',
'PhabricatorConpherencePreferencesSettingsPanel' => 'PhabricatorEditEngineSettingsPanel',
'PhabricatorConpherenceThreadPHIDType' => 'PhabricatorPHIDType',
'PhabricatorConpherenceWidgetVisibleSetting' => 'PhabricatorInternalSetting',
diff --git a/src/applications/conpherence/editor/ConpherenceEditor.php b/src/applications/conpherence/editor/ConpherenceEditor.php
--- a/src/applications/conpherence/editor/ConpherenceEditor.php
+++ b/src/applications/conpherence/editor/ConpherenceEditor.php
@@ -478,6 +478,16 @@
return $to_phids;
}
+ switch ($xaction->getTransactionType()) {
+ case ConpherenceTransaction::TYPE_PARTICIPANTS:
+ $old_map = array_fuse($xaction->getOldValue());
+ $new_map = array_fuse($xaction->getNewValue());
+
+ $add = array_keys(array_diff_key($new_map, $old_map));
+ $rem = array_keys(array_diff_key($old_map, $new_map));
+ break;
+ }
+
$participant_phids = mpull($participants, 'getParticipantPHID');
$users = id(new PhabricatorPeopleQuery())
@@ -487,27 +497,40 @@
->execute();
$users = mpull($users, null, 'getPHID');
- $notification_key = PhabricatorConpherenceNotificationsSetting::SETTINGKEY;
- $notification_email =
+ $new_message_key = PhabricatorConpherenceNotificationsSetting::SETTINGKEY;
+ $new_message_email =
PhabricatorConpherenceNotificationsSetting::VALUE_CONPHERENCE_EMAIL;
+ $status_key = PhabricatorConpherenceParticipantSetting::SETTINGKEY;
+ $status_email =
+ PhabricatorConpherenceParticipantSetting::VALUE_CONPHERENCE_PART_EMAIL;
+
foreach ($participants as $phid => $participant) {
$user = idx($users, $phid);
if ($user) {
- $default = $user->getUserSetting($notification_key);
+ $default = $user->getUserSetting($new_message_key);
+ $default_status = $user->getUserSetting($status_key);
} else {
- $default = $notification_email;
+ $default = $new_message_email;
}
$settings = $participant->getSettings();
$notifications = idx($settings, 'notifications', $default);
- if ($notifications == $notification_email) {
+ if ($notifications == $new_message_email) {
$to_phids[] = $phid;
}
+
+ $joined = (($add === array($phid)) && !$rem);
+ $left = (($rem === array($phid)) && !$add);
+
+ if (($left || $joined) && ($default_status == $status_email)) {
+ $to_phids[] = $phid;
+ }
+
}
- return $to_phids;
+ return array_unique($to_phids);
}
protected function getMailCC(PhabricatorLiskDAO $object) {
diff --git a/src/applications/settings/setting/PhabricatorConpherenceNotificationsSetting.php b/src/applications/settings/setting/PhabricatorConpherenceNotificationsSetting.php
--- a/src/applications/settings/setting/PhabricatorConpherenceNotificationsSetting.php
+++ b/src/applications/settings/setting/PhabricatorConpherenceNotificationsSetting.php
@@ -9,7 +9,7 @@
const VALUE_CONPHERENCE_NOTIFY = '1';
public function getSettingName() {
- return pht('Conpherence Notifications');
+ return pht('New Message');
}
public function getSettingPanelKey() {
@@ -18,7 +18,7 @@
protected function getControlInstructions() {
return pht(
- 'Choose the default notification behavior for Conpherence rooms.');
+ 'Choose the default new message behavior for Conpherence rooms.');
}
protected function isEnabledForViewer(PhabricatorUser $viewer) {
@@ -28,7 +28,7 @@
}
public function getSettingDefaultValue() {
- return self::VALUE_CONPHERENCE_EMAIL;
+ return self::VALUE_CONPHERENCE_NOTIFY;
}
protected function getSelectOptions() {
diff --git a/src/applications/settings/setting/PhabricatorConpherenceNotificationsSetting.php b/src/applications/settings/setting/PhabricatorConpherenceParticipantSetting.php
copy from src/applications/settings/setting/PhabricatorConpherenceNotificationsSetting.php
copy to src/applications/settings/setting/PhabricatorConpherenceParticipantSetting.php
--- a/src/applications/settings/setting/PhabricatorConpherenceNotificationsSetting.php
+++ b/src/applications/settings/setting/PhabricatorConpherenceParticipantSetting.php
@@ -1,15 +1,15 @@
<?php
-final class PhabricatorConpherenceNotificationsSetting
+final class PhabricatorConpherenceParticipantSetting
extends PhabricatorSelectSetting {
- const SETTINGKEY = 'conph-notifications';
+ const SETTINGKEY = 'conph-participant-notifications';
- const VALUE_CONPHERENCE_EMAIL = '0';
- const VALUE_CONPHERENCE_NOTIFY = '1';
+ const VALUE_CONPHERENCE_PART_EMAIL = '0';
+ const VALUE_CONPHERENCE_PART_NOTIFY = '1';
public function getSettingName() {
- return pht('Conpherence Notifications');
+ return pht('Participation Status');
}
public function getSettingPanelKey() {
@@ -18,7 +18,8 @@
protected function getControlInstructions() {
return pht(
- 'Choose the default notification behavior for Conpherence rooms.');
+ 'Choose the default notification behavior for being added or removed '.
+ 'from Conpherence rooms.');
}
protected function isEnabledForViewer(PhabricatorUser $viewer) {
@@ -28,7 +29,7 @@
}
public function getSettingDefaultValue() {
- return self::VALUE_CONPHERENCE_EMAIL;
+ return self::VALUE_CONPHERENCE_PART_EMAIL;
}
protected function getSelectOptions() {
@@ -42,8 +43,8 @@
private static function getOptionsMap() {
return array(
- self::VALUE_CONPHERENCE_EMAIL => pht('Send Email'),
- self::VALUE_CONPHERENCE_NOTIFY => pht('Send Notifications'),
+ self::VALUE_CONPHERENCE_PART_EMAIL => pht('Send Email'),
+ self::VALUE_CONPHERENCE_PART_NOTIFY => pht('Send Notification'),
);
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Nov 4, 6:26 AM (1 d, 15 m ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6758252
Default Alt Text
D16733.id40293.diff (7 KB)
Attached To
Mode
D16733: Make notification default for Conpherence
Attached
Detach File
Event Timeline
Log In to Comment