Page MenuHomePhabricator

D13057.id31510.diff
No OneTemporary

D13057.id31510.diff

diff --git a/src/applications/conpherence/ConpherenceTransactionRenderer.php b/src/applications/conpherence/ConpherenceTransactionRenderer.php
--- a/src/applications/conpherence/ConpherenceTransactionRenderer.php
+++ b/src/applications/conpherence/ConpherenceTransactionRenderer.php
@@ -74,7 +74,8 @@
->setUser($user)
->setConpherenceThread($conpherence)
->setHandles($handles)
- ->setMarkupEngine($engine);
+ ->setMarkupEngine($engine)
+ ->setFullDisplay($full_display);
foreach ($transactions as $transaction) {
if ($previous_transaction) {
@@ -96,21 +97,6 @@
}
$transaction_view = id(clone $transaction_view_template)
->setConpherenceTransaction($transaction);
- if ($full_display) {
- $transaction_view
- ->setAnchor(
- $transaction->getID(),
- phabricator_time($transaction->getDateCreated(), $user));
- $transaction_view->setContentSource($transaction->getContentSource());
- $transaction_view->setShowImages(true);
- } else {
- $transaction_view
- ->setEpoch(
- $transaction->getDateCreated(),
- '/'.$conpherence->getMonogram().'#'.$transaction->getID())
- ->setTimeOnly(true);
- $transaction_view->setShowImages(false);
- }
$rendered_transactions[] = $transaction_view->render();
$previous_transaction = $transaction;
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
@@ -227,15 +227,13 @@
continue;
}
- $history_href = '/'.$monogram.'#'.$xaction->getID();
-
$view = id(new ConpherenceTransactionView())
->setUser($viewer)
->setHandles($handles)
->setMarkupEngine($engines[$conpherence_phid])
->setConpherenceThread($conpherence)
->setConpherenceTransaction($xaction)
- ->setEpoch($xaction->getDateCreated(), $history_href)
+ ->setFullDisplay(false)
->addClass('conpherence-fulltext-result');
if ($message['match']) {
diff --git a/src/applications/conpherence/view/ConpherenceTransactionView.php b/src/applications/conpherence/view/ConpherenceTransactionView.php
--- a/src/applications/conpherence/view/ConpherenceTransactionView.php
+++ b/src/applications/conpherence/view/ConpherenceTransactionView.php
@@ -6,14 +6,9 @@
private $conpherenceTransaction;
private $handles;
private $markupEngine;
- private $epoch;
- private $epochHref;
- private $contentSource;
- private $anchorName;
- private $anchorText;
+ private $fullDisplay;
private $classes = array();
private $timeOnly;
- private $showImages = true;
public function setConpherenceThread(ConpherenceThread $t) {
$this->conpherenceThread = $t;
@@ -52,25 +47,13 @@
return $this->markupEngine;
}
- public function setEpoch($epoch, $epoch_href = null) {
- $this->epoch = $epoch;
- $this->epochHref = $epoch_href;
+ public function setFullDisplay($bool) {
+ $this->fullDisplay = $bool;
return $this;
}
- public function setContentSource(PhabricatorContentSource $source) {
- $this->contentSource = $source;
- return $this;
- }
-
- private function getContentSource() {
- return $this->contentSource;
- }
-
- public function setAnchor($anchor_name, $anchor_text) {
- $this->anchorName = $anchor_name;
- $this->anchorText = $anchor_text;
- return $this;
+ private function getFullDisplay() {
+ return $this->fullDisplay;
}
public function addClass($class) {
@@ -78,23 +61,9 @@
return $this;
}
- public function setTimeOnly($time) {
- $this->timeOnly = $time;
- return $this;
- }
-
- public function setShowImages($bool) {
- $this->showImages = $bool;
- return $this;
- }
-
- private function getShowImages() {
- return $this->showImages;
- }
-
public function render() {
- $user = $this->getUser();
- if (!$user) {
+ $viewer = $this->getUser();
+ if (!$viewer) {
throw new Exception(pht('Call setUser() before render()!'));
}
@@ -120,7 +89,7 @@
),
phabricator_format_local_time(
$transaction->getDateCreated(),
- $user,
+ $viewer,
'M jS, Y')),
));
break;
@@ -132,7 +101,10 @@
$content = $this->renderTransactionContent();
$classes = implode(' ', $this->classes);
- $transaction_id = $this->anchorName ? 'anchor-'.$this->anchorName : null;
+ $transaction_dom_id = null;
+ if ($this->getFullDisplay()) {
+ $transaction_dom_id = 'anchor-'.$transaction->getID();
+ }
$header = phutil_tag_div(
'conpherence-transaction-header grouped',
@@ -142,7 +114,7 @@
'div',
array(
'class' => 'conpherence-transaction-view '.$classes,
- 'id' => $transaction_id,
+ 'id' => $transaction_dom_id,
'sigil' => 'conpherence-transaction-view',
'meta' => array(
'id' => $transaction->getID(),
@@ -156,53 +128,60 @@
}
private function renderTransactionInfo() {
+ $viewer = $this->getUser();
+ $thread = $this->getConpherenceThread();
+ $transaction = $this->getConpherenceTransaction();
$info = array();
- if ($this->getContentSource()) {
+ if ($this->getFullDisplay() && $transaction->getContentSource()) {
$content_source = id(new PhabricatorContentSourceView())
- ->setContentSource($this->getContentSource())
- ->setUser($this->user)
+ ->setContentSource($transaction->getContentSource())
+ ->setUser($viewer)
->render();
if ($content_source) {
$info[] = $content_source;
}
}
- if ($this->epoch) {
- if ($this->timeOnly) {
- $epoch = phabricator_time($this->epoch, $this->user);
- } else {
- $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) {
+ Javelin::initBehavior('phabricator-tooltips');
+ $tip = phabricator_datetime($transaction->getDateCreated(), $viewer);
+ $label = phabricator_time($transaction->getDateCreated(), $viewer);
+ $width = 360;
+ if ($this->getFullDisplay()) {
Javelin::initBehavior('phabricator-watch-anchor');
-
$anchor = id(new PhabricatorAnchorView())
- ->setAnchorName($this->anchorName)
+ ->setAnchorName($transaction->getID())
->render();
$info[] = hsprintf(
'%s%s',
$anchor,
- phutil_tag(
+ javelin_tag(
'a',
array(
- 'href' => '#'.$this->anchorName,
+ 'href' => '#'.$transaction->getID(),
'class' => 'anchor-link',
+ 'sigil' => 'has-tooltip',
+ 'meta' => array(
+ 'tip' => $tip,
+ 'size' => $width,
+ ),
),
- $this->anchorText));
+ $label));
+ } else {
+ $href = '/'.$thread->getMonogram().'#'.$transaction->getID();
+ $info[] = javelin_tag(
+ 'a',
+ array(
+ 'href' => $href,
+ 'class' => 'epoch-link',
+ 'sigil' => 'has-tooltip',
+ 'meta' => array(
+ 'tip' => $tip,
+ 'size' => $width,
+ ),
+ ),
+ $label);
}
$info = phutil_implode_html(" \xC2\xB7 ", $info);
@@ -234,7 +213,7 @@
private function renderTransactionImage() {
$image = null;
- if ($this->getShowImages()) {
+ if ($this->getFullDisplay()) {
$transaction = $this->getConpherenceTransaction();
switch ($transaction->getTransactionType()) {
case PhabricatorTransactions::TYPE_COMMENT:
@@ -282,7 +261,7 @@
$comment,
PhabricatorApplicationTransactionComment::MARKUP_FIELD_COMMENT);
$content_class = 'conpherence-message';
- break;
+ break;
}
$this->appendChild(

File Metadata

Mime Type
text/plain
Expires
Sun, Mar 16, 12:02 AM (1 w, 6 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7704564
Default Alt Text
D13057.id31510.diff (8 KB)

Event Timeline