Modernize Macro application
Summary: Adds feed, email, notifications, comments, partial editing, subscriptions, enable/disable, flags and crumbs to Macro.
Test Plan:
{F26839}
{F26840}
{F26841}
{F26842}
{F26843}
{F26844}
{F26845}
Reviewers: vrana, btrahan, chad
Reviewed By: vrana
CC: aran
Maniphest Tasks: T2157, T175, T2104
Differential Revision: https://secure.phabricator.com/D4141
2012-12-11 14:01:03 -08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @concrete-extensible
|
|
|
|
*/
|
|
|
|
class PhabricatorApplicationTransactionView extends AphrontView {
|
|
|
|
|
|
|
|
private $transactions;
|
|
|
|
private $engine;
|
2012-12-11 14:01:51 -08:00
|
|
|
private $showEditActions = true;
|
2012-12-21 05:51:33 -08:00
|
|
|
private $isPreview;
|
2013-07-28 18:21:22 -07:00
|
|
|
private $objectPHID;
|
2014-03-14 08:51:50 -07:00
|
|
|
private $shouldTerminate = false;
|
2014-05-05 10:55:58 -07:00
|
|
|
private $quoteTargetID;
|
|
|
|
private $quoteRef;
|
2014-12-02 13:10:29 -08:00
|
|
|
private $pager;
|
2014-05-05 10:55:58 -07:00
|
|
|
|
|
|
|
public function setQuoteRef($quote_ref) {
|
|
|
|
$this->quoteRef = $quote_ref;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getQuoteRef() {
|
|
|
|
return $this->quoteRef;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function setQuoteTargetID($quote_target_id) {
|
|
|
|
$this->quoteTargetID = $quote_target_id;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getQuoteTargetID() {
|
|
|
|
return $this->quoteTargetID;
|
|
|
|
}
|
2013-07-28 18:21:22 -07:00
|
|
|
|
|
|
|
public function setObjectPHID($object_phid) {
|
|
|
|
$this->objectPHID = $object_phid;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getObjectPHID() {
|
|
|
|
return $this->objectPHID;
|
|
|
|
}
|
2012-12-21 05:51:33 -08:00
|
|
|
|
|
|
|
public function setIsPreview($is_preview) {
|
|
|
|
$this->isPreview = $is_preview;
|
|
|
|
return $this;
|
|
|
|
}
|
2012-12-11 14:01:51 -08:00
|
|
|
|
|
|
|
public function setShowEditActions($show_edit_actions) {
|
|
|
|
$this->showEditActions = $show_edit_actions;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getShowEditActions() {
|
|
|
|
return $this->showEditActions;
|
|
|
|
}
|
Modernize Macro application
Summary: Adds feed, email, notifications, comments, partial editing, subscriptions, enable/disable, flags and crumbs to Macro.
Test Plan:
{F26839}
{F26840}
{F26841}
{F26842}
{F26843}
{F26844}
{F26845}
Reviewers: vrana, btrahan, chad
Reviewed By: vrana
CC: aran
Maniphest Tasks: T2157, T175, T2104
Differential Revision: https://secure.phabricator.com/D4141
2012-12-11 14:01:03 -08:00
|
|
|
|
|
|
|
public function setMarkupEngine(PhabricatorMarkupEngine $engine) {
|
|
|
|
$this->engine = $engine;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function setTransactions(array $transactions) {
|
|
|
|
assert_instances_of($transactions, 'PhabricatorApplicationTransaction');
|
|
|
|
$this->transactions = $transactions;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
2014-03-14 08:51:50 -07:00
|
|
|
public function setShouldTerminate($term) {
|
|
|
|
$this->shouldTerminate = $term;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
2014-12-02 13:10:29 -08:00
|
|
|
public function setPager(AphrontCursorPagerView $pager) {
|
|
|
|
$this->pager = $pager;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getPager() {
|
|
|
|
return $this->pager;
|
|
|
|
}
|
|
|
|
|
2014-02-14 10:23:07 -08:00
|
|
|
public function buildEvents($with_hiding = false) {
|
2012-12-21 05:51:33 -08:00
|
|
|
$user = $this->getUser();
|
Modernize Macro application
Summary: Adds feed, email, notifications, comments, partial editing, subscriptions, enable/disable, flags and crumbs to Macro.
Test Plan:
{F26839}
{F26840}
{F26841}
{F26842}
{F26843}
{F26844}
{F26845}
Reviewers: vrana, btrahan, chad
Reviewed By: vrana
CC: aran
Maniphest Tasks: T2157, T175, T2104
Differential Revision: https://secure.phabricator.com/D4141
2012-12-11 14:01:03 -08:00
|
|
|
|
2013-03-09 19:23:50 -08:00
|
|
|
$xactions = $this->transactions;
|
2012-12-21 05:51:33 -08:00
|
|
|
|
2013-12-27 05:51:15 -08:00
|
|
|
$xactions = $this->filterHiddenTransactions($xactions);
|
|
|
|
$xactions = $this->groupRelatedTransactions($xactions);
|
|
|
|
$groups = $this->groupDisplayTransactions($xactions);
|
2012-12-21 05:51:33 -08:00
|
|
|
|
2014-02-14 10:23:07 -08:00
|
|
|
// If the viewer has interacted with this object, we hide things from
|
|
|
|
// before their most recent interaction by default. This tends to make
|
|
|
|
// very long threads much more manageable, because you don't have to
|
|
|
|
// scroll through a lot of history and can focus on just new stuff.
|
|
|
|
|
|
|
|
$show_group = null;
|
|
|
|
|
|
|
|
if ($with_hiding) {
|
|
|
|
// Find the most recent comment by the viewer.
|
|
|
|
$group_keys = array_keys($groups);
|
|
|
|
$group_keys = array_reverse($group_keys);
|
|
|
|
|
|
|
|
// If we would only hide a small number of transactions, don't hide
|
|
|
|
// anything. Just don't examine the last few keys. Also, we always
|
|
|
|
// want to show the most recent pieces of activity, so don't examine
|
|
|
|
// the first few keys either.
|
|
|
|
$group_keys = array_slice($group_keys, 2, -2);
|
|
|
|
|
|
|
|
$type_comment = PhabricatorTransactions::TYPE_COMMENT;
|
|
|
|
foreach ($group_keys as $group_key) {
|
|
|
|
$group = $groups[$group_key];
|
|
|
|
foreach ($group as $xaction) {
|
|
|
|
if ($xaction->getAuthorPHID() == $user->getPHID() &&
|
|
|
|
$xaction->getTransactionType() == $type_comment) {
|
|
|
|
// This is the most recent group where the user commented.
|
|
|
|
$show_group = $group_key;
|
|
|
|
break 2;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-12-27 05:51:15 -08:00
|
|
|
$events = array();
|
2014-02-14 10:23:07 -08:00
|
|
|
$hide_by_default = ($show_group !== null);
|
|
|
|
|
|
|
|
foreach ($groups as $group_key => $group) {
|
|
|
|
if ($hide_by_default && ($show_group === $group_key)) {
|
|
|
|
$hide_by_default = false;
|
|
|
|
}
|
|
|
|
|
2013-12-27 05:51:15 -08:00
|
|
|
$group_event = null;
|
|
|
|
foreach ($group as $xaction) {
|
2014-09-16 12:12:35 -07:00
|
|
|
$event = $this->renderEvent($xaction, $group);
|
2014-02-14 10:23:07 -08:00
|
|
|
$event->setHideByDefault($hide_by_default);
|
2013-12-27 05:51:15 -08:00
|
|
|
if (!$group_event) {
|
|
|
|
$group_event = $event;
|
|
|
|
} else {
|
|
|
|
$group_event->addEventToGroup($event);
|
2012-12-11 14:01:51 -08:00
|
|
|
}
|
2014-12-02 13:10:29 -08:00
|
|
|
if ($hide_by_default) {
|
|
|
|
$pager = $this->getPager();
|
|
|
|
if ($pager) {
|
|
|
|
$pager->setNextPageID($xaction->getID());
|
|
|
|
}
|
|
|
|
}
|
2012-12-11 14:01:51 -08:00
|
|
|
}
|
2013-12-27 05:51:15 -08:00
|
|
|
$events[] = $group_event;
|
2014-02-14 10:23:07 -08:00
|
|
|
|
2012-12-11 14:02:12 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
return $events;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function render() {
|
2013-07-28 18:21:22 -07:00
|
|
|
if (!$this->getObjectPHID()) {
|
2014-06-09 11:36:49 -07:00
|
|
|
throw new Exception('Call setObjectPHID() before render()!');
|
2013-07-28 18:21:22 -07:00
|
|
|
}
|
|
|
|
|
2014-12-02 13:10:29 -08:00
|
|
|
$view = $this->buildPHUITimelineView();
|
|
|
|
|
|
|
|
if ($this->getShowEditActions()) {
|
|
|
|
Javelin::initBehavior('phabricator-transaction-list');
|
|
|
|
}
|
|
|
|
|
|
|
|
return $view->render();
|
|
|
|
}
|
|
|
|
|
|
|
|
public function buildPHUITimelineView($with_hiding = true) {
|
|
|
|
if (!$this->getObjectPHID()) {
|
|
|
|
throw new Exception(
|
|
|
|
'Call setObjectPHID() before buildPHUITimelineView()!');
|
|
|
|
}
|
|
|
|
|
2014-02-12 09:02:05 -08:00
|
|
|
$view = new PHUITimelineView();
|
2014-03-14 08:51:50 -07:00
|
|
|
$view->setShouldTerminate($this->shouldTerminate);
|
2014-12-02 13:10:29 -08:00
|
|
|
$events = $this->buildEvents($with_hiding);
|
2012-12-11 14:02:29 -08:00
|
|
|
foreach ($events as $event) {
|
Modernize Macro application
Summary: Adds feed, email, notifications, comments, partial editing, subscriptions, enable/disable, flags and crumbs to Macro.
Test Plan:
{F26839}
{F26840}
{F26841}
{F26842}
{F26843}
{F26844}
{F26845}
Reviewers: vrana, btrahan, chad
Reviewed By: vrana
CC: aran
Maniphest Tasks: T2157, T175, T2104
Differential Revision: https://secure.phabricator.com/D4141
2012-12-11 14:01:03 -08:00
|
|
|
$view->addEvent($event);
|
|
|
|
}
|
2014-12-02 13:10:29 -08:00
|
|
|
if ($this->getPager()) {
|
|
|
|
$view->setPager($this->getPager());
|
2012-12-11 14:02:12 -08:00
|
|
|
}
|
|
|
|
|
2014-12-02 13:10:29 -08:00
|
|
|
return $view;
|
Modernize Macro application
Summary: Adds feed, email, notifications, comments, partial editing, subscriptions, enable/disable, flags and crumbs to Macro.
Test Plan:
{F26839}
{F26840}
{F26841}
{F26842}
{F26843}
{F26844}
{F26845}
Reviewers: vrana, btrahan, chad
Reviewed By: vrana
CC: aran
Maniphest Tasks: T2157, T175, T2104
Differential Revision: https://secure.phabricator.com/D4141
2012-12-11 14:01:03 -08:00
|
|
|
}
|
2012-12-11 14:02:12 -08:00
|
|
|
|
2013-03-09 19:23:50 -08:00
|
|
|
protected function getOrBuildEngine() {
|
2014-02-26 13:17:28 -08:00
|
|
|
if (!$this->engine) {
|
|
|
|
$field = PhabricatorApplicationTransactionComment::MARKUP_FIELD_COMMENT;
|
|
|
|
|
|
|
|
$engine = id(new PhabricatorMarkupEngine())
|
|
|
|
->setViewer($this->getUser());
|
|
|
|
foreach ($this->transactions as $xaction) {
|
|
|
|
if (!$xaction->hasComment()) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
$engine->addObject($xaction->getComment(), $field);
|
2012-12-11 14:02:12 -08:00
|
|
|
}
|
2014-02-26 13:17:28 -08:00
|
|
|
$engine->process();
|
|
|
|
|
|
|
|
$this->engine = $engine;
|
2012-12-11 14:02:12 -08:00
|
|
|
}
|
|
|
|
|
2014-02-26 13:17:28 -08:00
|
|
|
return $this->engine;
|
2012-12-11 14:02:12 -08:00
|
|
|
}
|
|
|
|
|
2013-08-22 16:45:14 -07:00
|
|
|
private function buildChangeDetailsLink(
|
|
|
|
PhabricatorApplicationTransaction $xaction) {
|
|
|
|
|
|
|
|
return javelin_tag(
|
|
|
|
'a',
|
|
|
|
array(
|
|
|
|
'href' => '/transactions/detail/'.$xaction->getPHID().'/',
|
Allow CustomField to provide ApplicationTransaction change details
Summary:
Ref T3886. Ref T418. For fields like "Summary" and "Test Plan" where changes can't be summarized in one line, allow CustomField to provide a "(Show Details)" link and render a diff.
Also consolidate some of the existing copy/paste, and simplify this featuer slightly now that we've move to dialogs.
Test Plan:
{F115918}
- Viewed "description"-style field changes in phlux, pholio, legalpad, maniphest, differential, ponder (questions), ponder (answers), and repositories.
Reviewers: btrahan
Reviewed By: btrahan
CC: aran
Maniphest Tasks: T3886, T418
Differential Revision: https://secure.phabricator.com/D8284
2014-02-21 11:53:04 -08:00
|
|
|
'sigil' => 'workflow',
|
2013-08-22 16:45:14 -07:00
|
|
|
),
|
|
|
|
pht('(Show Details)'));
|
|
|
|
}
|
|
|
|
|
2014-04-17 15:57:34 -07:00
|
|
|
private function buildExtraInformationLink(
|
|
|
|
PhabricatorApplicationTransaction $xaction) {
|
|
|
|
|
|
|
|
$link = $xaction->renderExtraInformationLink();
|
|
|
|
if (!$link) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
return phutil_tag(
|
|
|
|
'span',
|
|
|
|
array(
|
|
|
|
'class' => 'phui-timeline-extra-information',
|
|
|
|
),
|
|
|
|
array(" \xC2\xB7 ", $link));
|
|
|
|
}
|
|
|
|
|
2013-03-09 19:23:50 -08:00
|
|
|
protected function shouldGroupTransactions(
|
|
|
|
PhabricatorApplicationTransaction $u,
|
|
|
|
PhabricatorApplicationTransaction $v) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
protected function renderTransactionContent(
|
|
|
|
PhabricatorApplicationTransaction $xaction) {
|
|
|
|
|
|
|
|
$field = PhabricatorApplicationTransactionComment::MARKUP_FIELD_COMMENT;
|
|
|
|
$engine = $this->getOrBuildEngine();
|
|
|
|
$comment = $xaction->getComment();
|
|
|
|
|
2014-03-14 11:53:30 -07:00
|
|
|
if ($comment) {
|
2014-05-05 10:55:32 -07:00
|
|
|
if ($comment->getIsRemoved()) {
|
|
|
|
return javelin_tag(
|
|
|
|
'span',
|
|
|
|
array(
|
|
|
|
'class' => 'comment-deleted',
|
|
|
|
'sigil' => 'transaction-comment',
|
|
|
|
'meta' => array('phid' => $comment->getTransactionPHID()),
|
|
|
|
),
|
|
|
|
pht(
|
|
|
|
'This comment was removed by %s.',
|
|
|
|
$xaction->getHandle($comment->getAuthorPHID())->renderLink()));
|
|
|
|
} else if ($comment->getIsDeleted()) {
|
2014-04-04 12:23:22 -07:00
|
|
|
return javelin_tag(
|
|
|
|
'span',
|
|
|
|
array(
|
|
|
|
'class' => 'comment-deleted',
|
|
|
|
'sigil' => 'transaction-comment',
|
|
|
|
'meta' => array('phid' => $comment->getTransactionPHID()),
|
|
|
|
),
|
2013-03-09 19:23:50 -08:00
|
|
|
pht('This comment has been deleted.'));
|
2014-03-14 11:53:30 -07:00
|
|
|
} else if ($xaction->hasComment()) {
|
2014-04-04 12:23:22 -07:00
|
|
|
return javelin_tag(
|
|
|
|
'span',
|
|
|
|
array(
|
2014-06-15 21:10:12 -07:00
|
|
|
'class' => 'transaction-comment',
|
2014-04-04 12:23:22 -07:00
|
|
|
'sigil' => 'transaction-comment',
|
|
|
|
'meta' => array('phid' => $comment->getTransactionPHID()),
|
|
|
|
),
|
|
|
|
$engine->getOutput($comment, $field));
|
2014-03-14 11:53:30 -07:00
|
|
|
} else {
|
|
|
|
// This is an empty, non-deleted comment. Usually this happens when
|
|
|
|
// rendering previews.
|
|
|
|
return null;
|
2013-03-09 19:23:50 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return null;
|
|
|
|
}
|
2013-02-17 06:37:02 -08:00
|
|
|
|
2013-12-27 05:51:15 -08:00
|
|
|
private function filterHiddenTransactions(array $xactions) {
|
|
|
|
foreach ($xactions as $key => $xaction) {
|
|
|
|
if ($xaction->shouldHide()) {
|
|
|
|
unset($xactions[$key]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return $xactions;
|
|
|
|
}
|
|
|
|
|
|
|
|
private function groupRelatedTransactions(array $xactions) {
|
|
|
|
$last = null;
|
|
|
|
$last_key = null;
|
|
|
|
$groups = array();
|
|
|
|
foreach ($xactions as $key => $xaction) {
|
|
|
|
if ($last && $this->shouldGroupTransactions($last, $xaction)) {
|
|
|
|
$groups[$last_key][] = $xaction;
|
|
|
|
unset($xactions[$key]);
|
|
|
|
} else {
|
|
|
|
$last = $xaction;
|
|
|
|
$last_key = $key;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
foreach ($xactions as $key => $xaction) {
|
|
|
|
$xaction->attachTransactionGroup(idx($groups, $key, array()));
|
|
|
|
}
|
|
|
|
|
|
|
|
return $xactions;
|
|
|
|
}
|
|
|
|
|
|
|
|
private function groupDisplayTransactions(array $xactions) {
|
|
|
|
$groups = array();
|
|
|
|
$group = array();
|
|
|
|
foreach ($xactions as $xaction) {
|
|
|
|
if ($xaction->shouldDisplayGroupWith($group)) {
|
|
|
|
$group[] = $xaction;
|
|
|
|
} else {
|
|
|
|
if ($group) {
|
|
|
|
$groups[] = $group;
|
|
|
|
}
|
|
|
|
$group = array($xaction);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($group) {
|
|
|
|
$groups[] = $group;
|
|
|
|
}
|
|
|
|
|
|
|
|
foreach ($groups as $key => $group) {
|
|
|
|
$group = msort($group, 'getActionStrength');
|
|
|
|
$group = array_reverse($group);
|
|
|
|
$groups[$key] = $group;
|
|
|
|
}
|
|
|
|
|
|
|
|
return $groups;
|
|
|
|
}
|
|
|
|
|
|
|
|
private function renderEvent(
|
|
|
|
PhabricatorApplicationTransaction $xaction,
|
2014-09-16 12:12:35 -07:00
|
|
|
array $group) {
|
2013-12-27 05:51:15 -08:00
|
|
|
$viewer = $this->getUser();
|
|
|
|
|
2014-02-12 09:02:05 -08:00
|
|
|
$event = id(new PHUITimelineEventView())
|
2013-12-27 05:51:15 -08:00
|
|
|
->setUser($viewer)
|
|
|
|
->setTransactionPHID($xaction->getPHID())
|
|
|
|
->setUserHandle($xaction->getHandle($xaction->getAuthorPHID()))
|
|
|
|
->setIcon($xaction->getIcon())
|
|
|
|
->setColor($xaction->getColor());
|
|
|
|
|
2014-04-21 15:33:59 -07:00
|
|
|
list($token, $token_removed) = $xaction->getToken();
|
|
|
|
if ($token) {
|
|
|
|
$event->setToken($token, $token_removed);
|
|
|
|
}
|
|
|
|
|
2013-12-27 05:51:15 -08:00
|
|
|
if (!$this->shouldSuppressTitle($xaction, $group)) {
|
|
|
|
$title = $xaction->getTitle();
|
|
|
|
if ($xaction->hasChangeDetails()) {
|
2014-02-13 19:37:31 -08:00
|
|
|
if (!$this->isPreview) {
|
2013-12-27 05:51:15 -08:00
|
|
|
$details = $this->buildChangeDetailsLink($xaction);
|
2014-02-13 19:37:31 -08:00
|
|
|
$title = array(
|
|
|
|
$title,
|
|
|
|
' ',
|
|
|
|
$details,
|
|
|
|
);
|
2013-12-27 05:51:15 -08:00
|
|
|
}
|
|
|
|
}
|
2014-04-17 15:57:34 -07:00
|
|
|
|
|
|
|
if (!$this->isPreview) {
|
|
|
|
$more = $this->buildExtraInformationLink($xaction);
|
|
|
|
if ($more) {
|
|
|
|
$title = array($title, ' ', $more);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-12-27 05:51:15 -08:00
|
|
|
$event->setTitle($title);
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($this->isPreview) {
|
|
|
|
$event->setIsPreview(true);
|
|
|
|
} else {
|
|
|
|
$event
|
|
|
|
->setDateCreated($xaction->getDateCreated())
|
|
|
|
->setContentSource($xaction->getContentSource())
|
2014-09-16 12:12:35 -07:00
|
|
|
->setAnchor($xaction->getID());
|
2013-12-27 05:51:15 -08:00
|
|
|
}
|
|
|
|
|
2014-05-19 12:39:26 -07:00
|
|
|
$transaction_type = $xaction->getTransactionType();
|
|
|
|
$comment_type = PhabricatorTransactions::TYPE_COMMENT;
|
|
|
|
$is_normal_comment = ($transaction_type == $comment_type);
|
2013-12-27 05:51:15 -08:00
|
|
|
|
2014-05-19 12:39:26 -07:00
|
|
|
if ($this->getShowEditActions() &&
|
|
|
|
!$this->isPreview &&
|
|
|
|
$is_normal_comment) {
|
|
|
|
|
|
|
|
$has_deleted_comment =
|
|
|
|
$xaction->getComment() &&
|
|
|
|
$xaction->getComment()->getIsDeleted();
|
|
|
|
|
|
|
|
$has_removed_comment =
|
|
|
|
$xaction->getComment() &&
|
|
|
|
$xaction->getComment()->getIsRemoved();
|
2014-05-05 10:55:32 -07:00
|
|
|
|
|
|
|
if ($xaction->getCommentVersion() > 1 && !$has_removed_comment) {
|
2013-12-27 05:51:15 -08:00
|
|
|
$event->setIsEdited(true);
|
|
|
|
}
|
|
|
|
|
2014-05-05 10:55:58 -07:00
|
|
|
// If we have a place for quoted text to go and this is a quotable
|
|
|
|
// comment, pass the quote target ID to the event view.
|
|
|
|
if ($this->getQuoteTargetID()) {
|
|
|
|
if ($xaction->hasComment()) {
|
|
|
|
if (!$has_removed_comment && !$has_deleted_comment) {
|
|
|
|
$event->setQuoteTargetID($this->getQuoteTargetID());
|
|
|
|
$event->setQuoteRef($this->getQuoteRef());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-12-27 05:51:15 -08:00
|
|
|
$can_edit = PhabricatorPolicyCapability::CAN_EDIT;
|
|
|
|
|
|
|
|
if ($xaction->hasComment() || $has_deleted_comment) {
|
|
|
|
$has_edit_capability = PhabricatorPolicyFilter::hasCapability(
|
|
|
|
$viewer,
|
|
|
|
$xaction,
|
|
|
|
$can_edit);
|
2014-05-05 10:55:32 -07:00
|
|
|
if ($has_edit_capability && !$has_removed_comment) {
|
2013-12-27 05:51:15 -08:00
|
|
|
$event->setIsEditable(true);
|
|
|
|
}
|
2014-05-05 10:55:32 -07:00
|
|
|
if ($has_edit_capability || $viewer->getIsAdmin()) {
|
|
|
|
if (!$has_removed_comment) {
|
|
|
|
$event->setIsRemovable(true);
|
|
|
|
}
|
|
|
|
}
|
2013-12-27 05:51:15 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-04-04 12:23:22 -07:00
|
|
|
$comment = $this->renderTransactionContent($xaction);
|
|
|
|
if ($comment) {
|
|
|
|
$event->appendChild($comment);
|
2013-12-27 05:51:15 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
return $event;
|
|
|
|
}
|
|
|
|
|
|
|
|
private function shouldSuppressTitle(
|
|
|
|
PhabricatorApplicationTransaction $xaction,
|
|
|
|
array $group) {
|
|
|
|
|
|
|
|
// This is a little hard-coded, but we don't have any other reasonable
|
|
|
|
// cases for now. Suppress "commented on" if there are other actions in
|
|
|
|
// the display group.
|
|
|
|
|
|
|
|
if (count($group) > 1) {
|
|
|
|
$type_comment = PhabricatorTransactions::TYPE_COMMENT;
|
|
|
|
if ($xaction->getTransactionType() == $type_comment) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
Modernize Macro application
Summary: Adds feed, email, notifications, comments, partial editing, subscriptions, enable/disable, flags and crumbs to Macro.
Test Plan:
{F26839}
{F26840}
{F26841}
{F26842}
{F26843}
{F26844}
{F26845}
Reviewers: vrana, btrahan, chad
Reviewed By: vrana
CC: aran
Maniphest Tasks: T2157, T175, T2104
Differential Revision: https://secure.phabricator.com/D4141
2012-12-11 14:01:03 -08:00
|
|
|
}
|