Page MenuHomePhabricator

D12347.diff
No OneTemporary

D12347.diff

diff --git a/resources/celerity/map.php b/resources/celerity/map.php
--- a/resources/celerity/map.php
+++ b/resources/celerity/map.php
@@ -47,7 +47,7 @@
'rsrc/css/application/conpherence/durable-column.css' => 'f0c208ac',
'rsrc/css/application/conpherence/menu.css' => 'f389e048',
'rsrc/css/application/conpherence/message-pane.css' => 'e44b667b',
- 'rsrc/css/application/conpherence/notification.css' => '04a6e10a',
+ 'rsrc/css/application/conpherence/notification.css' => '72178795',
'rsrc/css/application/conpherence/update.css' => '1099a660',
'rsrc/css/application/conpherence/widget-pane.css' => 'a9082fd0',
'rsrc/css/application/contentsource/content-source-view.css' => '4b8b05d4',
@@ -518,7 +518,7 @@
'conpherence-durable-column-view' => 'f0c208ac',
'conpherence-menu-css' => 'f389e048',
'conpherence-message-pane-css' => 'e44b667b',
- 'conpherence-notification-css' => '04a6e10a',
+ 'conpherence-notification-css' => '72178795',
'conpherence-thread-manager' => '0a5192c4',
'conpherence-update-css' => '1099a660',
'conpherence-widget-pane-css' => 'a9082fd0',
diff --git a/src/applications/conpherence/controller/ConpherenceColumnViewController.php b/src/applications/conpherence/controller/ConpherenceColumnViewController.php
--- a/src/applications/conpherence/controller/ConpherenceColumnViewController.php
+++ b/src/applications/conpherence/controller/ConpherenceColumnViewController.php
@@ -16,6 +16,7 @@
$latest_conpherences = id(new ConpherenceThreadQuery())
->setViewer($user)
->withPHIDs($conpherence_phids)
+ ->needTransactions(true)
->needParticipantCache(true)
->execute();
$latest_conpherences = mpull($latest_conpherences, null, 'getPHID');
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
@@ -100,6 +100,7 @@
} else {
$thread = ConpherenceThread::initializeNewThread($user);
$thread->attachHandles(array());
+ $thread->attachTransactions(array());
$thread->makeEphemeral();
$layout->setHeader(
$this->buildHeaderPaneContent($thread, array()));
@@ -137,6 +138,7 @@
$conpherences = id(new ConpherenceThreadQuery())
->setViewer($user)
->withPHIDs($conpherence_phids)
+ ->needTransactions(true)
->needParticipantCache(true)
->execute();
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
@@ -17,6 +17,7 @@
$conpherences = id(new ConpherenceThreadQuery())
->setViewer($user)
->withPHIDs(array_keys($participant_data))
+ ->needTransactions(true)
->needParticipantCache(true)
->execute();
}
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
@@ -380,16 +380,14 @@
$need_widget_data = false;
$need_transactions = false;
$need_participant_cache = true;
+ $need_transactions = true;
switch ($action) {
case ConpherenceUpdateActions::METADATA:
- $need_transactions = true;
break;
case ConpherenceUpdateActions::LOAD:
- $need_transactions = true;
break;
case ConpherenceUpdateActions::MESSAGE:
case ConpherenceUpdateActions::ADD_PERSON:
- $need_transactions = true;
$need_widget_data = true;
break;
case ConpherenceUpdateActions::REMOVE_PERSON:
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
@@ -27,6 +27,7 @@
public function buildQueryFromSavedQuery(PhabricatorSavedQuery $saved) {
$query = id(new ConpherenceThreadQuery())
+ ->needTransactions(true)
->needParticipantCache(true);
$participant_phids = $saved->getParameter('participantPHIDs', array());
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
@@ -124,9 +124,12 @@
$this->transactions = $transactions;
return $this;
}
- public function getTransactions() {
+ public function getTransactions($assert_attached = true) {
return $this->assertAttached($this->transactions);
}
+ public function hasAttachedTransactions() {
+ return $this->transactions !== self::ATTACHABLE;
+ }
public function getTransactionsFrom($begin = 0, $amount = null) {
$length = count($this->transactions);
@@ -154,13 +157,32 @@
}
public function getDisplayData(PhabricatorUser $user) {
+ if ($this->hasAttachedTransactions()) {
+ $transactions = $this->getTransactions();
+ } else {
+ $transactions = array();
+ }
+ $set_title = $this->getTitle();
+
+ if ($set_title) {
+ $title_mode = 'title';
+ } else {
+ $title_mode = 'recent';
+ }
+
+ if ($transactions) {
+ $subtitle_mode = 'message';
+ } else {
+ $subtitle_mode = 'recent';
+ }
+
$recent_phids = $this->getRecentParticipantPHIDs();
$handles = $this->getHandles();
-
- // luck has little to do with it really; most recent participant who isn't
- // the user....
+ // Luck has little to do with it really; most recent participant who
+ // isn't the user....
$lucky_phid = null;
$lucky_index = null;
+ $recent_title = null;
foreach ($recent_phids as $index => $phid) {
if ($phid == $user->getPHID()) {
continue;
@@ -172,39 +194,82 @@
if ($lucky_phid) {
$lucky_handle = $handles[$lucky_phid];
- // this will be just the user talking to themselves. weirdos.
} else {
+ // This will be just the user talking to themselves. Weirdo.
$lucky_handle = reset($handles);
}
- $title = $js_title = $this->getTitle();
$img_src = null;
if ($lucky_handle) {
$img_src = $lucky_handle->getImageURI();
}
- $count = 0;
- $final = false;
- $subtitle = null;
- foreach ($recent_phids as $phid) {
- if ($phid == $user->getPHID()) {
- continue;
+ if ($title_mode == 'recent' || $subtitle_mode == 'recent') {
+ $count = 0;
+ $final = false;
+ foreach ($recent_phids as $phid) {
+ if ($phid == $user->getPHID()) {
+ continue;
+ }
+ $handle = $handles[$phid];
+ if ($recent_title) {
+ if ($final) {
+ $recent_title .= '...';
+ break;
+ } else {
+ $recent_title .= ', ';
+ }
+ }
+ $recent_title .= $handle->getName();
+ $count++;
+ $final = $count == 3;
}
- $handle = $handles[$phid];
- if ($subtitle) {
- if ($final) {
- $subtitle .= '...';
- break;
- } else {
- $subtitle .= ', ';
+ }
+
+ switch ($title_mode) {
+ case 'recent':
+ $title = $recent_title;
+ $js_title = $recent_title;
+ break;
+ case 'title':
+ $title = $js_title = $this->getTitle();
+ break;
+ }
+
+ $message_title = null;
+ if ($subtitle_mode == 'message') {
+ $message_transaction = null;
+ foreach ($transactions as $transaction) {
+ switch ($transaction->getTransactionType()) {
+ case PhabricatorTransactions::TYPE_COMMENT:
+ $message_transaction = $transaction;
+ break 2;
+ default:
+ break;
}
}
- $subtitle .= $handle->getName();
- $count++;
- $final = $count == 3;
+ if ($message_transaction) {
+ $message_handle = $handles[$message_transaction->getAuthorPHID()];
+ $message_title = sprintf(
+ '%s: %s',
+ $message_handle->getName(),
+ id(new PhutilUTF8StringTruncator())
+ ->setMaximumGlyphs(60)
+ ->truncateString(
+ $message_transaction->getComment()->getContent()));
+ }
}
- if (!$title) {
- $title = $js_title = $subtitle;
+ switch ($subtitle_mode) {
+ case 'recent':
+ $subtitle = $recent_title;
+ break;
+ case 'message':
+ if ($message_title) {
+ $subtitle = $message_title;
+ } else {
+ $subtitle = $recent_title;
+ }
+ break;
}
$user_participation = $this->getParticipantIfExists($user->getPHID());
diff --git a/webroot/rsrc/css/application/conpherence/notification.css b/webroot/rsrc/css/application/conpherence/notification.css
--- a/webroot/rsrc/css/application/conpherence/notification.css
+++ b/webroot/rsrc/css/application/conpherence/notification.css
@@ -38,7 +38,7 @@
font-weight: bold;
font-size: 13px;
color: {$darkgreytext};
- width: 280px;
+ width: 314px;
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
@@ -51,6 +51,10 @@
font-size: 11px;
margin-top: 2px;
margin-left: 46px;
+ width: 314px;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+ overflow: hidden;
}
.phabricator-notification .conpherence-menu-item-view

File Metadata

Mime Type
text/plain
Expires
Sun, Nov 17, 7:03 PM (1 d, 44 m ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6721634
Default Alt Text
D12347.diff (9 KB)

Event Timeline