1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-28 00:10:57 +01:00

Maniphest Tasks + Project Boards - some polish

Summary:
Fixes T4550 by changing supportsFeed to shouldPublishFeedStory, so things can be more granular like that are with mail. Attempts to fix things generally too, filtering out xactions that have no business in feed, etc.

Also return an updated Task HTML representation on drag and drop moves, etc. This is important so if the priority changes you can see it reflected in the UI.

Test Plan: dragged tasks around. observed no feed stories on subpriority drags. observed feed stories and updated color bars on stories that changed priority

Reviewers: epriestley, chad

Reviewed By: epriestley

CC: Korvin, epriestley, aran

Maniphest Tasks: T4550

Differential Revision: https://secure.phabricator.com/D8399
This commit is contained in:
Bob Trahan 2014-03-04 17:01:33 -08:00
parent cdeea11fd3
commit e78df59ced
14 changed files with 62 additions and 34 deletions

View file

@ -400,7 +400,9 @@ final class ConpherenceEditor extends PhabricatorApplicationTransactionEditor {
return PhabricatorEnv::getEnvConfig('metamta.conpherence.subject-prefix');
}
protected function supportsFeed() {
protected function shouldPublishFeedStory(
PhabricatorLiskDAO $object,
array $xactions) {
return false;
}

View file

@ -785,7 +785,9 @@ final class DifferentialTransactionEditor
return parent::requireCapabilities($object, $xaction);
}
protected function supportsFeed() {
protected function shouldPublishFeedStory(
PhabricatorLiskDAO $object,
array $xactions) {
return true;
}

View file

@ -80,7 +80,9 @@ final class PhabricatorFileEditor
return $body;
}
protected function supportsFeed() {
protected function shouldPublishFeedStory(
PhabricatorLiskDAO $object,
array $xactions) {
return true;
}

View file

@ -183,7 +183,9 @@ final class LegalpadDocumentEditor
}
protected function supportsFeed() {
protected function shouldPublishFeedStory(
PhabricatorLiskDAO $object,
array $xactions) {
return false;
}

View file

@ -156,7 +156,9 @@ final class PhabricatorMacroEditor
return PhabricatorEnv::getEnvConfig('metamta.macro.subject-prefix');
}
protected function supportsFeed() {
protected function shouldPublishFeedStory(
PhabricatorLiskDAO $object,
array $xactions) {
return true;
}
}

View file

@ -251,19 +251,8 @@ final class ManiphestTransactionEditor
PhabricatorLiskDAO $object,
array $xactions) {
$should_mail = true;
if (count($xactions) == 1) {
$xaction = head($xactions);
switch ($xaction->getTransactionType()) {
case ManiphestTransaction::TYPE_SUBPRIORITY:
$should_mail = false;
break;
default:
$should_mail = true;
break;
}
}
return $should_mail;
$xactions = mfilter($xactions, 'shouldHide', true);
return $xactions;
}
protected function getMailSubjectPrefix() {
@ -318,8 +307,10 @@ final class ManiphestTransactionEditor
return $body;
}
protected function supportsFeed() {
return true;
protected function shouldPublishFeedStory(
PhabricatorLiskDAO $object,
array $xactions) {
return $this->shouldSendMail($object, $xactions);
}
protected function supportsSearch() {

View file

@ -109,7 +109,7 @@ final class ManiphestTransaction
return true;
}
return false;
return parent::shouldHide();
}
public function getActionStrength() {

View file

@ -157,7 +157,9 @@ final class PhabricatorPasteEditor
->addHeader('Thread-Topic', "P{$id}");
}
protected function supportsFeed() {
protected function shouldPublishFeedStory(
PhabricatorLiskDAO $object,
array $xactions) {
return true;
}

View file

@ -402,7 +402,9 @@ final class PholioMockEditor extends PhabricatorApplicationTransactionEditor {
return PhabricatorEnv::getEnvConfig('metamta.pholio.subject-prefix');
}
protected function supportsFeed() {
protected function shouldPublishFeedStory(
PhabricatorLiskDAO $object,
array $xactions) {
return true;
}

View file

@ -3,7 +3,9 @@
abstract class PonderEditor
extends PhabricatorApplicationTransactionEditor {
protected function supportsFeed() {
protected function shouldPublishFeedStory(
PhabricatorLiskDAO $object,
array $xactions) {
return true;
}

View file

@ -105,7 +105,22 @@ final class PhabricatorProjectMoveController
$editor->applyTransactions($object, $xactions);
return id(new AphrontAjaxResponse())->setContent(array());
}
$owner = null;
if ($object->getOwnerPHID()) {
$owner = id(new PhabricatorHandleQuery())
->setViewer($viewer)
->withPHIDs(array($object->getOwnerPHID()))
->executeOne();
}
$card = id(new ProjectBoardTaskCard())
->setViewer($viewer)
->setTask($object)
->setOwner($owner)
->setCanEdit(true)
->getItem();
return id(new AphrontAjaxResponse())->setContent(
array('task' => $card));
}
}

View file

@ -597,7 +597,7 @@ abstract class PhabricatorApplicationTransactionEditor
->queueDocumentForIndexing($object->getPHID());
}
if ($this->supportsFeed()) {
if ($this->shouldPublishFeedStory($object, $xactions)) {
$mailed = array();
if ($mail) {
$mailed = $mail->buildRecipientList();
@ -1664,7 +1664,9 @@ abstract class PhabricatorApplicationTransactionEditor
/**
* @task feed
*/
protected function supportsFeed() {
protected function shouldPublishFeedStory(
PhabricatorLiskDAO $object,
array $xactions) {
return false;
}
@ -1729,6 +1731,7 @@ abstract class PhabricatorApplicationTransactionEditor
array $xactions,
array $mailed_phids) {
$xactions = mfilter($xactions, 'shouldHideForFeed', true);
$related_phids = $this->getFeedRelatedPHIDs($object, $xactions);
$subscribed_phids = $this->getFeedNotifyPHIDs($object, $xactions);

View file

@ -354,6 +354,10 @@ abstract class PhabricatorApplicationTransaction
return $this->shouldHide();
}
public function shouldHideForFeed() {
return $this->shouldHide();
}
public function getTitleForMail() {
return id(clone $this)->setRenderingTarget('text')->getTitle();
}

View file

@ -18,8 +18,10 @@ JX.behavior('project-boards', function(config) {
JX.DOM.alterClass(node, 'project-column-empty', !this.findItems().length);
}
function onresponse(response) {
function onresponse(response, item, list) {
list.unlock();
JX.DOM.alterClass(item, 'drag-sending', false);
JX.DOM.replace(item, JX.$H(response.task));
}
function ondrop(list, item, after, from) {
@ -37,10 +39,7 @@ JX.behavior('project-boards', function(config) {
var workflow = new JX.Workflow(config.moveURI, data)
.setHandler(function(response) {
onresponse(response);
list.unlock();
JX.DOM.alterClass(item, 'drag-sending', false);
onresponse(response, item, list);
});
workflow.start();