Page MenuHomestyx hydra

No OneTemporary

diff --git a/src/applications/maniphest/controller/createtask/ManiphestTaskCreateController.php b/src/applications/maniphest/controller/createtask/ManiphestTaskCreateController.php
index c0fce96e09..35d6bd252d 100644
--- a/src/applications/maniphest/controller/createtask/ManiphestTaskCreateController.php
+++ b/src/applications/maniphest/controller/createtask/ManiphestTaskCreateController.php
@@ -1,147 +1,174 @@
<?php
/*
* Copyright 2011 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
class ManiphestTaskCreateController extends ManiphestController {
public function processRequest() {
$request = $this->getRequest();
$user = $request->getUser();
$task = new ManiphestTask();
$task->setPriority(ManiphestTaskPriority::PRIORITY_TRIAGE);
$errors = array();
$e_title = true;
if ($request->isFormPost()) {
$task->setTitle($request->getStr('title'));
$task->setAuthorPHID($user->getPHID());
- $owner_tokenizer = $request->getArr('assigned_to');
- $task->setOwnerPHID(reset($owner_tokenizer));
- $task->setCCPHIDs($request->getArr('cc'));
- $task->setPriority($request->getInt('priority'));
$task->setDescription($request->getStr('description'));
+ $owner_tokenizer = $request->getArr('assigned_to');
+ $owner_phid = reset($owner_tokenizer);
+
if (!strlen($task->getTitle())) {
$e_title = 'Required';
$errors[] = 'Title is required.';
}
if (!$errors) {
- $transaction = new ManiphestTransaction();
- $transaction->setAuthorPHID($user->getPHID());
- $transaction->setTransactionType(ManiphestTransactionType::TYPE_STATUS);
- $transaction->setNewValue(ManiphestTaskStatus::STATUS_OPEN);
+ $changes = array();
+
+ $changes[ManiphestTransactionType::TYPE_STATUS] =
+ ManiphestTaskStatus::STATUS_OPEN;
+
+ if ($request->getInt('priority') != $task->getPriority()) {
+ $changes[ManiphestTransactionType::TYPE_PRIORITY] =
+ $request->getInt('priority');
+ }
+
+ if ($owner_phid) {
+ $changes[ManiphestTransactionType::TYPE_OWNER] = $owner_phid;
+ }
+
+ if ($request->getArr('cc')) {
+ $changes[ManiphestTransactionType::TYPE_CCS] = $request->getArr('cc');
+ }
+
+ $template = new ManiphestTransaction();
+ $template->setAuthorPHID($user->getPHID());
+ $transactions = array();
+
+ foreach ($changes as $type => $value) {
+ $transaction = clone $template;
+ $transaction->setTransactionType($type);
+ $transaction->setNewValue($value);
+ $transactions[] = $transaction;
+ }
$editor = new ManiphestTransactionEditor();
- $editor->applyTransaction($task, $transaction);
+ $editor->applyTransactions($task, $transactions);
return id(new AphrontRedirectResponse())
->setURI('/T'.$task->getID());
}
+ } else {
+ $task->setCCPHIDs(array(
+ $user->getPHID(),
+ ));
}
$phids = array_merge(
array($task->getOwnerPHID()),
- nonempty($task->getCCPHIDs(), array()));
+ $task->getCCPHIDs());
$phids = array_filter($phids);
$phids = array_unique($phids);
$handles = id(new PhabricatorObjectHandleData($phids))
->loadHandles($phids);
$tvalues = mpull($handles, 'getFullName', 'getPHID');
$error_view = null;
if ($errors) {
$error_view = new AphrontErrorView();
$error_view->setErrors($errors);
$error_view->setTitle('Form Errors');
}
$priority_map = ManiphestTaskPriority::getTaskPriorityMap();
if ($task->getOwnerPHID()) {
$assigned_value = array(
$task->getOwnerPHID() => $handles[$task->getOwnerPHID()]->getFullName(),
);
} else {
$assigned_value = array();
}
if ($task->getCCPHIDs()) {
$cc_value = array_select_keys($tvalues, $task->getCCPHIDs());
} else {
$cc_value = array();
}
$form = new AphrontFormView();
$form
->setUser($user)
->appendChild(
id(new AphrontFormTextAreaControl())
->setLabel('Title')
->setName('title')
->setError($e_title)
->setHeight(AphrontFormTextAreaControl::HEIGHT_VERY_SHORT)
->setValue($task->getTitle()))
->appendChild(
id(new AphrontFormTokenizerControl())
->setLabel('Assigned To')
->setName('assigned_to')
->setValue($assigned_value)
->setDatasource('/typeahead/common/users/')
->setLimit(1))
->appendChild(
id(new AphrontFormTokenizerControl())
->setLabel('CC')
->setName('cc')
->setValue($cc_value)
->setDatasource('/typeahead/common/mailable/'))
->appendChild(
id(new AphrontFormSelectControl())
->setLabel('Priority')
->setName('priority')
->setOptions($priority_map)
->setValue($task->getPriority()))
->appendChild(
id(new AphrontFormTextAreaControl())
->setLabel('Description')
->setName('description')
->setValue($task->getDescription()))
->appendChild(
id(new AphrontFormSubmitControl())
->setValue('Create Task'));
$panel = new AphrontPanelView();
$panel->setWidth(AphrontPanelView::WIDTH_FULL);
$panel->setHeader('Create New Task');
$panel->appendChild($form);
return $this->buildStandardPageResponse(
array(
$error_view,
$panel,
),
array(
'title' => 'Create Task',
));
}
}
diff --git a/src/applications/maniphest/controller/transactionsave/ManiphestTransactionSaveController.php b/src/applications/maniphest/controller/transactionsave/ManiphestTransactionSaveController.php
index e361c04718..7d87e6c031 100644
--- a/src/applications/maniphest/controller/transactionsave/ManiphestTransactionSaveController.php
+++ b/src/applications/maniphest/controller/transactionsave/ManiphestTransactionSaveController.php
@@ -1,67 +1,69 @@
<?php
/*
* Copyright 2011 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
class ManiphestTransactionSaveController extends ManiphestController {
public function processRequest() {
$request = $this->getRequest();
$user = $request->getUser();
$task = id(new ManiphestTask())->load($request->getStr('taskID'));
if (!$task) {
return new Aphront404Response();
}
$action = $request->getStr('action');
$transaction = new ManiphestTransaction();
$transaction
->setAuthorPHID($user->getPHID())
->setComments($request->getStr('comments'))
->setTransactionType($action);
switch ($action) {
case ManiphestTransactionType::TYPE_NONE:
break;
case ManiphestTransactionType::TYPE_STATUS:
$transaction->setNewValue($request->getStr('resolution'));
break;
case ManiphestTransactionType::TYPE_OWNER:
$assign_to = $request->getArr('assign_to');
$assign_to = reset($assign_to);
$transaction->setNewValue($assign_to);
break;
case ManiphestTransactionType::TYPE_CCS:
$ccs = $request->getArr('ccs');
+ $ccs = array_merge($ccs, $task->getCCPHIDs());
+ $ccs = array_unique($ccs);
$transaction->setNewValue($ccs);
break;
case ManiphestTransactionType::TYPE_PRIORITY:
$transaction->setNewValue($request->getInt('priority'));
break;
default:
throw new Exception('unknown action');
}
$editor = new ManiphestTransactionEditor();
- $editor->applyTransaction($task, $transaction);
+ $editor->applyTransactions($task, array($transaction));
return id(new AphrontRedirectResponse())
->setURI('/T'.$task->getID());
}
}
diff --git a/src/applications/maniphest/editor/transaction/ManiphestTransactionEditor.php b/src/applications/maniphest/editor/transaction/ManiphestTransactionEditor.php
index e9d63d1583..ca02201f42 100644
--- a/src/applications/maniphest/editor/transaction/ManiphestTransactionEditor.php
+++ b/src/applications/maniphest/editor/transaction/ManiphestTransactionEditor.php
@@ -1,132 +1,151 @@
<?php
/*
* Copyright 2011 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
class ManiphestTransactionEditor {
- public function applyTransaction($task, $transaction) {
-
- $type = $transaction->getTransactionType();
-
- $new = $transaction->getNewValue();
+ public function applyTransactions($task, array $transactions) {
$email_cc = $task->getCCPHIDs();
$email_to = array();
$email_to[] = $task->getOwnerPHID();
- $email_to[] = $transaction->getAuthorPHID();
-
- switch ($type) {
- case ManiphestTransactionType::TYPE_NONE:
- $old = null;
- break;
- case ManiphestTransactionType::TYPE_STATUS:
- $old = $task->getStatus();
- break;
- case ManiphestTransactionType::TYPE_OWNER:
- $old = $task->getOwnerPHID();
- break;
- case ManiphestTransactionType::TYPE_CCS:
- $old = $task->getCCPHIDs();
- $new = array_unique(array_merge($old, $new));
- break;
- case ManiphestTransactionType::TYPE_PRIORITY:
- $old = $task->getPriority();
- break;
- default:
- throw new Exception('Unknown action type.');
- }
- if (($old !== null) && ($old == $new)) {
- $transaction->setOldValue(null);
- $transaction->setNewValue(null);
- $transaction->setTransactionType(ManiphestTransactionType::TYPE_NONE);
- } else {
+ foreach ($transactions as $transaction) {
+ $type = $transaction->getTransactionType();
+ $new = $transaction->getNewValue();
+ $email_to[] = $transaction->getAuthorPHID();
+
switch ($type) {
case ManiphestTransactionType::TYPE_NONE:
+ $old = null;
break;
case ManiphestTransactionType::TYPE_STATUS:
- $task->setStatus($new);
+ $old = $task->getStatus();
break;
case ManiphestTransactionType::TYPE_OWNER:
- $task->setOwnerPHID($new);
+ $old = $task->getOwnerPHID();
break;
case ManiphestTransactionType::TYPE_CCS:
- $task->setCCPHIDs($new);
+ $old = $task->getCCPHIDs();
break;
case ManiphestTransactionType::TYPE_PRIORITY:
- $task->setPriority($new);
+ $old = $task->getPriority();
break;
default:
throw new Exception('Unknown action type.');
}
- $transaction->setOldValue($old);
- $transaction->setNewValue($new);
+ if (($old !== null) && ($old == $new)) {
+ $transaction->setOldValue(null);
+ $transaction->setNewValue(null);
+ $transaction->setTransactionType(ManiphestTransactionType::TYPE_NONE);
+ } else {
+ switch ($type) {
+ case ManiphestTransactionType::TYPE_NONE:
+ break;
+ case ManiphestTransactionType::TYPE_STATUS:
+ $task->setStatus($new);
+ break;
+ case ManiphestTransactionType::TYPE_OWNER:
+ $task->setOwnerPHID($new);
+ break;
+ case ManiphestTransactionType::TYPE_CCS:
+ $task->setCCPHIDs($new);
+ break;
+ case ManiphestTransactionType::TYPE_PRIORITY:
+ $task->setPriority($new);
+ break;
+ default:
+ throw new Exception('Unknown action type.');
+ }
+
+ $transaction->setOldValue($old);
+ $transaction->setNewValue($new);
+ }
+
}
$task->save();
- $transaction->setTaskID($task->getID());
- $transaction->save();
+ foreach ($transactions as $transaction) {
+ $transaction->setTaskID($task->getID());
+ $transaction->save();
+ }
$email_to[] = $task->getOwnerPHID();
- $email_cc = array_merge($email_cc, $task->getCCPHIDs());
+ $email_cc = array_merge(
+ $email_cc,
+ $task->getCCPHIDs());
- $this->sendEmail($task, $transaction, $email_to, $email_cc);
+ $this->sendEmail($task, $transactions, $email_to, $email_cc);
}
- private function sendEmail($task, $transaction, $email_to, $email_cc) {
+ private function sendEmail($task, $transactions, $email_to, $email_cc) {
$email_to = array_filter(array_unique($email_to));
$email_cc = array_filter(array_unique($email_cc));
- $transactions = array($transaction);
-
$phids = array();
foreach ($transactions as $transaction) {
foreach ($transaction->extractPHIDs() as $phid) {
$phids[$phid] = true;
}
}
$phids = array_keys($phids);
$handles = id(new PhabricatorObjectHandleData($phids))
->loadHandles();
$view = new ManiphestTransactionDetailView();
- $view->setTransaction($transaction);
+ $view->setTransactionGroup($transactions);
$view->setHandles($handles);
-
list($action, $body) = $view->renderForEmail($with_date = false);
+ $is_create = false;
+ foreach ($transactions as $transaction) {
+ $type = $transaction->getTransactionType();
+ if (($type == ManiphestTransactionType::TYPE_STATUS) &&
+ ($transaction->getOldValue() === null) &&
+ ($transaction->getNewValue() == ManiphestTaskStatus::STATUS_OPEN)) {
+ $is_create = true;
+ }
+ }
+
$task_uri = PhabricatorEnv::getURI('/T'.$task->getID());
+ if ($is_create) {
+ $body .=
+ "\n\n".
+ "TASK DESCRIPTION\n".
+ " ".$task->getDescription();
+ }
+
$body .=
"\n\n".
"TASK DETAIL\n".
" ".$task_uri."\n";
id(new PhabricatorMetaMTAMail())
->setSubject(
'[Maniphest] '.$action.': T'.$task->getID().' '.$task->getTitle())
->setFrom($transaction->getAuthorPHID())
->addTos($email_to)
->addCCs($email_cc)
->setBody($body)
->save();
}
}
diff --git a/src/applications/maniphest/editor/transaction/__init__.php b/src/applications/maniphest/editor/transaction/__init__.php
index fd66574fbd..d55c40092f 100644
--- a/src/applications/maniphest/editor/transaction/__init__.php
+++ b/src/applications/maniphest/editor/transaction/__init__.php
@@ -1,18 +1,19 @@
<?php
/**
* This file is automatically generated. Lint this module to rebuild it.
* @generated
*/
+phutil_require_module('phabricator', 'applications/maniphest/constants/status');
phutil_require_module('phabricator', 'applications/maniphest/constants/transactiontype');
phutil_require_module('phabricator', 'applications/maniphest/view/transactiondetail');
phutil_require_module('phabricator', 'applications/metamta/storage/mail');
phutil_require_module('phabricator', 'applications/phid/handle/data');
phutil_require_module('phabricator', 'infrastructure/env');
phutil_require_module('phutil', 'utils');
phutil_require_source('ManiphestTransactionEditor.php');
diff --git a/src/applications/maniphest/storage/task/ManiphestTask.php b/src/applications/maniphest/storage/task/ManiphestTask.php
index aa323a46ec..e690c978ee 100644
--- a/src/applications/maniphest/storage/task/ManiphestTask.php
+++ b/src/applications/maniphest/storage/task/ManiphestTask.php
@@ -1,48 +1,52 @@
<?php
/*
* Copyright 2011 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
class ManiphestTask extends ManiphestDAO {
protected $phid;
protected $authorPHID;
protected $ownerPHID;
protected $ccPHIDs;
protected $status;
protected $priority;
protected $title;
protected $description;
protected $relatedPHIDs;
public function getConfiguration() {
return array(
self::CONFIG_AUX_PHID => true,
self::CONFIG_SERIALIZATION => array(
'ccPHIDs' => self::SERIALIZATION_JSON,
'relatedPHIDs' => self::SERIALIZATION_JSON,
),
) + parent::getConfiguration();
}
public function generatePHID() {
return PhabricatorPHID::generateNewPHID('TASK');
}
+ public function getCCPHIDs() {
+ return nonempty($this->ccPHIDs, array());
+ }
+
}
diff --git a/src/applications/maniphest/storage/task/__init__.php b/src/applications/maniphest/storage/task/__init__.php
index 2290666547..d8d7b7d38b 100644
--- a/src/applications/maniphest/storage/task/__init__.php
+++ b/src/applications/maniphest/storage/task/__init__.php
@@ -1,13 +1,15 @@
<?php
/**
* This file is automatically generated. Lint this module to rebuild it.
* @generated
*/
phutil_require_module('phabricator', 'applications/maniphest/storage/base');
phutil_require_module('phabricator', 'applications/phid/storage/phid');
+phutil_require_module('phutil', 'utils');
+
phutil_require_source('ManiphestTask.php');
diff --git a/src/applications/maniphest/storage/transaction/ManiphestTransaction.php b/src/applications/maniphest/storage/transaction/ManiphestTransaction.php
index 7ed3f58188..a7e4b931dc 100644
--- a/src/applications/maniphest/storage/transaction/ManiphestTransaction.php
+++ b/src/applications/maniphest/storage/transaction/ManiphestTransaction.php
@@ -1,61 +1,86 @@
<?php
/*
* Copyright 2011 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
class ManiphestTransaction extends ManiphestDAO {
protected $taskID;
protected $authorPHID;
protected $transactionType;
protected $oldValue;
protected $newValue;
protected $comments;
protected $cache;
public function getConfiguration() {
return array(
self::CONFIG_SERIALIZATION => array(
'oldValue' => self::SERIALIZATION_JSON,
'newValue' => self::SERIALIZATION_JSON,
),
) + parent::getConfiguration();
}
public function extractPHIDs() {
$phids = array();
switch ($this->getTransactionType()) {
case ManiphestTransactionType::TYPE_CCS:
foreach ($this->getOldValue() as $phid) {
$phids[] = $phid;
}
foreach ($this->getNewValue() as $phid) {
$phids[] = $phid;
}
break;
case ManiphestTransactionType::TYPE_OWNER:
$phids[] = $this->getOldValue();
$phids[] = $this->getNewValue();
break;
}
$phids[] = $this->getAuthorPHID();
return $phids;
}
+ public function canGroupWith($target) {
+ if ($target->getAuthorPHID() != $this->getAuthorPHID()) {
+ return false;
+ }
+ if ($target->hasComments() && $this->hasComments()) {
+ return false;
+ }
+ $ttime = $target->getDateCreated();
+ $stime = $target->getDateCreated();
+ if (abs($stime - $ttime) > 60) {
+ return false;
+ }
+
+ if ($target->getTransactionType() == $this->getTransactionType()) {
+ return false;
+ }
+
+ return true;
+ }
+
+ public function hasComments() {
+ return (bool)strlen(trim($this->getComments()));
+ }
+
+
}
diff --git a/src/applications/maniphest/view/transactiondetail/ManiphestTransactionDetailView.php b/src/applications/maniphest/view/transactiondetail/ManiphestTransactionDetailView.php
index 91df413567..69cf335073 100644
--- a/src/applications/maniphest/view/transactiondetail/ManiphestTransactionDetailView.php
+++ b/src/applications/maniphest/view/transactiondetail/ManiphestTransactionDetailView.php
@@ -1,237 +1,249 @@
<?php
/*
* Copyright 2011 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
class ManiphestTransactionDetailView extends AphrontView {
- private $transaction;
+ private $transactions;
private $handles;
private $markupEngine;
private $forEmail;
- public function setTransaction(ManiphestTransaction $transaction) {
- $this->transaction = $transaction;
+ public function setTransactionGroup(array $transactions) {
+ $this->transactions = $transactions;
return $this;
}
public function setHandles(array $handles) {
$this->handles = $handles;
return $this;
}
public function setMarkupEngine(PhutilMarkupEngine $engine) {
$this->markupEngine = $engine;
return $this;
}
public function renderForEmail($with_date) {
$this->forEmail = true;
- list ($verb, $desc, $classes) = $this->describeAction();
- $transaction = $this->transaction;
+ $transaction = reset($this->transactions);
$author = $this->renderHandles(array($transaction->getAuthorPHID()));
- $desc = $author.' '.$desc;
- if ($with_date) {
- $desc = 'On '.date('M jS \a\t g:i A', $transaction->getDateCreated()).
- ', '.$desc;
+ $action = null;
+ $descs = array();
+ $comments = null;
+ foreach ($this->transactions as $transaction) {
+ list($verb, $desc, $classes) = $this->describeAction($transaction);
+ if ($action === null) {
+ $action = $verb;
+ }
+ $desc = $author.' '.$desc.'.';
+ if ($with_date) {
+ $desc = 'On '.date('M jS \a\t g:i A', $transaction->getDateCreated()).
+ ', '.$desc;
+ }
+ $descs[] = $desc;
+ if ($transaction->hasComments()) {
+ $comments = $transaction->getComments();
+ }
}
- $comments = $transaction->getComments();
- if (strlen(trim($comments))) {
- $desc = $desc.":\n".$comments;
- } else {
- $desc = $desc.".";
+ $descs = implode("\n", $descs);
+ if ($comments) {
+ $descs .= "\n".$comments;
}
$this->forEmail = false;
- return array($verb, $desc);
+ return array($action, $descs);
}
public function render() {
- $transaction = $this->transaction;
$handles = $this->handles;
+ $transactions = $this->transactions;
require_celerity_resource('maniphest-transaction-detail-css');
+ foreach ($this->transactions as $transaction) {
+ if ($transaction->hasComments()) {
+ break;
+ }
+ }
+
$author = $this->handles[$transaction->getAuthorPHID()];
$comments = $transaction->getCache();
if (!strlen($comments)) {
$comments = $transaction->getComments();
if (strlen($comments)) {
$comments = $this->markupEngine->markupText($comments);
$transaction->setCache($comments);
$transaction->save();
}
}
- list($verb, $desc, $classes) = $this->describeAction(
- $transaction->getComments());
+ $more_classes = array();
+ $descs = array();
+ foreach ($transactions as $transaction) {
+ list($verb, $desc, $classes) = $this->describeAction($transaction);
+ $more_classes = array_merge($more_classes, $classes);
+ $descs[] = $author->renderLink().' '.$desc.'.';
+ }
+ $descs = implode('<br />', $descs);
$more_classes = implode(' ', $classes);
- if (strlen(trim($transaction->getComments()))) {
- $punc = ':';
- } else {
- $punc = '.';
- }
-
- if (strlen(trim($transaction->getComments()))) {
+ if ($transaction->hasComments()) {
$comment_block =
'<div class="maniphest-transaction-comments phabricator-remarkup">'.
$comments.
'</div>';
} else {
$comment_block = null;
}
return phutil_render_tag(
'div',
array(
'class' => "maniphest-transaction-detail-container",
'style' => "background-image: url('".$author->getImageURI()."')",
),
'<div class="maniphest-transaction-detail-view '.$more_classes.'">'.
'<div class="maniphest-transaction-header">'.
'<div class="maniphest-transaction-timestamp">'.
phabricator_format_timestamp($transaction->getDateCreated()).
'</div>'.
'<strong>'.
- $author->renderLink().
- ' '.
- $desc.
- $punc.
+ $descs.
'</strong>'.
'</div>'.
$comment_block.
'</div>');
}
- private function describeAction() {
+ private function describeAction($transaction) {
$verb = null;
$desc = null;
$classes = array();
$handles = $this->handles;
- $transaction = $this->transaction;
$type = $transaction->getTransactionType();
$author_phid = $transaction->getAuthorPHID();
$new = $transaction->getNewValue();
$old = $transaction->getOldValue();
switch ($type) {
case ManiphestTransactionType::TYPE_NONE:
$verb = 'Commented On';
$desc = 'added a comment';
break;
case ManiphestTransactionType::TYPE_OWNER:
if ($transaction->getAuthorPHID() == $new) {
$verb = 'Claimed';
$desc = 'claimed this task';
} else if (!$new) {
$verb = 'Up For Grabs';
$desc = 'placed this task up for grabs';
} else if (!$old) {
$verb = 'Assigned';
$desc = 'assigned this task to '.$this->renderHandles(array($new));
} else {
$verb = 'Reassigned';
$desc = 'reassigned this task from '.
$this->renderHandles(array($old)).
' to '.
$this->renderHandles(array($new));
}
break;
case ManiphestTransactionType::TYPE_CCS:
$added = array_diff($new, $old);
$removed = array_diff($old, $new);
if ($added && !$removed) {
$verb = 'Added CC';
if (count($added) == 1) {
$desc = 'added '.$this->renderHandles($added).' to CC';
} else {
$desc = 'added CCs: '.$this->renderHandles($added);
}
} else if ($removed && !$added) {
$verb = 'Removed CC';
if (count($removed) == 1) {
$desc = 'removed '.$this->renderHandles($removed).' from CC';
} else {
$desc = 'removed CCs: '.$this->renderHandles($removed);
}
} else {
$verb = 'Changed CC';
$desc = 'changed CCs, added: '.$this->renderHandles($added).'; '.
'removed: '.$this->renderHandles($removed);
}
break;
case ManiphestTransactionType::TYPE_STATUS:
if ($new == ManiphestTaskStatus::STATUS_OPEN) {
if ($old) {
$verb = 'Reopened';
$desc = 'reopened this task';
} else {
$verb = 'Created';
$desc = 'created this task';
}
} else if ($new == ManiphestTaskStatus::STATUS_CLOSED_SPITE) {
$verb = 'Spited';
$desc = 'closed this task out of spite';
} else {
$verb = 'Closed';
$full = idx(ManiphestTaskStatus::getTaskStatusMap(), $new, '???');
$desc = 'closed this task as "'.$full.'"';
}
break;
case ManiphestTransactionType::TYPE_PRIORITY:
$old_name = ManiphestTaskPriority::getTaskPriorityName($old);
$new_name = ManiphestTaskPriority::getTaskPriorityName($new);
if ($old == ManiphestTaskPriority::PRIORITY_TRIAGE) {
$verb = 'Triaged';
$desc = 'triaged this task as "'.$new_name.'" priority';
} else if ($old > $new) {
$verb = 'Lowered Priority';
$desc = 'lowered the priority of this task from "'.$old_name.'" to '.
'"'.$new_name.'"';
} else {
$verb = 'Raised Priority';
$desc = 'raised the priority of this task from "'.$old_name.'" to '.
'"'.$new_name.'"';
}
break;
default:
return ' brazenly '.$type."'d";
}
return array($verb, $desc, $classes);
}
private function renderHandles($phids) {
$links = array();
foreach ($phids as $phid) {
if ($this->forEmail) {
$links[] = $this->handles[$phid]->getName();
} else {
$links[] = $this->handles[$phid]->renderLink();
}
}
return implode(', ', $links);
}
}
diff --git a/src/applications/maniphest/view/transactionlist/ManiphestTransactionListView.php b/src/applications/maniphest/view/transactionlist/ManiphestTransactionListView.php
index 966cec3858..8d010d83f1 100644
--- a/src/applications/maniphest/view/transactionlist/ManiphestTransactionListView.php
+++ b/src/applications/maniphest/view/transactionlist/ManiphestTransactionListView.php
@@ -1,63 +1,88 @@
<?php
/*
* Copyright 2011 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
class ManiphestTransactionListView extends AphrontView {
private $transactions;
private $handles;
private $user;
private $markupEngine;
public function setTransactions(array $transactions) {
$this->transactions = $transactions;
return $this;
}
public function setHandles(array $handles) {
$this->handles = $handles;
return $this;
}
public function setUser(PhabricatorUser $user) {
$this->user = $user;
return $this;
}
public function setMarkupEngine(PhutilMarkupEngine $engine) {
$this->markupEngine = $engine;
return $this;
}
public function render() {
$views = array();
+
+
+ $last = null;
+ $group = array();
+ $groups = array();
foreach ($this->transactions as $transaction) {
+ if ($last === null) {
+ $last = $transaction;
+ $group[] = $transaction;
+ continue;
+ } else if ($last->canGroupWith($transaction)) {
+ $group[] = $transaction;
+ if ($transaction->hasComments()) {
+ $last = $transaction;
+ }
+ } else {
+ $groups[] = $group;
+ $last = $transaction;
+ $group = array($transaction);
+ }
+ }
+ if ($group) {
+ $groups[] = $group;
+ }
+
+ foreach ($groups as $group) {
$view = new ManiphestTransactionDetailView($transaction);
- $view->setTransaction($transaction);
+ $view->setTransactionGroup($group);
$view->setHandles($this->handles);
$view->setMarkupEngine($this->markupEngine);
$views[] = $view->render();
}
return
'<div style="padding: .5em 1.5em;">'.
implode("\n", $views).
'</div>';
}
}

File Metadata

Mime Type
text/x-diff
Expires
Wed, Jul 2, 6:05 PM (1 d, 1 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
165073
Default Alt Text
(33 KB)

Event Timeline