Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15419701
D12163.id29236.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
D12163.id29236.diff
View Options
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
@@ -74,11 +74,21 @@
return $crumbs;
}
- protected function buildHeaderPaneContent(ConpherenceThread $conpherence) {
+ protected function buildHeaderPaneContent(
+ ConpherenceThread $conpherence,
+ array $policy_objects) {
+ assert_instances_of($policy_objects, 'PhabricatorPolicy');
+
$crumbs = $this->buildApplicationCrumbs();
$title = $this->getConpherenceTitle($conpherence);
+ if ($conpherence->getID()) {
+ $icon = $conpherence->getPolicyIconName($policy_objects);
+ } else {
+ $icon = null;
+ }
$crumbs->addCrumb(
id(new PHUICrumbView())
+ ->setIcon($icon)
->setName($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
@@ -157,13 +157,20 @@
->setThreadView($thread_view)
->setRole('list');
if ($conpherence) {
- $layout->setHeader($this->buildHeaderPaneContent($conpherence));
+ $policy_objects = id(new PhabricatorPolicyQuery())
+ ->setViewer($user)
+ ->setObject($conpherence)
+ ->execute();
+ $layout->setHeader($this->buildHeaderPaneContent(
+ $conpherence,
+ $policy_objects));
$layout->setThread($conpherence);
} else {
$layout->setHeader(
$this->buildHeaderPaneContent(
id(new ConpherenceThread())
- ->makeEphemeral()));
+ ->makeEphemeral(),
+ array()));
}
$response = $this->buildApplicationPage(
$layout,
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
@@ -377,7 +377,11 @@
$file_widget = null;
switch ($action) {
case ConpherenceUpdateActions::METADATA:
- $header = $this->buildHeaderPaneContent($conpherence);
+ $policy_objects = id(new PhabricatorPolicyQuery())
+ ->setViewer($user)
+ ->setObject($conpherence)
+ ->execute();
+ $header = $this->buildHeaderPaneContent($conpherence, $policy_objects);
$nav_item = id(new ConpherenceThreadListView())
->setUser($user)
->setBaseURI($this->getApplicationURI())
diff --git a/src/applications/conpherence/controller/ConpherenceViewController.php b/src/applications/conpherence/controller/ConpherenceViewController.php
--- a/src/applications/conpherence/controller/ConpherenceViewController.php
+++ b/src/applications/conpherence/controller/ConpherenceViewController.php
@@ -47,7 +47,11 @@
$form = null;
$content = array('messages' => $messages);
} else {
- $header = $this->buildHeaderPaneContent($conpherence);
+ $policy_objects = id(new PhabricatorPolicyQuery())
+ ->setViewer($user)
+ ->setObject($conpherence)
+ ->execute();
+ $header = $this->buildHeaderPaneContent($conpherence, $policy_objects);
$form = $this->renderFormContent();
$content = array(
'header' => $header,
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
@@ -191,28 +191,19 @@
array $xactions) {
$object->save();
- }
- protected function applyCustomInternalTransaction(
- PhabricatorLiskDAO $object,
- PhabricatorApplicationTransaction $xaction) {
- switch ($xaction->getTransactionType()) {
- case PhabricatorTransactions::TYPE_COMMENT:
- $object->setMessageCount((int)$object->getMessageCount() + 1);
- break;
- case ConpherenceTransactionType::TYPE_TITLE:
- $object->setTitle($xaction->getNewValue());
- break;
- case ConpherenceTransactionType::TYPE_PARTICIPANTS:
- // If this is a new ConpherenceThread, we have to create the
- // participation data asap to pass policy checks. For existing
- // ConpherenceThreads, the existing participation is correct
- // at this stage. Note that later in applyCustomExternalTransaction
- // this participation data will be updated, particularly the
- // behindTransactionPHID which is just a generated dummy for now.
- if ($this->getIsNewObject()) {
+ foreach ($xactions as $xaction) {
+ switch ($xaction->getTransactionType()) {
+ case ConpherenceTransactionType::TYPE_PARTICIPANTS:
+ // Since this is a new ConpherenceThread, we have to create the
+ // participation data asap to pass policy checks. For existing
+ // ConpherenceThreads, the existing participation is correct
+ // at this stage. Note that later in applyCustomExternalTransaction
+ // this participation data will be updated, particularly the
+ // behindTransactionPHID which is just a generated dummy for now.
$participants = array();
- foreach ($xaction->getNewValue() as $phid) {
+ $phids = $this->getPHIDTransactionNewValue($xaction, array());
+ foreach ($phids as $phid) {
if ($phid == $this->getActor()->getPHID()) {
$status = ConpherenceParticipationStatus::UP_TO_DATE;
$message_count = 1;
@@ -230,6 +221,35 @@
->setSeenMessageCount($message_count)
->save();
$object->attachParticipants($participants);
+ $object->setRecentParticipantPHIDs(array_keys($participants));
+ }
+ break;
+ }
+ }
+ }
+
+ protected function applyCustomInternalTransaction(
+ PhabricatorLiskDAO $object,
+ PhabricatorApplicationTransaction $xaction) {
+
+ switch ($xaction->getTransactionType()) {
+ case PhabricatorTransactions::TYPE_COMMENT:
+ $object->setMessageCount((int)$object->getMessageCount() + 1);
+ break;
+ case ConpherenceTransactionType::TYPE_TITLE:
+ $object->setTitle($xaction->getNewValue());
+ break;
+ case ConpherenceTransactionType::TYPE_PARTICIPANTS:
+ if (!$this->getIsNewObject()) {
+ // if we added people, add them to tne end of "recent" participants
+ $old_map = array_fuse($xaction->getOldValue());
+ $new_map = array_fuse($xaction->getNewValue());
+ $add = array_keys(array_diff_key($new_map, $old_map));
+ if ($add) {
+ $participants = $object->getRecentParticipantPHIDs();
+ $participants = array_merge($participants, $add);
+ $participants = array_slice(array_unique($participants), 0, 10);
+ $object->setRecentParticipantPHIDs($participants);
}
}
break;
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
@@ -277,4 +277,17 @@
}
}
+ 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';
+ }
+ return $icon;
+ }
+
}
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
@@ -8,6 +8,7 @@
private $transactions;
private $visible;
private $initialLoad = false;
+ private $policyObjects;
public function setConpherences(array $conpherences) {
assert_instances_of($conpherences, 'ConpherenceThread');
@@ -66,6 +67,17 @@
return $this->initialLoad;
}
+ public function setPolicyObjects(array $objects) {
+ assert_instances_of($objects, 'PhabricatorPolicy');
+
+ $this->policyObjects = $objects;
+ return $this;
+ }
+
+ public function getPolicyObjects() {
+ return $this->policyObjects;
+ }
+
protected function getTagAttributes() {
if ($this->getVisible()) {
$style = null;
@@ -96,6 +108,23 @@
'settingsURI' => '/settings/adjust/?key='.$column_key,
));
+ $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();
+ }
+ $this->setPolicyObjects($policy_objects);
+
$classes = array();
$classes[] = 'conpherence-durable-column-header';
$classes[] = 'sprite-main-header';
@@ -178,6 +207,18 @@
);
}
+ private function getPolicyIcon(
+ ConpherenceThread $conpherence,
+ array $policy_objects) {
+
+ assert_instances_of($policy_objects, 'PhabricatorPolicy');
+
+ $icon = $conpherence->getPolicyIconName($policy_objects);
+ return id(new PHUIIconView())
+ ->addClass('mmr')
+ ->setIconFont($icon.' lightgreytext');
+ }
+
private function buildIconBar() {
$icons = array();
$selected_conpherence = $this->getSelectedConpherence();
@@ -189,6 +230,14 @@
$classes[] = 'selected';
}
$data = $conpherence->getDisplayData($this->getUser());
+ $icon = $this->getPolicyIcon($conpherence, $this->getPolicyObjects());
+ $thread_title = phutil_tag(
+ 'span',
+ array(),
+ array(
+ $icon,
+ $data['js_title'],
+ ));
$image = $data['image'];
Javelin::initBehavior('phabricator-tooltips');
$icons[] =
@@ -200,7 +249,7 @@
'sigil' => 'conpherence-durable-column-thread-icon has-tooltip',
'meta' => array(
'threadID' => $conpherence->getID(),
- 'threadTitle' => $data['js_title'],
+ 'threadTitle' => hsprintf('%s', $thread_title),
'tip' => $data['js_title'],
'align' => 'S',
),
@@ -220,7 +269,7 @@
if (!$conpherence) {
- $title = null;
+ $header = null;
$settings_button = null;
$settings_menu = null;
@@ -282,6 +331,13 @@
if (!$title) {
$title = pht('[No Title]');
}
+ $header = phutil_tag(
+ 'span',
+ array(),
+ array(
+ $this->getPolicyIcon($conpherence, $this->getPolicyObjects()),
+ $title,
+ ));
}
return
@@ -297,7 +353,7 @@
'sigil' => 'conpherence-durable-column-header-text',
'class' => 'conpherence-durable-column-header-text',
),
- $title),
+ $header),
$settings_button,
$settings_menu,));
diff --git a/webroot/rsrc/js/application/conpherence/behavior-durable-column.js b/webroot/rsrc/js/application/conpherence/behavior-durable-column.js
--- a/webroot/rsrc/js/application/conpherence/behavior-durable-column.js
+++ b/webroot/rsrc/js/application/conpherence/behavior-durable-column.js
@@ -183,7 +183,7 @@
'selected',
cdata.threadID == data.threadID);
}
- JX.DOM.setContent(_getColumnTitleNode(), data.threadTitle);
+ JX.DOM.setContent(_getColumnTitleNode(), JX.$H(data.threadTitle));
threadManager.loadThreadByID(data.threadID);
});
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Mar 22, 8:13 AM (2 w, 3 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7386459
Default Alt Text
D12163.id29236.diff (12 KB)
Attached To
Mode
D12163: Conpherence - Differentiate audience of Threads/Rooms with icon
Attached
Detach File
Event Timeline
Log In to Comment