1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-18 12:52:42 +01:00

Group similar transaction comments in Conpherence

Summary: Adds a CSS class if comments come in from the same user in the past 2 minutes for cleaner UI. Note will have to find some better display UI when comment editing comes.

Test Plan: Test lots of random Conpherence messages with different transactions, different people, and quick commenting.

Reviewers: scp, epriestley

Reviewed By: epriestley

Subscribers: Korvin

Differential Revision: https://secure.phabricator.com/D16632
This commit is contained in:
Chad Little 2016-09-29 12:19:45 -07:00
parent 95d1749566
commit 8af29f2df1
3 changed files with 33 additions and 3 deletions

View file

@ -7,7 +7,7 @@
*/
return array(
'names' => array(
'conpherence.pkg.css' => '3f5d038e',
'conpherence.pkg.css' => '9402e1af',
'conpherence.pkg.js' => '11f3e07e',
'core.pkg.css' => '55d32e63',
'core.pkg.js' => '32939240',
@ -49,7 +49,7 @@ return array(
'rsrc/css/application/conpherence/durable-column.css' => '63114a54',
'rsrc/css/application/conpherence/header-pane.css' => '517de9fe',
'rsrc/css/application/conpherence/menu.css' => '78c7b811',
'rsrc/css/application/conpherence/message-pane.css' => 'bbbb8a9b',
'rsrc/css/application/conpherence/message-pane.css' => '0d7dff02',
'rsrc/css/application/conpherence/notification.css' => '6cdcc253',
'rsrc/css/application/conpherence/participant-pane.css' => '7bba0b56',
'rsrc/css/application/conpherence/transaction.css' => '46253e19',
@ -621,7 +621,7 @@ return array(
'conpherence-durable-column-view' => '63114a54',
'conpherence-header-pane-css' => '517de9fe',
'conpherence-menu-css' => '78c7b811',
'conpherence-message-pane-css' => 'bbbb8a9b',
'conpherence-message-pane-css' => '0d7dff02',
'conpherence-notification-css' => '6cdcc253',
'conpherence-participant-pane-css' => '7bba0b56',
'conpherence-thread-manager' => '01774ab2',

View file

@ -78,6 +78,7 @@ final class ConpherenceTransactionRenderer extends Phobject {
->setFullDisplay($full_display);
foreach ($transactions as $transaction) {
$collapsed = false;
if ($previous_transaction) {
$previous_day = phabricator_format_local_time(
$previous_transaction->getDateCreated(),
@ -87,6 +88,22 @@ final class ConpherenceTransactionRenderer extends Phobject {
$transaction->getDateCreated(),
$user,
'Ymd');
// See if same user / time
$previous_author = $previous_transaction->getAuthorPHID();
$current_author = $transaction->getAuthorPHID();
$previous_time = $previous_transaction->getDateCreated();
$current_time = $transaction->getDateCreated();
$previous_type = $previous_transaction->getTransactionType();
$current_type = $transaction->getTransactionType();
if (($previous_author == $current_author) &&
($previous_type == $current_type)) {
// Group messages within the last x seconds
if (($current_time - $previous_time) < 120) {
$collapsed = true;
}
}
// date marker transaction time!
if ($previous_day != $current_day) {
$date_marker_transaction->setDateCreated(
@ -97,6 +114,9 @@ final class ConpherenceTransactionRenderer extends Phobject {
}
$transaction_view = id(clone $transaction_view_template)
->setConpherenceTransaction($transaction);
if ($collapsed) {
$transaction_view->addClass('conpherence-transaction-collapsed');
}
$rendered_transactions[] = $transaction_view->render();
$previous_transaction = $transaction;

View file

@ -390,3 +390,13 @@
max-height: 200px;
}
.conpherence-transaction-collapsed .conpherence-transaction-image,
.conpherence-transaction-collapsed .conpherence-transaction-header {
display: none;
}
.conpherence-message-pane
.conpherence-transaction-collapsed.conpherence-transaction-view {
margin-top: 0;
margin-bottom: 0;
}