Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F13821507
D13351.id32334.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
57 KB
Referenced Files
None
Subscribers
None
D13351.id32334.diff
View Options
diff --git a/resources/celerity/map.php b/resources/celerity/map.php
--- a/resources/celerity/map.php
+++ b/resources/celerity/map.php
@@ -341,7 +341,7 @@
'rsrc/js/application/conpherence/behavior-menu.js' => 'd3782c93',
'rsrc/js/application/conpherence/behavior-pontificate.js' => '21ba5861',
'rsrc/js/application/conpherence/behavior-quicksand-blacklist.js' => '7927a7d3',
- 'rsrc/js/application/conpherence/behavior-widget-pane.js' => '93568464',
+ 'rsrc/js/application/conpherence/behavior-widget-pane.js' => 'cafc59ab',
'rsrc/js/application/countdown/timer.js' => 'e4cc26b3',
'rsrc/js/application/dashboard/behavior-dashboard-async-panel.js' => '469c0d9e',
'rsrc/js/application/dashboard/behavior-dashboard-move-panels.js' => '82439934',
@@ -548,7 +548,7 @@
'javelin-behavior-conpherence-drag-and-drop-photo' => 'cf86d16a',
'javelin-behavior-conpherence-menu' => 'd3782c93',
'javelin-behavior-conpherence-pontificate' => '21ba5861',
- 'javelin-behavior-conpherence-widget-pane' => '93568464',
+ 'javelin-behavior-conpherence-widget-pane' => 'cafc59ab',
'javelin-behavior-countdown-timer' => 'e4cc26b3',
'javelin-behavior-dark-console' => 'f411b6ae',
'javelin-behavior-dashboard-async-panel' => '469c0d9e',
@@ -1506,19 +1506,6 @@
'javelin-dom',
'javelin-stratcom',
),
- 93568464 => array(
- 'javelin-behavior',
- 'javelin-dom',
- 'javelin-stratcom',
- 'javelin-workflow',
- 'javelin-util',
- 'phabricator-notification',
- 'javelin-behavior-device',
- 'phuix-dropdown-menu',
- 'phuix-action-list-view',
- 'phuix-action-view',
- 'conpherence-thread-manager',
- ),
'93d0c9e3' => array(
'javelin-behavior',
'javelin-stratcom',
@@ -1792,6 +1779,19 @@
'javelin-stratcom',
'phabricator-phtize',
),
+ 'cafc59ab' => array(
+ 'javelin-behavior',
+ 'javelin-dom',
+ 'javelin-stratcom',
+ 'javelin-workflow',
+ 'javelin-util',
+ 'phabricator-notification',
+ 'javelin-behavior-device',
+ 'phuix-dropdown-menu',
+ 'phuix-action-list-view',
+ 'phuix-action-view',
+ 'conpherence-thread-manager',
+ ),
'cf86d16a' => array(
'javelin-behavior',
'javelin-dom',
diff --git a/resources/sql/autopatches/20150619.conpherencerooms.1.sql b/resources/sql/autopatches/20150619.conpherencerooms.1.sql
new file mode 100644
--- /dev/null
+++ b/resources/sql/autopatches/20150619.conpherencerooms.1.sql
@@ -0,0 +1,6 @@
+UPDATE {$NAMESPACE}_conpherence.conpherence_thread
+ SET
+ viewPolicy = 'obj.conpherence.members',
+ editPolicy = 'obj.conpherence.members',
+ joinPolicy = 'obj.conpherence.members'
+ WHERE isRoom = 0;
diff --git a/resources/sql/autopatches/20150619.conpherencerooms.2.sql b/resources/sql/autopatches/20150619.conpherencerooms.2.sql
new file mode 100644
--- /dev/null
+++ b/resources/sql/autopatches/20150619.conpherencerooms.2.sql
@@ -0,0 +1,2 @@
+ALTER TABLE {$NAMESPACE}_conpherence.conpherence_thread
+ DROP KEY `key_room`;
diff --git a/resources/sql/autopatches/20150619.conpherencerooms.3.sql b/resources/sql/autopatches/20150619.conpherencerooms.3.sql
new file mode 100644
--- /dev/null
+++ b/resources/sql/autopatches/20150619.conpherencerooms.3.sql
@@ -0,0 +1,2 @@
+ALTER TABLE {$NAMESPACE}_conpherence.conpherence_thread
+ DROP COLUMN isRoom;
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
@@ -238,7 +238,6 @@
'ConpherenceLayoutView' => 'applications/conpherence/view/ConpherenceLayoutView.php',
'ConpherenceListController' => 'applications/conpherence/controller/ConpherenceListController.php',
'ConpherenceMenuItemView' => 'applications/conpherence/view/ConpherenceMenuItemView.php',
- 'ConpherenceNewController' => 'applications/conpherence/controller/ConpherenceNewController.php',
'ConpherenceNewRoomController' => 'applications/conpherence/controller/ConpherenceNewRoomController.php',
'ConpherenceNotificationPanelController' => 'applications/conpherence/controller/ConpherenceNotificationPanelController.php',
'ConpherenceParticipant' => 'applications/conpherence/storage/ConpherenceParticipant.php',
@@ -263,7 +262,6 @@
'ConpherenceThreadQuery' => 'applications/conpherence/query/ConpherenceThreadQuery.php',
'ConpherenceThreadRemarkupRule' => 'applications/conpherence/remarkup/ConpherenceThreadRemarkupRule.php',
'ConpherenceThreadSearchEngine' => 'applications/conpherence/query/ConpherenceThreadSearchEngine.php',
- 'ConpherenceThreadTestCase' => 'applications/conpherence/__tests__/ConpherenceThreadTestCase.php',
'ConpherenceTransaction' => 'applications/conpherence/storage/ConpherenceTransaction.php',
'ConpherenceTransactionComment' => 'applications/conpherence/storage/ConpherenceTransactionComment.php',
'ConpherenceTransactionQuery' => 'applications/conpherence/query/ConpherenceTransactionQuery.php',
@@ -3568,7 +3566,6 @@
'ConpherenceLayoutView' => 'AphrontView',
'ConpherenceListController' => 'ConpherenceController',
'ConpherenceMenuItemView' => 'AphrontTagView',
- 'ConpherenceNewController' => 'ConpherenceController',
'ConpherenceNewRoomController' => 'ConpherenceController',
'ConpherenceNotificationPanelController' => 'ConpherenceController',
'ConpherenceParticipant' => 'ConpherenceDAO',
@@ -3599,7 +3596,6 @@
'ConpherenceThreadQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
'ConpherenceThreadRemarkupRule' => 'PhabricatorObjectRemarkupRule',
'ConpherenceThreadSearchEngine' => 'PhabricatorApplicationSearchEngine',
- 'ConpherenceThreadTestCase' => 'ConpherenceTestCase',
'ConpherenceTransaction' => 'PhabricatorApplicationTransaction',
'ConpherenceTransactionComment' => 'PhabricatorApplicationTransactionComment',
'ConpherenceTransactionQuery' => 'PhabricatorApplicationTransactionQuery',
diff --git a/src/applications/conpherence/__tests__/ConpherenceRoomTestCase.php b/src/applications/conpherence/__tests__/ConpherenceRoomTestCase.php
--- a/src/applications/conpherence/__tests__/ConpherenceRoomTestCase.php
+++ b/src/applications/conpherence/__tests__/ConpherenceRoomTestCase.php
@@ -69,20 +69,6 @@
$participant_phids,
$conpherence->getRecentParticipantPHIDs());
- // test policy error as another user tries to add
- $caught = null;
- try {
- $this->addParticipants(
- $friend_2,
- $conpherence,
- array($friend_3->getPHID()));
- } catch (PhabricatorPolicyException $ex) {
- $caught = $ex;
- }
- $this->assertTrue($caught instanceof PhabricatorPolicyException);
-
- // update edit policy so user has a chance
- $this->changeEditPolicy($creator, $conpherence, 'users');
// test add by other participant, so recent participation should
// meaningfully change
$participant_phids = array(
@@ -129,7 +115,6 @@
public function testAddMessageWithFileAttachments() {
$creator = $this->generateNewTestUser();
$friend_1 = $this->generateNewTestUser();
- $join_via_add = $this->generateNewTestUser();
$participant_map = array(
$creator->getPHID() => $creator,
@@ -144,9 +129,6 @@
$xactions = $this->addMessageWithFile($user, $conpherence);
$this->assertEqual(2, count($xactions));
}
-
- $xactions = $this->addMessageWithFile($join_via_add, $conpherence);
- $this->assertEqual(2, count($xactions));
}
private function createRoom(
diff --git a/src/applications/conpherence/__tests__/ConpherenceThreadTestCase.php b/src/applications/conpherence/__tests__/ConpherenceThreadTestCase.php
deleted file mode 100644
--- a/src/applications/conpherence/__tests__/ConpherenceThreadTestCase.php
+++ /dev/null
@@ -1,169 +0,0 @@
-<?php
-
-final class ConpherenceThreadTestCase extends ConpherenceTestCase {
-
- protected function getPhabricatorTestCaseConfiguration() {
- return array(
- self::PHABRICATOR_TESTCONFIG_BUILD_STORAGE_FIXTURES => true,
- );
- }
-
- public function testOneUserThreadCreate() {
- $creator = $this->generateNewTestUser();
- $participant_phids = array($creator->getPHID());
-
- $conpherence = $this->createThread($creator, $participant_phids);
-
- $this->assertTrue((bool)$conpherence->getID());
- $this->assertEqual(1, count($conpherence->getParticipants()));
- $this->assertEqual(
- $participant_phids,
- $conpherence->getRecentParticipantPHIDs());
- }
-
- public function testNUserThreadCreate() {
- $creator = $this->generateNewTestUser();
- $friend_1 = $this->generateNewTestUser();
- $friend_2 = $this->generateNewTestUser();
- $friend_3 = $this->generateNewTestUser();
-
- $participant_phids = array(
- $creator->getPHID(),
- $friend_1->getPHID(),
- $friend_2->getPHID(),
- $friend_3->getPHID(),
- );
-
- $conpherence = $this->createThread($creator, $participant_phids);
-
- $this->assertTrue((bool)$conpherence->getID());
- $this->assertEqual(4, count($conpherence->getParticipants()));
- $this->assertEqual(
- $participant_phids,
- $conpherence->getRecentParticipantPHIDs());
- }
-
- public function testThreadParticipantAddition() {
- $creator = $this->generateNewTestUser();
- $friend_1 = $this->generateNewTestUser();
- $friend_2 = $this->generateNewTestUser();
- $friend_3 = $this->generateNewTestUser();
-
- $participant_phids = array(
- $creator->getPHID(),
- $friend_1->getPHID(),
- );
-
- $conpherence = $this->createThread($creator, $participant_phids);
-
- $this->assertTrue((bool)$conpherence->getID());
- $this->assertEqual(2, count($conpherence->getParticipants()));
- $this->assertEqual(
- $participant_phids,
- $conpherence->getRecentParticipantPHIDs());
-
- // test add by creator
- $participant_phids[] = $friend_2->getPHID();
- $this->addParticipants($creator, $conpherence, array($friend_2->getPHID()));
- $this->assertEqual(
- $participant_phids,
- $conpherence->getRecentParticipantPHIDs());
-
- // test add by other participant, so recent participation should
- // meaningfully change
- $participant_phids = array(
- $friend_2->getPHID(), // actor
- $creator->getPHID(), // last actor
- $friend_1->getPHID(),
- $friend_3->getPHID(), // new addition
- );
- $this->addParticipants(
- $friend_2,
- $conpherence,
- array($friend_3->getPHID()));
- $this->assertEqual(
- $participant_phids,
- $conpherence->getRecentParticipantPHIDs());
- }
-
- public function testThreadParticipantDeletion() {
- $creator = $this->generateNewTestUser();
- $friend_1 = $this->generateNewTestUser();
- $friend_2 = $this->generateNewTestUser();
- $friend_3 = $this->generateNewTestUser();
-
- $participant_map = array(
- $creator->getPHID() => $creator,
- $friend_1->getPHID() => $friend_1,
- $friend_2->getPHID() => $friend_2,
- $friend_3->getPHID() => $friend_3,
- );
-
- $conpherence = $this->createThread(
- $creator,
- array_keys($participant_map));
-
- foreach ($participant_map as $phid => $user) {
- $this->removeParticipants($user, $conpherence, array($phid));
- unset($participant_map[$phid]);
- $this->assertEqual(
- count($participant_map),
- count($conpherence->getParticipants()));
- }
- }
-
- public function testAddMessageWithFileAttachments() {
- $creator = $this->generateNewTestUser();
- $friend_1 = $this->generateNewTestUser();
- $policy_exception_user = $this->generateNewTestUser();
-
- $participant_map = array(
- $creator->getPHID() => $creator,
- $friend_1->getPHID() => $friend_1,
- );
-
- $conpherence = $this->createThread(
- $creator,
- array_keys($participant_map));
-
- foreach ($participant_map as $phid => $user) {
- $xactions = $this->addMessageWithFile($user, $conpherence);
- $this->assertEqual(2, count($xactions), pht('hi'));
- }
-
- $caught = null;
- try {
- $xactions = $this->addMessageWithFile(
- $policy_exception_user,
- $conpherence);
- } catch (PhabricatorPolicyException $ex) {
- $caught = $ex;
- }
- $this->assertTrue(
- $caught instanceof PhabricatorPolicyException,
- pht(
- 'User not participating in thread should get policy exception '.
- 'trying to add message.'));
- $this->assertTrue(
- $conpherence->establishConnection('w')->isReadLocking(),
- pht(
- 'Conpherence object should still be read locked from policy '.
- 'exception.'));
- $conpherence->endReadLocking();
- $conpherence->killTransaction();
- }
-
- private function createThread(
- PhabricatorUser $creator,
- array $participant_phids) {
-
- list($errors, $conpherence) = ConpherenceEditor::createThread(
- $creator,
- $participant_phids,
- pht('Test'),
- pht('Test'),
- PhabricatorContentSource::newConsoleSource());
- return $conpherence;
- }
-
-}
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() {
@@ -44,8 +44,7 @@
'(?P<id>[1-9]\d*)/(?P<messageID>[1-9]\d*)/'
=> 'ConpherenceViewController',
'columnview/' => 'ConpherenceColumnViewController',
- 'new/' => 'ConpherenceNewController',
- 'room/new/' => 'ConpherenceNewRoomController',
+ 'new/' => 'ConpherenceNewRoomController',
'search/(?:query/(?P<queryKey>[^/]+)/)?'
=> 'ConpherenceRoomListController',
'panel/' => 'ConpherenceNotificationPanelController',
@@ -59,7 +58,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;')
@@ -81,14 +81,8 @@
$crumbs = $this->buildApplicationCrumbs();
$data = $conpherence->getDisplayData($this->getViewer());
- if ($conpherence->getID() && $conpherence->getIsRoom()) {
- $icon = $conpherence->getPolicyIconName($policy_objects);
- } else {
- $icon = null;
- }
$crumbs->addCrumb(
id(new PHUICrumbView())
- ->setIcon($icon)
->setName($data['title'])
->setHref($this->getApplicationURI('update/'.$conpherence->getID().'/'))
->setWorkflow(true));
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:
@@ -93,22 +112,21 @@
->setThreadView($thread_view)
->setRole('list');
if ($conpherence) {
- $policy_objects = id(new PhabricatorPolicyQuery())
- ->setViewer($user)
- ->setObject($conpherence)
- ->execute();
- $layout->setHeader($this->buildHeaderPaneContent(
- $conpherence,
- $policy_objects));
$layout->setThread($conpherence);
} else {
- $thread = ConpherenceThread::initializeNewThread($user);
- $thread->attachHandles(array());
- $thread->attachTransactions(array());
- $thread->makeEphemeral();
- $layout->setHeader(
- $this->buildHeaderPaneContent($thread, array()));
+ // make a dummy conpherence so we can render something
+ $conpherence = ConpherenceThread::initializeNewRoom($user);
+ $conpherence->attachHandles(array());
+ $conpherence->attachTransactions(array());
+ $conpherence->makeEphemeral();
}
+ $policy_objects = id(new PhabricatorPolicyQuery())
+ ->setViewer($user)
+ ->setObject($conpherence)
+ ->execute();
+ $layout->setHeader($this->buildHeaderPaneContent(
+ $conpherence,
+ $policy_objects));
$response = $this->buildApplicationPage(
$layout,
array(
diff --git a/src/applications/conpherence/controller/ConpherenceNewController.php b/src/applications/conpherence/controller/ConpherenceNewController.php
deleted file mode 100644
--- a/src/applications/conpherence/controller/ConpherenceNewController.php
+++ /dev/null
@@ -1,90 +0,0 @@
-<?php
-
-final class ConpherenceNewController extends ConpherenceController {
-
- public function handleRequest(AphrontRequest $request) {
- $user = $request->getUser();
-
- $title = pht('New Message');
- $participants = array();
- $participant_prefill = null;
- $message = '';
- $e_participants = null;
- $e_message = null;
- $errors = array();
-
- // 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;
- }
- }
-
- $submit_uri = $this->getApplicationURI('new/');
- $cancel_uri = $this->getApplicationURI();
-
- $dialog = id(new AphrontDialogView())
- ->setWidth(AphrontDialogView::WIDTH_FORM)
- ->setErrors($errors)
- ->setUser($user)
- ->setTitle($title)
- ->addCancelButton($cancel_uri)
- ->addSubmitButton(pht('Send Message'));
-
- $form = id(new AphrontFormView())
- ->setUser($user)
- ->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));
-
- $dialog->appendForm($form);
-
- return id(new AphrontDialogResponse())->setDialog($dialog);
- }
-
-}
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
@@ -10,12 +10,18 @@
$validation_exception = null;
$conpherence = ConpherenceThread::initializeNewRoom($user);
+ $participants = array();
if ($request->isFormPost()) {
-
+ $editor = new ConpherenceEditor();
$xactions = array();
+
+ $participants = $request->getArr('participants');
+ $participants[] = $user->getPHID();
+ $participants = array_unique($participants);
$xactions[] = id(new ConpherenceTransaction())
->setTransactionType(ConpherenceTransaction::TYPE_PARTICIPANTS)
- ->setNewValue(array('+' => array($user->getPHID())));
+ ->setNewValue(array('+' => $participants));
+
$xactions[] = id(new ConpherenceTransaction())
->setTransactionType(ConpherenceTransaction::TYPE_TITLE)
->setNewValue($request->getStr('title'));
@@ -29,8 +35,17 @@
->setTransactionType(PhabricatorTransactions::TYPE_JOIN_POLICY)
->setNewValue($request->getStr('joinPolicy'));
+ $message = $request->getStr('message');
+ if ($message) {
+ $message_xactions = $editor->generateTransactionsFromText(
+ $user,
+ $conpherence,
+ $message);
+ $xactions = array_merge($xactions, $message_xactions);
+ }
+
try {
- id(new ConpherenceEditor())
+ $editor
->setContentSourceFromRequest($request)
->setContinueOnNoEffect(true)
->setActor($user)
@@ -47,6 +62,10 @@
$conpherence->setEditPolicy($request->getStr('editPolicy'));
$conpherence->setJoinPolicy($request->getStr('joinPolicy'));
}
+ } else {
+ if ($request->getStr('participant')) {
+ $participants[] = $request->getStr('participant');
+ }
}
$policies = id(new PhabricatorPolicyQuery())
@@ -62,19 +81,26 @@
->setValidationException($validation_exception)
->setUser($user)
->setTitle($title)
+ ->addHiddenInput('type', 'custom')
->addCancelButton($cancel_uri)
->addSubmitButton(pht('Create Room'));
$form = id(new PHUIFormLayoutView())
->setUser($user)
- ->setFullWidth(true)
->appendChild(
id(new AphrontFormTextControl())
->setError($e_title)
- ->setLabel(pht('Title'))
+ ->setLabel(pht('Name'))
->setName('title')
->setValue($request->getStr('title')))
->appendChild(
+ id(new AphrontFormTokenizerControl())
+ ->setName('participants')
+ ->setUser($user)
+ ->setDatasource(new PhabricatorPeopleDatasource())
+ ->setValue($participants)
+ ->setLabel(pht('Other Participants')))
+ ->appendChild(
id(new AphrontFormPolicyControl())
->setName('viewPolicy')
->setPolicyObject($conpherence)
@@ -91,7 +117,12 @@
->setName('joinPolicy')
->setPolicyObject($conpherence)
->setCapability(PhabricatorPolicyCapability::CAN_JOIN)
- ->setPolicies($policies));
+ ->setPolicies($policies))
+ ->appendChild(
+ id(new PhabricatorRemarkupControl())
+ ->setUser($user)
+ ->setName('message')
+ ->setLabel(pht('First Message')));
$dialog->appendChild($form);
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
@@ -188,17 +188,15 @@
$xactions[] = id(new ConpherenceTransaction())
->setTransactionType(ConpherenceTransaction::TYPE_TITLE)
->setNewValue($title);
- if ($conpherence->getIsRoom()) {
- $xactions[] = id(new ConpherenceTransaction())
- ->setTransactionType(PhabricatorTransactions::TYPE_VIEW_POLICY)
- ->setNewValue($request->getStr('viewPolicy'));
- $xactions[] = id(new ConpherenceTransaction())
- ->setTransactionType(PhabricatorTransactions::TYPE_EDIT_POLICY)
- ->setNewValue($request->getStr('editPolicy'));
- $xactions[] = id(new ConpherenceTransaction())
- ->setTransactionType(PhabricatorTransactions::TYPE_JOIN_POLICY)
- ->setNewValue($request->getStr('joinPolicy'));
- }
+ $xactions[] = id(new ConpherenceTransaction())
+ ->setTransactionType(PhabricatorTransactions::TYPE_VIEW_POLICY)
+ ->setNewValue($request->getStr('viewPolicy'));
+ $xactions[] = id(new ConpherenceTransaction())
+ ->setTransactionType(PhabricatorTransactions::TYPE_EDIT_POLICY)
+ ->setNewValue($request->getStr('editPolicy'));
+ $xactions[] = id(new ConpherenceTransaction())
+ ->setTransactionType(PhabricatorTransactions::TYPE_JOIN_POLICY)
+ ->setNewValue($request->getStr('joinPolicy'));
if (!$request->getExists('force_ajax')) {
$response_mode = 'redirect';
}
@@ -245,8 +243,11 @@
->setContent($content);
break;
case 'go-home':
- return id(new AphrontRedirectResponse())
- ->setURI($this->getApplicationURI());
+ $content = array(
+ 'href' => $this->getApplicationURI(),
+ );
+ return id(new AphrontAjaxResponse())
+ ->setContent($content);
break;
case 'redirect':
default:
@@ -323,18 +324,18 @@
$user = $request->getUser();
$remove_person = $request->getStr('remove_person');
$participants = $conpherence->getParticipants();
- if ($conpherence->getIsRoom()) {
- $message = pht(
- 'Are you sure you want to remove yourself from this room?');
- } else {
- $message = pht(
- 'Are you sure you want to remove yourself from this thread?');
+
+ $message = pht(
+ 'Are you sure you want to leave this room?');
+ $participants_only = id(new ConpherenceThreadMembersPolicyRule())
+ ->getObjectPolicyFullKey();
+ if ($conpherence->getViewPolicy() == $participants_only) {
if (count($participants) == 1) {
$message .= pht(
- 'The thread will be inaccessible forever and ever.');
+ ' The room will be inaccessible forever and ever.');
} else {
$message .= pht(
- 'Someone else in the thread can add you back later.');
+ ' Someone else in the room can add you back later.');
}
}
$body = phutil_tag(
@@ -345,7 +346,7 @@
require_celerity_resource('conpherence-update-css');
return id(new AphrontDialogView())
- ->setTitle(pht('Remove Participants'))
+ ->setTitle(pht('Leave Room'))
->addHiddenInput('action', 'remove_person')
->addHiddenInput('remove_person', $remove_person)
->addHiddenInput(
@@ -362,6 +363,7 @@
$request = $this->getRequest();
$user = $request->getUser();
+ $title = pht('Update Room');
$form = id(new PHUIFormLayoutView())
->appendChild($error_view)
->appendChild(
@@ -399,14 +401,13 @@
->setLabel(pht('Image')));
}
- if ($conpherence->getIsRoom()) {
- $title = pht('Update Room');
- $policies = id(new PhabricatorPolicyQuery())
- ->setViewer($user)
- ->setObject($conpherence)
- ->execute();
+ $policies = id(new PhabricatorPolicyQuery())
+ ->setViewer($user)
+ ->setObject($conpherence)
+ ->execute();
- $form->appendChild(
+ $form
+ ->appendChild(
id(new AphrontFormPolicyControl())
->setName('viewPolicy')
->setPolicyObject($conpherence)
@@ -424,9 +425,6 @@
->setPolicyObject($conpherence)
->setCapability(PhabricatorPolicyCapability::CAN_JOIN)
->setPolicies($policies));
- } else {
- $title = pht('Update Thread');
- }
require_celerity_resource('conpherence-update-css');
$view = id(new AphrontDialogView())
@@ -520,7 +518,7 @@
$nav_item = id(new ConpherenceThreadListView())
->setUser($user)
->setBaseURI($this->getApplicationURI())
- ->renderSingleThread($conpherence);
+ ->renderSingleThread($conpherence, $policy_objects);
$nav_item = hsprintf('%s', $nav_item);
break;
case ConpherenceUpdateActions::MESSAGE:
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(
@@ -20,7 +20,7 @@
$message,
PhabricatorContentSource $source) {
- $conpherence = ConpherenceThread::initializeNewThread($creator);
+ $conpherence = ConpherenceThread::initializeNewRoom($creator);
$files = array();
$errors = array();
if (empty($participant_phids)) {
@@ -583,11 +583,7 @@
$href = PhabricatorEnv::getProductionURI(
'/'.$object->getMonogram().'?settings');
- if ($object->getIsRoom()) {
- $label = pht('EMAIL PREFERENCES FOR THIS ROOM');
- } else {
- $label = pht('EMAIL PREFERENCES FOR THIS MESSAGE');
- }
+ $label = pht('EMAIL PREFERENCES FOR THIS ROOM');
$body->addLinkSection($label, $href);
}
@@ -644,19 +640,12 @@
switch ($type) {
case ConpherenceTransaction::TYPE_TITLE:
- if (!$object->getIsRoom()) {
- continue;
- }
$missing = $this->validateIsEmptyTextField(
$object->getTitle(),
$xactions);
if ($missing) {
- if ($object->getIsRoom()) {
- $detail = pht('Room title is required.');
- } else {
- $detail = pht('Thread title can not be blank.');
- }
+ $detail = pht('Room title is required.');
$error = new PhabricatorApplicationTransactionValidationError(
$type,
pht('Required'),
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/mail/ConpherenceCreateThreadMailReceiver.php b/src/applications/conpherence/mail/ConpherenceCreateThreadMailReceiver.php
--- a/src/applications/conpherence/mail/ConpherenceCreateThreadMailReceiver.php
+++ b/src/applications/conpherence/mail/ConpherenceCreateThreadMailReceiver.php
@@ -53,7 +53,7 @@
$phids = mpull($users, 'getPHID');
$conpherence = id(new ConpherenceReplyHandler())
- ->setMailReceiver(ConpherenceThread::initializeNewThread($sender))
+ ->setMailReceiver(ConpherenceThread::initializeNewRoom($sender))
->setMailAddedParticipantPHIDs($phids)
->setActor($sender)
->setExcludeMailRecipientPHIDs($mail->loadExcludeMailRecipientPHIDs())
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/policyrule/ConpherenceThreadMembersPolicyRule.php b/src/applications/conpherence/policyrule/ConpherenceThreadMembersPolicyRule.php
--- a/src/applications/conpherence/policyrule/ConpherenceThreadMembersPolicyRule.php
+++ b/src/applications/conpherence/policyrule/ConpherenceThreadMembersPolicyRule.php
@@ -8,15 +8,19 @@
}
public function getObjectPolicyName() {
- return pht('Thread Members');
+ return pht('Room Participants');
}
public function getPolicyExplanation() {
- return pht('Members of this thread can take this action.');
+ return pht('Participants in this room can take this action.');
}
public function getRuleDescription() {
- return pht('thread members');
+ return pht('room participants');
+ }
+
+ public function getObjectPolicyIcon() {
+ return 'fa-comments';
}
public function canApplyToObject(PhabricatorPolicyInterface $object) {
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() {
@@ -20,10 +20,6 @@
$saved->setParameter('fulltext', $request->getStr('fulltext'));
- $saved->setParameter(
- 'threadType',
- $request->getStr('threadType'));
-
return $saved;
}
@@ -41,21 +37,6 @@
$query->withFulltext($fulltext);
}
- $thread_type = $saved->getParameter('threadType');
- if (idx($this->getTypeOptions(), $thread_type)) {
- switch ($thread_type) {
- case 'rooms':
- $query->withIsRoom(true);
- break;
- case 'messages':
- $query->withIsRoom(false);
- break;
- case 'both':
- $query->withIsRoom(null);
- break;
- }
- }
-
return $query;
}
@@ -77,13 +58,7 @@
id(new AphrontFormTextControl())
->setName('fulltext')
->setLabel(pht('Contains Words'))
- ->setValue($fulltext))
- ->appendControl(
- id(new AphrontFormSelectControl())
- ->setLabel(pht('Type'))
- ->setName('threadType')
- ->setOptions($this->getTypeOptions())
- ->setValue($saved->getParameter('threadType')));
+ ->setValue($fulltext));
}
protected function getURI($path) {
@@ -99,7 +74,6 @@
if ($this->requireViewer()->isLoggedIn()) {
$names['participant'] = pht('Joined Rooms');
- $names['messages'] = pht('All Messages');
}
return $names;
@@ -112,15 +86,8 @@
switch ($query_key) {
case 'all':
- $query->setParameter('threadType', 'rooms');
return $query;
case 'participant':
- $query->setParameter('threadType', 'rooms');
- return $query->setParameter(
- 'participantPHIDs',
- array($this->requireViewer()->getPHID()));
- case 'messages':
- $query->setParameter('threadType', 'messages');
return $query->setParameter(
'participantPHIDs',
array($this->requireViewer()->getPHID()));
@@ -145,7 +112,7 @@
$viewer = $this->requireViewer();
- $policy_objects = ConpherenceThread::loadPolicyObjects(
+ $policy_objects = ConpherenceThread::loadViewPolicyObjects(
$viewer,
$conpherences);
@@ -192,11 +159,7 @@
$title = $conpherence->getDisplayTitle($viewer);
$monogram = $conpherence->getMonogram();
- if ($conpherence->getIsRoom()) {
- $icon_name = $conpherence->getPolicyIconName($policy_objects);
- } else {
- $icon_name = 'fa-envelope-o';
- }
+ $icon_name = $conpherence->getPolicyIconName($policy_objects);
$icon = id(new PHUIIconView())
->setIconFont($icon_name);
$item = id(new PHUIObjectItemView())
@@ -258,8 +221,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/storage/ConpherenceThread.php b/src/applications/conpherence/storage/ConpherenceThread.php
--- a/src/applications/conpherence/storage/ConpherenceThread.php
+++ b/src/applications/conpherence/storage/ConpherenceThread.php
@@ -9,7 +9,6 @@
protected $title;
protected $imagePHIDs = array();
- protected $isRoom = 0;
protected $messageCount;
protected $recentParticipantPHIDs = array();
protected $mailKey;
@@ -24,30 +23,18 @@
private $widgetData = self::ATTACHABLE;
private $images = self::ATTACHABLE;
- public static function initializeNewThread(PhabricatorUser $sender) {
+ public static function initializeNewRoom(PhabricatorUser $sender) {
+ $default_policy = id(new ConpherenceThreadMembersPolicyRule())
+ ->getObjectPolicyFullKey();
return id(new ConpherenceThread())
->setMessageCount(0)
->setTitle('')
->attachParticipants(array())
->attachFilePHIDs(array())
->attachImages(array())
- ->setViewPolicy(PhabricatorPolicies::POLICY_USER)
- ->setEditPolicy(PhabricatorPolicies::POLICY_USER)
- ->setJoinPolicy(PhabricatorPolicies::POLICY_USER);
- }
-
- public static function initializeNewRoom(PhabricatorUser $creator) {
-
- return id(new ConpherenceThread())
- ->setIsRoom(1)
- ->setMessageCount(0)
- ->setTitle('')
- ->attachParticipants(array())
- ->attachFilePHIDs(array())
- ->attachImages(array())
- ->setViewPolicy(PhabricatorPolicies::POLICY_USER)
- ->setEditPolicy($creator->getPHID())
- ->setJoinPolicy(PhabricatorPolicies::POLICY_USER);
+ ->setViewPolicy($default_policy)
+ ->setEditPolicy($default_policy)
+ ->setJoinPolicy($default_policy);
}
protected function getConfiguration() {
@@ -59,15 +46,11 @@
),
self::CONFIG_COLUMN_SCHEMA => array(
'title' => 'text255?',
- 'isRoom' => 'bool',
'messageCount' => 'uint64',
'mailKey' => 'text20',
'joinPolicy' => 'policy',
),
self::CONFIG_KEY_SCHEMA => array(
- 'key_room' => array(
- 'columns' => array('isRoom', 'dateModified'),
- ),
'key_phid' => null,
'phid' => array(
'columns' => array('phid'),
@@ -214,7 +197,7 @@
return $title;
}
- return pht('Private Correspondence');
+ return pht('Participants-Only Room');
}
/**
@@ -382,15 +365,13 @@
}
public function getPolicy($capability) {
- if ($this->getIsRoom()) {
- switch ($capability) {
- case PhabricatorPolicyCapability::CAN_VIEW:
- return $this->getViewPolicy();
- case PhabricatorPolicyCapability::CAN_EDIT:
- return $this->getEditPolicy();
- case PhabricatorPolicyCapability::CAN_JOIN:
- return $this->getJoinPolicy();
- }
+ switch ($capability) {
+ case PhabricatorPolicyCapability::CAN_VIEW:
+ return $this->getViewPolicy();
+ case PhabricatorPolicyCapability::CAN_EDIT:
+ return $this->getEditPolicy();
+ case PhabricatorPolicyCapability::CAN_JOIN:
+ return $this->getJoinPolicy();
}
return PhabricatorPolicies::POLICY_NOONE;
}
@@ -401,12 +382,10 @@
return true;
}
- if ($this->getIsRoom()) {
- switch ($capability) {
- case PhabricatorPolicyCapability::CAN_EDIT:
- case PhabricatorPolicyCapability::CAN_JOIN:
- return false;
- }
+ switch ($capability) {
+ case PhabricatorPolicyCapability::CAN_EDIT:
+ case PhabricatorPolicyCapability::CAN_JOIN:
+ return false;
}
$participants = $this->getParticipants();
@@ -414,35 +393,28 @@
}
public function describeAutomaticCapability($capability) {
- if ($this->getIsRoom()) {
- switch ($capability) {
- case PhabricatorPolicyCapability::CAN_VIEW:
- return pht('Participants in a room can always view it.');
- break;
- }
- } else {
- return pht('Participants in a thread can always view and edit it.');
+ switch ($capability) {
+ case PhabricatorPolicyCapability::CAN_VIEW:
+ return pht('Participants in a room can always view it.');
+ break;
}
}
- public static function loadPolicyObjects(
+ public static function loadViewPolicyObjects(
PhabricatorUser $viewer,
array $conpherences) {
assert_instances_of($conpherences, __CLASS__);
- $grouped = mgroup($conpherences, 'getIsRoom');
- $rooms = idx($grouped, 1, array());
-
$policies = array();
- foreach ($rooms as $room) {
- $policies[] = $room->getViewPolicy();
+ foreach ($conpherences as $room) {
+ $policies[$room->getViewPolicy()] = 1;
}
$policy_objects = array();
if ($policies) {
$policy_objects = id(new PhabricatorPolicyQuery())
->setViewer($viewer)
- ->withPHIDs($policies)
+ ->withPHIDs(array_keys($policies))
->execute();
}
@@ -452,13 +424,7 @@
public function getPolicyIconName(array $policy_objects) {
assert_instances_of($policy_objects, 'PhabricatorPolicy');
- if ($this->getIsRoom()) {
- $icon = $policy_objects[$this->getViewPolicy()]->getIcon();
- } else if (count($this->getRecentParticipantPHIDs()) > 2) {
- $icon = 'fa-users';
- } else {
- $icon = 'fa-user';
- }
+ $icon = $policy_objects[$this->getViewPolicy()]->getIcon();
return $icon;
}
diff --git a/src/applications/conpherence/storage/ConpherenceTransaction.php b/src/applications/conpherence/storage/ConpherenceTransaction.php
--- a/src/applications/conpherence/storage/ConpherenceTransaction.php
+++ b/src/applications/conpherence/storage/ConpherenceTransaction.php
@@ -63,11 +63,7 @@
case PhabricatorTransactions::TYPE_EDIT_POLICY:
case PhabricatorTransactions::TYPE_JOIN_POLICY:
case self::TYPE_PICTURE:
- if ($this->getObject()->getIsRoom()) {
- return $this->getRoomTitle();
- } else {
- return $this->getThreadTitle();
- }
+ return $this->getRoomTitle();
break;
case self::TYPE_FILES:
$add = array_diff($new, $old);
@@ -180,62 +176,6 @@
}
}
- private function getThreadTitle() {
- $author_phid = $this->getAuthorPHID();
-
- $old = $this->getOldValue();
- $new = $this->getNewValue();
-
- switch ($this->getTransactionType()) {
- case self::TYPE_TITLE:
- if ($old && $new) {
- $title = pht(
- '%s renamed this thread from "%s" to "%s".',
- $this->renderHandleLink($author_phid),
- $old,
- $new);
- } else if ($old) {
- $title = pht(
- '%s deleted the thread name "%s".',
- $this->renderHandleLink($author_phid),
- $old);
- } else {
- $title = pht(
- '%s named this thread "%s".',
- $this->renderHandleLink($author_phid),
- $new);
- }
- return $title;
- break;
- case self::TYPE_PICTURE:
- return pht(
- '%s updated the room image.',
- $this->renderHandleLink($author_phid));
- break;
- case PhabricatorTransactions::TYPE_VIEW_POLICY:
- return pht(
- '%s changed the visibility of this thread from "%s" to "%s".',
- $this->renderHandleLink($author_phid),
- $this->renderPolicyName($old, 'old'),
- $this->renderPolicyName($new, 'new'));
- break;
- case PhabricatorTransactions::TYPE_EDIT_POLICY:
- return pht(
- '%s changed the edit policy of this thread from "%s" to "%s".',
- $this->renderHandleLink($author_phid),
- $this->renderPolicyName($old, 'old'),
- $this->renderPolicyName($new, 'new'));
- break;
- case PhabricatorTransactions::TYPE_JOIN_POLICY:
- return pht(
- '%s changed the join policy of this thread from "%s" to "%s".',
- $this->renderHandleLink($author_phid),
- $this->renderPolicyName($old, 'old'),
- $this->renderPolicyName($new, 'new'));
- break;
- }
- }
-
public function getRequiredHandlePHIDs() {
$phids = parent::getRequiredHandlePHIDs();
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
@@ -119,21 +119,9 @@
'quicksandConfig' => $this->getQuicksandConfig(),
));
- $policies = array();
- $conpherences = $this->getConpherences();
- foreach ($conpherences as $conpherence) {
- if (!$conpherence->getIsRoom()) {
- continue;
- }
- $policies[] = $conpherence->getViewPolicy();
- }
- $policy_objects = array();
- if ($policies) {
- $policy_objects = id(new PhabricatorPolicyQuery())
- ->setViewer($this->getUser())
- ->withPHIDs($policies)
- ->execute();
- }
+ $policy_objects = ConpherenceThread::loadViewPolicyObjects(
+ $this->getUser(),
+ $this->getConpherences());
$this->setPolicyObjects($policy_objects);
$classes = array();
@@ -224,13 +212,10 @@
assert_instances_of($policy_objects, 'PhabricatorPolicy');
- $icon = null;
- if ($conpherence->getIsRoom()) {
- $icon = $conpherence->getPolicyIconName($policy_objects);
- $icon = id(new PHUIIconView())
- ->addClass('mmr')
- ->setIconFont($icon);
- }
+ $icon = $conpherence->getPolicyIconName($policy_objects);
+ $icon = id(new PHUIIconView())
+ ->addClass('mmr')
+ ->setIconFont($icon);
return $icon;
}
@@ -391,11 +376,6 @@
}
private function getHeaderActionsConfig(ConpherenceThread $conpherence) {
- if ($conpherence->getIsRoom()) {
- $rename_label = pht('Edit Room');
- } else {
- $rename_label = pht('Rename Thread');
- }
$can_edit = PhabricatorPolicyFilter::hasCapability(
$this->getUser(),
$conpherence,
@@ -410,7 +390,7 @@
'key' => ConpherenceUpdateActions::ADD_PERSON,
),
array(
- 'name' => $rename_label,
+ 'name' => pht('Edit Room'),
'disabled' => !$can_edit,
'href' => '/conpherence/update/'.$conpherence->getID().'/?nopic',
'icon' => 'fa-pencil',
@@ -445,7 +425,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 +433,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;
@@ -25,40 +25,25 @@
->addClass('conpherence-menu')
->setID('conpherence-menu');
- $policy_objects = ConpherenceThread::loadPolicyObjects(
+ $policy_objects = ConpherenceThread::loadViewPolicyObjects(
$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;
}
- public function renderSingleThread(ConpherenceThread $thread) {
- $policy_objects = id(new PhabricatorPolicyQuery())
- ->setViewer($this->getUser())
- ->setObject($thread)
- ->execute();
+ public function renderSingleThread(
+ ConpherenceThread $thread,
+ array $policy_objects) {
+ assert_instances_of($policy_objects, 'PhabricatorPolicy');
return $this->renderThread($thread, $policy_objects);
}
- public function renderThreadsHTML() {
- $thread_html = array();
-
- foreach ($this->threads as $thread) {
- $thread_html[] = $this->renderSingleThread($thread);
- }
-
- return phutil_implode_html('', $thread_html);
- }
-
private function renderThreadItem(
ConpherenceThread $thread,
- $policy_objects = array()) {
+ array $policy_objects) {
return id(new PHUIListItemView())
->setType(PHUIListItemView::TYPE_CUSTOM)
->setName($this->renderThread($thread, $policy_objects));
@@ -72,12 +57,9 @@
$uri = '/'.$thread->getMonogram();
$data = $thread->getDisplayData($user);
- $icon = null;
- if ($thread->getIsRoom()) {
- $icon = id(new PHUIIconView())
- ->addClass('msr')
- ->setIconFont($thread->getPolicyIconName($policy_objects));
- }
+ $icon = id(new PHUIIconView())
+ ->addClass('msr')
+ ->setIconFont($thread->getPolicyIconName($policy_objects));
$title = phutil_tag(
'span',
array(),
@@ -141,7 +123,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 +135,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,
@@ -187,21 +150,14 @@
$more_threads = array_slice($threads, self::SEE_MORE_LIMIT);
}
- $is_room = false;
foreach ($show_threads as $thread) {
$item = $this->renderThreadItem($thread, $policy_objects);
$menu->addMenuItem($item);
- $is_room = $thread->getIsRoom();
}
if ($more_threads) {
- if ($is_room) {
- $search_uri = '/conpherence/search/query/participant/';
- $sigil = 'more-room';
- } else {
- $search_uri = '/conpherence/search/query/messages/';
- $sigil = 'more-message';
- }
+ $search_uri = '/conpherence/search/query/participant/';
+ $sigil = 'more-room';
$more_item = id(new PHUIListItemView())
->setType(PHUIListItemView::TYPE_LINK)
@@ -251,19 +207,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())
diff --git a/webroot/rsrc/js/application/conpherence/behavior-widget-pane.js b/webroot/rsrc/js/application/conpherence/behavior-widget-pane.js
--- a/webroot/rsrc/js/application/conpherence/behavior-widget-pane.js
+++ b/webroot/rsrc/js/application/conpherence/behavior-widget-pane.js
@@ -321,6 +321,7 @@
});
}
});
+
threadManager.syncWorkflow(workflow, 'submit');
}
);
@@ -331,9 +332,25 @@
function (e) {
var href = config.widgetBaseUpdateURI + _loadedWidgetsID + '/';
var data = e.getNodeData('remove-person');
- // we end up re-directing to conpherence home
+
+ // While the user is removing themselves, disable the notification
+ // update behavior. If we don't do this, the user can get an error
+ // when they remove themselves about permissions as the notification
+ // code tries to load what jist happened.
+ var threadManager = JX.ConpherenceThreadManager.getInstance();
+ var loadedPhid = threadManager.getLoadedThreadPHID();
+ threadManager.setLoadedThreadPHID(null);
+
new JX.Workflow(href, data)
- .start();
+ .setCloseHandler(function() {
+ threadManager.setLoadedThreadPHID(loadedPhid);
+ })
+ // we re-direct to conpherence home so the thread manager will
+ // fix itself there
+ .setHandler(function(r) {
+ JX.$U(r.href).go();
+ })
+ .start();
}
);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Sep 22, 2:32 AM (21 h, 47 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6627399
Default Alt Text
D13351.id32334.diff (57 KB)
Attached To
Mode
D13351: Conpherence - remove room vs message distinction as far as users are concerned
Attached
Detach File
Event Timeline
Log In to Comment