Page MenuHomePhabricator

D13351.id32301.diff
No OneTemporary

D13351.id32301.diff

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
@@ -239,6 +239,7 @@
'ConpherenceListController' => 'applications/conpherence/controller/ConpherenceListController.php',
'ConpherenceMenuItemView' => 'applications/conpherence/view/ConpherenceMenuItemView.php',
'ConpherenceNewController' => 'applications/conpherence/controller/ConpherenceNewController.php',
+ 'ConpherenceNewMessageController' => 'applications/conpherence/controller/ConpherenceNewMessageController.php',
'ConpherenceNewRoomController' => 'applications/conpherence/controller/ConpherenceNewRoomController.php',
'ConpherenceNotificationPanelController' => 'applications/conpherence/controller/ConpherenceNotificationPanelController.php',
'ConpherenceParticipant' => 'applications/conpherence/storage/ConpherenceParticipant.php',
@@ -3570,6 +3571,7 @@
'ConpherenceListController' => 'ConpherenceController',
'ConpherenceMenuItemView' => 'AphrontTagView',
'ConpherenceNewController' => 'ConpherenceController',
+ 'ConpherenceNewMessageController' => 'ConpherenceController',
'ConpherenceNewRoomController' => 'ConpherenceController',
'ConpherenceNotificationPanelController' => 'ConpherenceController',
'ConpherenceParticipant' => 'ConpherenceDAO',
diff --git a/src/applications/conpherence/application/PhabricatorConpherenceApplication.php b/src/applications/conpherence/application/PhabricatorConpherenceApplication.php
--- a/src/applications/conpherence/application/PhabricatorConpherenceApplication.php
+++ b/src/applications/conpherence/application/PhabricatorConpherenceApplication.php
@@ -11,7 +11,7 @@
}
public function getShortDescription() {
- return pht('Send Messages');
+ return pht('Chat with Others');
}
public function getFontIcon() {
@@ -59,7 +59,7 @@
$items = array();
$item = id(new PHUIListItemView())
- ->setName(pht('Conpherence Thread'))
+ ->setName(pht('Conpherence Room'))
->setIcon('fa-comments')
->setWorkflow(true)
->setHref($this->getBaseURI().'new/');
diff --git a/src/applications/conpherence/controller/ConpherenceController.php b/src/applications/conpherence/controller/ConpherenceController.php
--- a/src/applications/conpherence/controller/ConpherenceController.php
+++ b/src/applications/conpherence/controller/ConpherenceController.php
@@ -16,7 +16,7 @@
$nav = new PHUIListView();
$nav->newLink(
- pht('New Message'),
+ pht('New Room'),
$this->getApplicationURI('new/'));
$nav->addMenuItem(
@@ -58,13 +58,13 @@
$crumbs
->addAction(
id(new PHUIListItemView())
- ->setName(pht('New Message'))
+ ->setName(pht('New Room'))
->setHref($this->getApplicationURI('new/'))
->setIcon('fa-plus-square')
->setWorkflow(true))
->addAction(
id(new PHUIListItemView())
- ->setName(pht('Thread'))
+ ->setName(pht('Room'))
->setHref('#')
->setIcon('fa-bars')
->setStyle('display: none;')
diff --git a/src/applications/conpherence/controller/ConpherenceListController.php b/src/applications/conpherence/controller/ConpherenceListController.php
--- a/src/applications/conpherence/controller/ConpherenceListController.php
+++ b/src/applications/conpherence/controller/ConpherenceListController.php
@@ -34,7 +34,7 @@
$title = pht('Conpherence');
$conpherence = null;
- $limit = ConpherenceThreadListView::SEE_MORE_LIMIT * 5;
+ $limit = (ConpherenceThreadListView::SEE_MORE_LIMIT * 2) + 1;
$all_participation = array();
$mode = $this->determineMode();
@@ -62,9 +62,28 @@
} else {
$menu_participation = $cursor;
}
- $all_participation =
- array($conpherence->getPHID() => $menu_participation) +
- $all_participation;
+
+ // check to see if the loaded conpherence is going to show up
+ // within the SEE_MORE_LIMIT amount of conpherences.
+ // If its not there, then we just pre-pend it as the "first"
+ // conpherence so folks have a navigation item in the menu.
+ $count = 0;
+ $found = false;
+ foreach ($all_participation as $phid => $curr_participation) {
+ if ($conpherence->getPHID() == $phid) {
+ $found = true;
+ break;
+ }
+ $count++;
+ if ($count > ConpherenceThreadListView::SEE_MORE_LIMIT) {
+ break;
+ }
+ }
+ if (!$found) {
+ $all_participation =
+ array($conpherence->getPHID() => $menu_participation) +
+ $all_participation;
+ }
break;
case self::UNSELECTED_MODE:
default:
diff --git a/src/applications/conpherence/controller/ConpherenceNewController.php b/src/applications/conpherence/controller/ConpherenceNewController.php
--- a/src/applications/conpherence/controller/ConpherenceNewController.php
+++ b/src/applications/conpherence/controller/ConpherenceNewController.php
@@ -3,88 +3,70 @@
final class ConpherenceNewController extends ConpherenceController {
public function handleRequest(AphrontRequest $request) {
- $user = $request->getUser();
+ $viewer = $request->getUser();
- $title = pht('New Message');
- $participants = array();
- $participant_prefill = null;
- $message = '';
- $e_participants = null;
- $e_message = null;
- $errors = array();
+ $type = $request->getStr('type');
- // this comes from ajax requests from all over. should be a single phid.
-
- if ($request->isFormPost()) {
- $participants = $request->getArr('participants');
- $message = $request->getStr('message');
- list($error_codes, $conpherence) = ConpherenceEditor::createThread(
- $user,
- $participants,
- $conpherence_title = null,
- $message,
- PhabricatorContentSource::newFromRequest($request));
-
- if ($error_codes) {
- foreach ($error_codes as $error_code) {
- switch ($error_code) {
- case ConpherenceEditor::ERROR_EMPTY_MESSAGE:
- $e_message = pht('Required');
- $errors[] = pht(
- 'You can not send an empty message.');
- break;
- case ConpherenceEditor::ERROR_EMPTY_PARTICIPANTS:
- $e_participants = pht('Required');
- $errors[] = pht(
- 'You must choose at least one recipient for your '.
- 'message.');
- break;
- }
- }
- } else {
- return id(new AphrontRedirectResponse())
- ->setURI('/'.$conpherence->getMonogram());
- }
- } else {
- $participant_prefill = $request->getStr('participant');
- if ($participant_prefill) {
- $participants[] = $participant_prefill;
- }
+ switch ($type) {
+ case 'private':
+ return $this->delegateToController(
+ id(new ConpherenceNewMessageController()));
+ break;
+ case 'custom':
+ return $this->delegateToController(
+ id(new ConpherenceNewRoomController()));
+ break;
+ default:
+ break;
}
- $submit_uri = $this->getApplicationURI('new/');
- $cancel_uri = $this->getApplicationURI();
-
+ $form = $this->renderRoomTypeForm($request);
$dialog = id(new AphrontDialogView())
->setWidth(AphrontDialogView::WIDTH_FORM)
- ->setErrors($errors)
- ->setUser($user)
- ->setTitle($title)
- ->addCancelButton($cancel_uri)
- ->addSubmitButton(pht('Send Message'));
+ ->setUser($viewer)
+ ->setTitle(pht('New Conpherence Room'))
+ ->addCancelButton($request->getRequestURI())
+ ->addSubmitButton(pht('Continue'));
+
+ $dialog->appendForm($form);
+
+ return id(new AphrontDialogResponse())->setDialog($dialog);
+ }
+
+ private function renderRoomTypeForm(AphrontRequest $request) {
+ $viewer = $request->getUser();
$form = id(new AphrontFormView())
- ->setUser($user)
+ ->setUser($viewer)
->setFullWidth(true)
- ->appendControl(
- id(new AphrontFormTokenizerControl())
- ->setName('participants')
- ->setValue($participants)
- ->setUser($user)
- ->setDatasource(new PhabricatorPeopleDatasource())
- ->setLabel(pht('To'))
- ->setError($e_participants))
->appendChild(
- id(new PhabricatorRemarkupControl())
- ->setUser($user)
- ->setName('message')
- ->setValue($message)
- ->setLabel(pht('Message'))
- ->setError($e_message));
+ id(new AphrontFormRadioButtonControl())
+ ->setName('type')
+ ->setValue('private')
+ ->addButton(
+ 'private',
+ pht('Create a Private Room'),
+ pht(
+ 'These types of rooms are best for replacing email '.
+ 'conversations. Private rooms allow any participant to add '.
+ 'other participants and change room properties such as the '.
+ 'title or image. '.
+ 'Only room participants will know the room exists; '.
+ 'non-participants will be unable to find the room through '.
+ 'search and will need to be explicitly added to the room.'))
+ ->addButton(
+ 'custom',
+ pht('Create a Room with Custom Policy'),
+ pht(
+ 'These types of rooms are best for replacing chat room '.
+ 'conversations, such as a team IRC channel. Rooms with custom '.
+ 'policy allow you to specify granular view, edit, and join '.
+ 'controls. '.
+ 'People not participating in the room will be able to search '.
+ 'for the room, view the room, and join the room if the '.
+ 'view and join policies are configured to allow it.')));
- $dialog->appendForm($form);
-
- return id(new AphrontDialogResponse())->setDialog($dialog);
+ return $form;
}
}
diff --git a/src/applications/conpherence/controller/ConpherenceNewController.php b/src/applications/conpherence/controller/ConpherenceNewMessageController.php
copy from src/applications/conpherence/controller/ConpherenceNewController.php
copy to src/applications/conpherence/controller/ConpherenceNewMessageController.php
--- a/src/applications/conpherence/controller/ConpherenceNewController.php
+++ b/src/applications/conpherence/controller/ConpherenceNewMessageController.php
@@ -1,11 +1,11 @@
<?php
-final class ConpherenceNewController extends ConpherenceController {
+final class ConpherenceNewMessageController extends ConpherenceController {
public function handleRequest(AphrontRequest $request) {
$user = $request->getUser();
- $title = pht('New Message');
+ $title = pht('New Private Room');
$participants = array();
$participant_prefill = null;
$message = '';
@@ -15,7 +15,7 @@
// this comes from ajax requests from all over. should be a single phid.
- if ($request->isFormPost()) {
+ if ($request->isFormPost() && $request->getExists('submitted')) {
$participants = $request->getArr('participants');
$message = $request->getStr('message');
list($error_codes, $conpherence) = ConpherenceEditor::createThread(
@@ -52,7 +52,7 @@
}
}
- $submit_uri = $this->getApplicationURI('new/');
+ $submit_uri = $this->getApplicationURI('new/message/');
$cancel_uri = $this->getApplicationURI();
$dialog = id(new AphrontDialogView())
@@ -60,8 +60,10 @@
->setErrors($errors)
->setUser($user)
->setTitle($title)
+ ->addHiddenInput('type', 'private')
+ ->addHiddenInput('submitted', true)
->addCancelButton($cancel_uri)
- ->addSubmitButton(pht('Send Message'));
+ ->addSubmitButton(pht('Create Room'));
$form = id(new AphrontFormView())
->setUser($user)
diff --git a/src/applications/conpherence/controller/ConpherenceNewRoomController.php b/src/applications/conpherence/controller/ConpherenceNewRoomController.php
--- a/src/applications/conpherence/controller/ConpherenceNewRoomController.php
+++ b/src/applications/conpherence/controller/ConpherenceNewRoomController.php
@@ -5,12 +5,12 @@
public function handleRequest(AphrontRequest $request) {
$user = $request->getUser();
- $title = pht('New Room');
+ $title = pht('New Custom Room');
$e_title = true;
$validation_exception = null;
$conpherence = ConpherenceThread::initializeNewRoom($user);
- if ($request->isFormPost()) {
+ if ($request->isFormPost() && $request->getExists('submitted')) {
$xactions = array();
$xactions[] = id(new ConpherenceTransaction())
@@ -62,6 +62,8 @@
->setValidationException($validation_exception)
->setUser($user)
->setTitle($title)
+ ->addHiddenInput('type', 'custom')
+ ->addHiddenInput('submitted', true)
->addCancelButton($cancel_uri)
->addSubmitButton(pht('Create Room'));
diff --git a/src/applications/conpherence/controller/ConpherenceNotificationPanelController.php b/src/applications/conpherence/controller/ConpherenceNotificationPanelController.php
--- a/src/applications/conpherence/controller/ConpherenceNotificationPanelController.php
+++ b/src/applications/conpherence/controller/ConpherenceNotificationPanelController.php
@@ -83,7 +83,7 @@
array(
'href' => '/conpherence/',
),
- pht('Messages')),
+ pht('Rooms')),
$content);
$unread = id(new ConpherenceParticipantCountQuery())
diff --git a/src/applications/conpherence/controller/ConpherenceUpdateController.php b/src/applications/conpherence/controller/ConpherenceUpdateController.php
--- a/src/applications/conpherence/controller/ConpherenceUpdateController.php
+++ b/src/applications/conpherence/controller/ConpherenceUpdateController.php
@@ -425,7 +425,7 @@
->setCapability(PhabricatorPolicyCapability::CAN_JOIN)
->setPolicies($policies));
} else {
- $title = pht('Update Thread');
+ $title = pht('Update Room');
}
require_celerity_resource('conpherence-update-css');
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
@@ -10,7 +10,7 @@
}
public function getEditorObjectsDescription() {
- return pht('Conpherence Threads');
+ return pht('Conpherence Rooms');
}
public static function createThread(
diff --git a/src/applications/conpherence/events/ConpherenceHovercardEventListener.php b/src/applications/conpherence/events/ConpherenceHovercardEventListener.php
--- a/src/applications/conpherence/events/ConpherenceHovercardEventListener.php
+++ b/src/applications/conpherence/events/ConpherenceHovercardEventListener.php
@@ -30,8 +30,9 @@
return;
}
- $conpherence_uri = new PhutilURI(
- '/conpherence/new/?participant='.$user->getPHID());
+ $conpherence_uri = id(new PhutilURI('/conpherence/new/'))
+ ->setQueryParam('type', 'private')
+ ->setQueryParam('participant', $user->getPHID());
$name = pht('Send a Message');
$hovercard->addAction($name, $conpherence_uri, true);
diff --git a/src/applications/conpherence/phid/PhabricatorConpherenceThreadPHIDType.php b/src/applications/conpherence/phid/PhabricatorConpherenceThreadPHIDType.php
--- a/src/applications/conpherence/phid/PhabricatorConpherenceThreadPHIDType.php
+++ b/src/applications/conpherence/phid/PhabricatorConpherenceThreadPHIDType.php
@@ -5,7 +5,7 @@
const TYPECONST = 'CONP';
public function getTypeName() {
- return pht('Conpherence Thread');
+ return pht('Conpherence Room');
}
public function newObject() {
diff --git a/src/applications/conpherence/query/ConpherenceThreadSearchEngine.php b/src/applications/conpherence/query/ConpherenceThreadSearchEngine.php
--- a/src/applications/conpherence/query/ConpherenceThreadSearchEngine.php
+++ b/src/applications/conpherence/query/ConpherenceThreadSearchEngine.php
@@ -4,7 +4,7 @@
extends PhabricatorApplicationSearchEngine {
public function getResultTypeDescription() {
- return pht('Threads');
+ return pht('Rooms');
}
public function getApplicationClassName() {
@@ -94,12 +94,12 @@
$names = array();
$names = array(
- 'all' => pht('All Rooms'),
+ 'all' => pht('Custom Rooms'),
);
if ($this->requireViewer()->isLoggedIn()) {
$names['participant'] = pht('Joined Rooms');
- $names['messages'] = pht('All Messages');
+ $names['messages'] = pht('Private Rooms');
}
return $names;
@@ -258,8 +258,8 @@
private function getTypeOptions() {
return array(
- 'rooms' => pht('Rooms'),
- 'messages' => pht('Messages'),
+ 'rooms' => pht('Custom Rooms'),
+ 'messages' => pht('Private Rooms'),
'both' => pht('Both'),
);
}
diff --git a/src/applications/conpherence/view/ConpherenceDurableColumnView.php b/src/applications/conpherence/view/ConpherenceDurableColumnView.php
--- a/src/applications/conpherence/view/ConpherenceDurableColumnView.php
+++ b/src/applications/conpherence/view/ConpherenceDurableColumnView.php
@@ -394,7 +394,7 @@
if ($conpherence->getIsRoom()) {
$rename_label = pht('Edit Room');
} else {
- $rename_label = pht('Rename Thread');
+ $rename_label = pht('Rename Room');
}
$can_edit = PhabricatorPolicyFilter::hasCapability(
$this->getUser(),
@@ -445,7 +445,7 @@
array(
'class' => 'mmb',
),
- pht('You do not have any messages yet.')),
+ pht('You are not in any rooms yet.')),
javelin_tag(
'a',
array(
@@ -453,7 +453,7 @@
'class' => 'button grey',
'sigil' => 'workflow',
),
- pht('Send a Message')),
+ pht('Create a Room')),
);
}
diff --git a/src/applications/conpherence/view/ConpherenceLayoutView.php b/src/applications/conpherence/view/ConpherenceLayoutView.php
--- a/src/applications/conpherence/view/ConpherenceLayoutView.php
+++ b/src/applications/conpherence/view/ConpherenceLayoutView.php
@@ -147,7 +147,7 @@
array(
'class' => 'text',
),
- pht('You do not have any messages yet.')),
+ pht('You are not in any rooms yet.')),
javelin_tag(
'a',
array(
@@ -155,7 +155,7 @@
'class' => 'button grey',
'sigil' => 'workflow',
),
- pht('Send a Message')),
+ pht('Create a Room')),
)),
javelin_tag(
'div',
diff --git a/src/applications/conpherence/view/ConpherenceThreadListView.php b/src/applications/conpherence/view/ConpherenceThreadListView.php
--- a/src/applications/conpherence/view/ConpherenceThreadListView.php
+++ b/src/applications/conpherence/view/ConpherenceThreadListView.php
@@ -2,7 +2,7 @@
final class ConpherenceThreadListView extends AphrontView {
- const SEE_MORE_LIMIT = 5;
+ const SEE_MORE_LIMIT = 15;
private $baseURI;
private $threads;
@@ -29,11 +29,7 @@
$this->getUser(),
$this->threads);
- $grouped = mgroup($this->threads, 'getIsRoom');
- $rooms = idx($grouped, 1, array());
- $this->addRoomsToMenu($menu, $rooms, $policy_objects);
- $messages = idx($grouped, 0, array());
- $this->addMessagesToMenu($menu, $messages);
+ $this->addRoomsToMenu($menu, $this->threads, $policy_objects);
return $menu;
}
@@ -141,7 +137,7 @@
$create_item = id(new PHUIListItemView())
->setType(PHUIListItemView::TYPE_LINK)
- ->setHref('/conpherence/room/new/')
+ ->setHref('/conpherence/new/')
->setWorkflow(true)
->setName(pht('Create a Room'));
$menu->addMenuItem($create_item);
@@ -153,25 +149,6 @@
return $menu;
}
- private function addMessagesToMenu(
- PHUIListView $menu,
- array $conpherences) {
-
- $header = $this->renderMenuItemHeader(
- pht('Messages'),
- 'conpherence-message-list-header');
- $menu->addMenuItem($header);
-
- if (empty($conpherences)) {
- $menu->addMenuItem($this->getNoMessagesMenuItem());
- return $menu;
- }
-
- $this->addThreadsToMenu($menu, $conpherences, array());
-
- return $menu;
- }
-
private function addThreadsToMenu(
PHUIListView $menu,
array $threads,
@@ -251,19 +228,6 @@
return $item;
}
- private function getNoMessagesMenuItem() {
- $message = phutil_tag(
- 'div',
- array(
- 'class' => 'no-conpherences-menu-item',
- ),
- pht('No Messages'));
-
- return id(new PHUIListItemView())
- ->setType(PHUIListItemView::TYPE_CUSTOM)
- ->setName($message);
- }
-
private function getNoRoomsMenuItem() {
$message = phutil_tag(
'div',
diff --git a/src/applications/people/controller/PhabricatorPeopleProfileController.php b/src/applications/people/controller/PhabricatorPeopleProfileController.php
--- a/src/applications/people/controller/PhabricatorPeopleProfileController.php
+++ b/src/applications/people/controller/PhabricatorPeopleProfileController.php
@@ -136,7 +136,9 @@
$class = 'PhabricatorConpherenceApplication';
if (PhabricatorApplication::isClassInstalledForViewer($class, $viewer)) {
- $href = '/conpherence/new/?participant='.$user->getPHID();
+ $href = id(new PhutilURI('/conpherence/new/'))
+ ->setQueryParam('participant', $user->getPHID())
+ ->setQueryParam('type', 'private');
$image = id(new PHUIIconView())
->setIconFont('fa-comments');
$button = id(new PHUIButtonView())

File Metadata

Mime Type
text/plain
Expires
Fri, May 9, 9:26 PM (8 h, 25 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7718409
Default Alt Text
D13351.id32301.diff (21 KB)

Event Timeline