1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-19 03:50:54 +01:00

Conpherence - make timestamps in durable column link to full message in conpherence

Summary: Ref T7757. This diff made me realize that `PhabricatorTransactionView` is only used in Conpherence, as well as that `ConpherenceTransactionView` is more like a rendering class with a few static methods. Going to take a diff after this to clean all that up.

Test Plan: opened up durable column, clicked on timestamp, voila!

Reviewers: chad, epriestley

Reviewed By: epriestley

Subscribers: Korvin, epriestley

Maniphest Tasks: T7757

Differential Revision: https://secure.phabricator.com/D12409
This commit is contained in:
Bob Trahan 2015-04-14 11:28:33 -07:00
parent f1a551cb20
commit d90496a719
4 changed files with 36 additions and 8 deletions

View file

@ -44,7 +44,7 @@ return array(
'rsrc/css/application/config/config-welcome.css' => '6abd79be', 'rsrc/css/application/config/config-welcome.css' => '6abd79be',
'rsrc/css/application/config/setup-issue.css' => '22270af2', 'rsrc/css/application/config/setup-issue.css' => '22270af2',
'rsrc/css/application/config/unhandled-exception.css' => '37d4f9a2', 'rsrc/css/application/config/unhandled-exception.css' => '37d4f9a2',
'rsrc/css/application/conpherence/durable-column.css' => '16051a19', 'rsrc/css/application/conpherence/durable-column.css' => '9d3af55b',
'rsrc/css/application/conpherence/menu.css' => 'f389e048', 'rsrc/css/application/conpherence/menu.css' => 'f389e048',
'rsrc/css/application/conpherence/message-pane.css' => 'e978e4ae', 'rsrc/css/application/conpherence/message-pane.css' => 'e978e4ae',
'rsrc/css/application/conpherence/notification.css' => '72178795', 'rsrc/css/application/conpherence/notification.css' => '72178795',
@ -515,7 +515,7 @@ return array(
'changeset-view-manager' => '58562350', 'changeset-view-manager' => '58562350',
'config-options-css' => '7fedf08b', 'config-options-css' => '7fedf08b',
'config-welcome-css' => '6abd79be', 'config-welcome-css' => '6abd79be',
'conpherence-durable-column-view' => '16051a19', 'conpherence-durable-column-view' => '9d3af55b',
'conpherence-menu-css' => 'f389e048', 'conpherence-menu-css' => 'f389e048',
'conpherence-message-pane-css' => 'e978e4ae', 'conpherence-message-pane-css' => 'e978e4ae',
'conpherence-notification-css' => '72178795', 'conpherence-notification-css' => '72178795',

View file

@ -2,6 +2,7 @@
final class ConpherenceTransactionView extends AphrontView { final class ConpherenceTransactionView extends AphrontView {
private $conpherenceThread;
private $conpherenceTransaction; private $conpherenceTransaction;
private $handles; private $handles;
private $markupEngine; private $markupEngine;
@ -24,6 +25,15 @@ final class ConpherenceTransactionView extends AphrontView {
return $this->handles; return $this->handles;
} }
public function setConpherenceThread(ConpherenceThread $t) {
$this->conpherenceThread = $t;
return $this;
}
private function getConpherenceThread() {
return $this->conpherenceThread;
}
public function setConpherenceTransaction(ConpherenceTransaction $tx) { public function setConpherenceTransaction(ConpherenceTransaction $tx) {
$this->conpherenceTransaction = $tx; $this->conpherenceTransaction = $tx;
return $this; return $this;
@ -62,6 +72,7 @@ final class ConpherenceTransactionView extends AphrontView {
public function render() { public function render() {
$user = $this->getUser(); $user = $this->getUser();
$transaction = $this->getConpherenceTransaction(); $transaction = $this->getConpherenceTransaction();
switch ($transaction->getTransactionType()) { switch ($transaction->getTransactionType()) {
case ConpherenceTransactionType::TYPE_DATE_MARKER: case ConpherenceTransactionType::TYPE_DATE_MARKER:
@ -84,6 +95,7 @@ final class ConpherenceTransactionView extends AphrontView {
break; break;
} }
$conpherence = $this->getConpherenceThread();
$handles = $this->getHandles(); $handles = $this->getHandles();
$transaction->setHandles($handles); $transaction->setHandles($handles);
$author = $handles[$transaction->getAuthorPHID()]; $author = $handles[$transaction->getAuthorPHID()];
@ -96,7 +108,9 @@ final class ConpherenceTransactionView extends AphrontView {
phabricator_time($transaction->getDateCreated(), $user)); phabricator_time($transaction->getDateCreated(), $user));
} else { } else {
$transaction_view $transaction_view
->setEpoch($transaction->getDateCreated()) ->setEpoch(
$transaction->getDateCreated(),
'/'.$conpherence->getMonogram().'#'.$transaction->getID())
->setTimeOnly(true); ->setTimeOnly(true);
} }
if ($this->getShowContentSource()) { if ($this->getShowContentSource()) {
@ -185,6 +199,7 @@ final class ConpherenceTransactionView extends AphrontView {
$date_marker_transaction_view = id(new ConpherenceTransactionView()) $date_marker_transaction_view = id(new ConpherenceTransactionView())
->setUser($user) ->setUser($user)
->setConpherenceTransaction($date_marker_transaction) ->setConpherenceTransaction($date_marker_transaction)
->setConpherenceThread($conpherence)
->setHandles($handles) ->setHandles($handles)
->setShowImages($full_display) ->setShowImages($full_display)
->setShowContentSource($full_display) ->setShowContentSource($full_display)
@ -210,6 +225,7 @@ final class ConpherenceTransactionView extends AphrontView {
$rendered_transactions[] = id(new ConpherenceTransactionView()) $rendered_transactions[] = id(new ConpherenceTransactionView())
->setUser($user) ->setUser($user)
->setConpherenceTransaction($transaction) ->setConpherenceTransaction($transaction)
->setConpherenceThread($conpherence)
->setHandles($handles) ->setHandles($handles)
->setMarkupEngine($engine) ->setMarkupEngine($engine)
->setRenderAnchors($full_display) ->setRenderAnchors($full_display)

View file

@ -5,6 +5,7 @@ final class PhabricatorTransactionView extends AphrontView {
private $imageURI; private $imageURI;
private $actions = array(); private $actions = array();
private $epoch; private $epoch;
private $epochHref;
private $contentSource; private $contentSource;
private $anchorName; private $anchorName;
private $anchorText; private $anchorText;
@ -22,8 +23,9 @@ final class PhabricatorTransactionView extends AphrontView {
return $this; return $this;
} }
public function setEpoch($epoch) { public function setEpoch($epoch, $epoch_href = null) {
$this->epoch = $epoch; $this->epoch = $epoch;
$this->epochHref = $epoch_href;
return $this; return $this;
} }
@ -103,10 +105,20 @@ final class PhabricatorTransactionView extends AphrontView {
$info[] = pht('PREVIEW'); $info[] = pht('PREVIEW');
} else if ($this->epoch) { } else if ($this->epoch) {
if ($this->timeOnly) { if ($this->timeOnly) {
$info[] = phabricator_time($this->epoch, $this->user); $epoch = phabricator_time($this->epoch, $this->user);
} else { } else {
$info[] = phabricator_datetime($this->epoch, $this->user); $epoch = phabricator_datetime($this->epoch, $this->user);
} }
if ($this->epochHref) {
$epoch = phutil_tag(
'a',
array(
'href' => $this->epochHref,
'class' => 'epoch-link',
),
$epoch);
}
$info[] = $epoch;
} }
if ($this->anchorName) { if ($this->anchorName) {

View file

@ -199,13 +199,13 @@
.conpherence-durable-column-transactions .phabricator-transaction-detail .conpherence-durable-column-transactions .phabricator-transaction-detail
.phabricator-transaction-header .phabricator-transaction-info, .phabricator-transaction-header .phabricator-transaction-info,
.phabricator-transaction-header .anchor-link { .phabricator-transaction-header .epoch-link {
color: {$lightbluetext}; color: {$lightbluetext};
float: none; float: none;
font-size: 12px; font-size: 12px;
} }
.phabricator-transaction-header .anchor-link { .phabricator-transaction-header .epoch-link {
font-weight: normal; font-weight: normal;
} }