Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F13188158
D12178.id29269.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
12 KB
Referenced Files
None
Subscribers
None
D12178.id29269.diff
View Options
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
@@ -6,20 +6,6 @@
const UNSELECTED_MODE = 'unselected';
const PAGING_MODE = 'paging';
- private $conpherenceID;
-
- public function setConpherenceID($conpherence_id) {
- $this->conpherenceID = $conpherence_id;
- return $this;
- }
- public function getConpherenceID() {
- return $this->conpherenceID;
- }
-
- public function willProcessRequest(array $data) {
- $this->setConpherenceID(idx($data, 'id'));
- }
-
/**
* Three main modes of operation...
*
@@ -44,8 +30,8 @@
return $mode;
}
- public function processRequest() {
- $request = $this->getRequest();
+
+ public function handleRequest(AphrontRequest $request) {
$user = $request->getUser();
$title = pht('Conpherence');
$conpherence = null;
@@ -58,7 +44,7 @@
$mode = $this->determineMode();
switch ($mode) {
case self::SELECTED_MODE:
- $conpherence_id = $this->getConpherenceID();
+ $conpherence_id = $request->getURIData('id');
$conpherence = id(new ConpherenceThreadQuery())
->setViewer($user)
->withIDs(array($conpherence_id))
@@ -70,12 +56,7 @@
$title = $conpherence->getTitle();
}
$cursor = $conpherence->getParticipantIfExists($user->getPHID());
- if ($cursor) {
- $data = $this->loadParticipationWithMidCursor($cursor);
- $all_participation = $data['all_participation'];
- $scroll_up_participant = $data['scroll_up_participant'];
- $scroll_down_participant = $data['scroll_down_participant'];
- } else {
+ if (!$cursor || $conpherence->getIsRoom()) {
$data = $this->loadDefaultParticipation($too_many);
$all_participation = $data['all_participation'];
$scroll_down_participant = $data['scroll_down_participant'];
@@ -85,6 +66,12 @@
$all_participation =
array($conpherence->getPHID() => $menu_participation) +
$all_participation;
+
+ } else {
+ $data = $this->loadParticipationWithMidCursor($cursor);
+ $all_participation = $data['all_participation'];
+ $scroll_up_participant = $data['scroll_up_participant'];
+ $scroll_down_participant = $data['scroll_down_participant'];
}
break;
case self::PAGING_MODE:
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
@@ -135,6 +135,9 @@
case ConpherenceTransactionType::TYPE_TITLE:
return $object->getTitle();
case ConpherenceTransactionType::TYPE_PARTICIPANTS:
+ if ($this->getIsNewObject()) {
+ return array();
+ }
return $object->getParticipantPHIDs();
case ConpherenceTransactionType::TYPE_FILES:
return $object->getFilePHIDs();
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
@@ -53,21 +53,25 @@
switch ($this->getTransactionType()) {
case ConpherenceTransactionType::TYPE_TITLE:
+ $noun = $this->getConpherenceNoun();
if ($old && $new) {
$title = pht(
- '%s renamed this thread from "%s" to "%s".',
+ '%s renamed this %s from "%s" to "%s".',
$this->renderHandleLink($author_phid),
+ $noun,
$old,
$new);
} else if ($old) {
$title = pht(
- '%s deleted the thread name "%s".',
+ '%s deleted the %s name "%s".',
$this->renderHandleLink($author_phid),
+ $noun,
$old);
} else {
$title = pht(
- '%s named this thread "%s".',
+ '%s named this %s "%s".',
$this->renderHandleLink($author_phid),
+ $noun,
$new);
}
return $title;
@@ -121,6 +125,12 @@
}
return $title;
break;
+ case PhabricatorTransactions::TYPE_VIEW_POLICY:
+ case PhabricatorTransactions::TYPE_EDIT_POLICY:
+ case PhabricatorTransactions::TYPE_JOIN_POLICY:
+ $noun = $this->getConpherenceNoun();
+ return $this->getPolicyTransactionTitle($noun);
+ break;
}
return parent::getTitle();
@@ -147,4 +157,13 @@
return $phids;
}
+ private function getConpherenceNoun() {
+ $conpherence = $this->getObject();
+ if ($conpherence->getIsRoom()) {
+ $noun = 'room';
+ } else {
+ $noun = 'thread';
+ }
+ return $noun;
+ }
}
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
@@ -33,17 +33,38 @@
public function render() {
require_celerity_resource('conpherence-menu-css');
+ $grouped = mgroup($this->threads, 'getIsRoom');
+ $rooms = array_slice($grouped[true], 0, 5);
+
+ $policies = array();
+ foreach ($rooms as $room) {
+ $policies[] = $room->getViewPolicy();
+ }
+ $policy_objects = array();
+ if ($policies) {
+ $policy_objects = id(new PhabricatorPolicyQuery())
+ ->setViewer($this->getUser())
+ ->withPHIDs($policies)
+ ->execute();
+ }
+
$menu = id(new PHUIListView())
->addClass('conpherence-menu')
->setID('conpherence-menu');
- $this->addThreadsToMenu($menu, $this->threads);
+ $this->addRoomsToMenu($menu, $rooms, $policy_objects);
+ $messages = $grouped[false];
+ $this->addThreadsToMenu($menu, $messages);
return $menu;
}
public function renderSingleThread(ConpherenceThread $thread) {
- return $this->renderThread($thread);
+ $policy_objects = id(new PhabricatorPolicyQuery())
+ ->setViewer($this->getUser())
+ ->setObject($thread)
+ ->execute();
+ return $this->renderThread($thread, $policy_objects);
}
public function renderThreadsHTML() {
@@ -68,18 +89,31 @@
return phutil_implode_html('', $thread_html);
}
- private function renderThreadItem(ConpherenceThread $thread) {
+ private function renderThreadItem(
+ ConpherenceThread $thread,
+ $policy_objects = array()) {
return id(new PHUIListItemView())
->setType(PHUIListItemView::TYPE_CUSTOM)
- ->setName($this->renderThread($thread));
+ ->setName($this->renderThread($thread, $policy_objects));
}
- private function renderThread(ConpherenceThread $thread) {
+ private function renderThread(
+ ConpherenceThread $thread,
+ array $policy_objects) {
+
$user = $this->getUser();
$uri = $this->baseURI.$thread->getID().'/';
$data = $thread->getDisplayData($user);
- $title = $data['title'];
+ $title = phutil_tag(
+ 'span',
+ array(),
+ array(
+ id(new PHUIIconView())
+ ->addClass('mmr')
+ ->setIconFont($thread->getPolicyIconName($policy_objects)),
+ $data['title'],
+ ));
$subtitle = $data['subtitle'];
$unread_count = $data['unread_count'];
$epoch = $data['epoch'];
@@ -104,6 +138,46 @@
));
}
+ private function addRoomsToMenu(
+ PHUIListView $menu,
+ array $conpherences,
+ array $policy_objects) {
+
+ $header = $this->renderMenuItemHeader(pht('Rooms'));
+ $menu->addMenuItem($header);
+
+ if (empty($conpherences)) {
+ $join_item = id(new PHUIListItemView())
+ ->setType(PHUIListItemView::TYPE_LINK)
+ ->setHref('/conpherence/room/')
+ ->setName(pht('Join a Room'));
+ $menu->addMenuItem($join_item);
+
+ $create_item = id(new PHUIListItemView())
+ ->setType(PHUIListItemView::TYPE_LINK)
+ ->setHref('/conpherence/room/new/')
+ ->setWorkflow(true)
+ ->setName(pht('Create a Room'));
+ $menu->addMenuItem($create_item);
+
+ return $menu;
+ }
+
+ foreach ($conpherences as $conpherence) {
+ $item = $this->renderThreadItem($conpherence, $policy_objects);
+ $menu->addMenuItem($item);
+ }
+
+ $more_item = id(new PHUIListItemView())
+ ->setType(PHUIListItemView::TYPE_LINK)
+ ->setHref('/conpherence/room/query/participant/')
+ ->setName(pht('See More'));
+ $menu->addMenuItem($more_item);
+
+ return $menu;
+ }
+
+
private function addThreadsToMenu(
PHUIListView $menu,
array $conpherences) {
@@ -113,7 +187,7 @@
$menu->addMenuItem($item);
}
- $header = $this->renderMenuItemHeader(pht('Recent'));
+ $header = $this->renderMenuItemHeader(pht('Messages'));
$menu->addMenuItem($header);
foreach ($conpherences as $conpherence) {
@@ -163,17 +237,31 @@
return $item;
}
- private function getNoConpherencesMenuItem() {
+ private function getNoMessagesMenuItem() {
$message = phutil_tag(
'div',
array(
'class' => 'no-conpherences-menu-item',
),
- pht('No Conpherences'));
+ pht('No Messages'));
return id(new PHUIListItemView())
->setType(PHUIListItemView::TYPE_CUSTOM)
->setName($message);
}
+ private function getNoRoomsMenuItem() {
+ $message = phutil_tag(
+ 'div',
+ array(
+ 'class' => 'no-conpherences-menu-item',
+ ),
+ pht('No Rooms'));
+
+ return id(new PHUIListItemView())
+ ->setType(PHUIListItemView::TYPE_CUSTOM)
+ ->setName($message);
+ }
+
+
}
diff --git a/src/applications/transactions/storage/PhabricatorApplicationTransaction.php b/src/applications/transactions/storage/PhabricatorApplicationTransaction.php
--- a/src/applications/transactions/storage/PhabricatorApplicationTransaction.php
+++ b/src/applications/transactions/storage/PhabricatorApplicationTransaction.php
@@ -617,26 +617,10 @@
'%s added a comment.',
$this->renderHandleLink($author_phid));
case PhabricatorTransactions::TYPE_VIEW_POLICY:
- return pht(
- '%s changed the visibility of this %s from "%s" to "%s".',
- $this->renderHandleLink($author_phid),
- $this->getApplicationObjectTypeName(),
- $this->renderPolicyName($old, 'old'),
- $this->renderPolicyName($new, 'new'));
case PhabricatorTransactions::TYPE_EDIT_POLICY:
- return pht(
- '%s changed the edit policy of this %s from "%s" to "%s".',
- $this->renderHandleLink($author_phid),
- $this->getApplicationObjectTypeName(),
- $this->renderPolicyName($old, 'old'),
- $this->renderPolicyName($new, 'new'));
case PhabricatorTransactions::TYPE_JOIN_POLICY:
- return pht(
- '%s changed the join policy of this %s from "%s" to "%s".',
- $this->renderHandleLink($author_phid),
- $this->getApplicationObjectTypeName(),
- $this->renderPolicyName($old, 'old'),
- $this->renderPolicyName($new, 'new'));
+ return $this->getPolicyTransactionTitle(
+ $this->getApplicationObjectTypeName());
case PhabricatorTransactions::TYPE_SUBSCRIBERS:
$add = array_diff($new, $old);
$rem = array_diff($old, $new);
@@ -789,6 +773,37 @@
}
}
+ protected function getPolicyTransactionTitle($noun) {
+ $author_phid = $this->getAuthorPHID();
+
+ $old = $this->getOldValue();
+ $new = $this->getNewValue();
+
+ switch ($this->getTransactionType()) {
+ case PhabricatorTransactions::TYPE_VIEW_POLICY:
+ return pht(
+ '%s changed the visibility of this %s from "%s" to "%s".',
+ $this->renderHandleLink($author_phid),
+ $noun,
+ $this->renderPolicyName($old, 'old'),
+ $this->renderPolicyName($new, 'new'));
+ case PhabricatorTransactions::TYPE_EDIT_POLICY:
+ return pht(
+ '%s changed the edit policy of this %s from "%s" to "%s".',
+ $this->renderHandleLink($author_phid),
+ $noun,
+ $this->renderPolicyName($old, 'old'),
+ $this->renderPolicyName($new, 'new'));
+ case PhabricatorTransactions::TYPE_JOIN_POLICY:
+ return pht(
+ '%s changed the join policy of this %s from "%s" to "%s".',
+ $this->renderHandleLink($author_phid),
+ $noun,
+ $this->renderPolicyName($old, 'old'),
+ $this->renderPolicyName($new, 'new'));
+ }
+ }
+
public function getTitleForFeed() {
$author_phid = $this->getAuthorPHID();
$object_phid = $this->getObjectPHID();
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, May 12, 5:04 AM (3 w, 5 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6273406
Default Alt Text
D12178.id29269.diff (12 KB)
Attached To
Mode
D12178: Conpherence - get lots of rooms stuff hooked up nicely
Attached
Detach File
Event Timeline
Log In to Comment