Restore feed stories to Ponder
Summary: Ref T3578. These are a touch rough still, but work.
Test Plan: {F52154}
Reviewers: btrahan
Reviewed By: btrahan
CC: aran
Maniphest Tasks: T3578
Differential Revision: https://secure.phabricator.com/D6616
This commit is contained in:
@@ -3920,7 +3920,7 @@ celerity_register_resource_map(array(
|
|||||||
),
|
),
|
||||||
'ponder-vote-css' =>
|
'ponder-vote-css' =>
|
||||||
array(
|
array(
|
||||||
'uri' => '/res/28b71b13/rsrc/css/application/ponder/vote.css',
|
'uri' => '/res/6bbe8538/rsrc/css/application/ponder/vote.css',
|
||||||
'type' => 'css',
|
'type' => 'css',
|
||||||
'requires' =>
|
'requires' =>
|
||||||
array(
|
array(
|
||||||
|
|||||||
@@ -56,7 +56,22 @@ final class PhabricatorObjectHandleData {
|
|||||||
$xactions = array();
|
$xactions = array();
|
||||||
foreach ($subtypes as $subtype => $subtype_phids) {
|
foreach ($subtypes as $subtype => $subtype_phids) {
|
||||||
// TODO: Do this magically.
|
// TODO: Do this magically.
|
||||||
|
// TODO: ^^^ Really do that ^^^
|
||||||
switch ($subtype) {
|
switch ($subtype) {
|
||||||
|
case PonderPHIDTypeQuestion::TYPECONST:
|
||||||
|
$results = id(new PonderQuestionTransactionQuery())
|
||||||
|
->setViewer($this->viewer)
|
||||||
|
->withPHIDs($subtype_phids)
|
||||||
|
->execute();
|
||||||
|
$xactions += mpull($results, null, 'getPHID');
|
||||||
|
break;
|
||||||
|
case PonderPHIDTypeAnswer::TYPECONST:
|
||||||
|
$results = id(new PonderAnswerTransactionQuery())
|
||||||
|
->setViewer($this->viewer)
|
||||||
|
->withPHIDs($subtype_phids)
|
||||||
|
->execute();
|
||||||
|
$xactions += mpull($results, null, 'getPHID');
|
||||||
|
break;
|
||||||
case PholioPHIDTypeMock::TYPECONST:
|
case PholioPHIDTypeMock::TYPECONST:
|
||||||
$results = id(new PholioTransactionQuery())
|
$results = id(new PholioTransactionQuery())
|
||||||
->setViewer($this->viewer)
|
->setViewer($this->viewer)
|
||||||
|
|||||||
@@ -62,5 +62,13 @@ final class PonderAnswerEditor
|
|||||||
return parent::mergeTransactions($u, $v);
|
return parent::mergeTransactions($u, $v);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function supportsFeed() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function getMailTo(PhabricatorLiskDAO $object) {
|
||||||
|
return array($object->getAuthorPHID());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -145,7 +145,14 @@ final class PonderQuestionEditor
|
|||||||
return parent::mergeTransactions($u, $v);
|
return parent::mergeTransactions($u, $v);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Feed support
|
protected function supportsFeed() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function getMailTo(PhabricatorLiskDAO $object) {
|
||||||
|
return array($object->getAuthorPHID());
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: Mail support
|
// TODO: Mail support
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,6 +25,24 @@ final class PonderAnswerTransaction
|
|||||||
return pht('answer');
|
return pht('answer');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getTitleForFeed() {
|
||||||
|
$author_phid = $this->getAuthorPHID();
|
||||||
|
$object_phid = $this->getObjectPHID();
|
||||||
|
|
||||||
|
$old = $this->getOldValue();
|
||||||
|
$new = $this->getNewValue();
|
||||||
|
|
||||||
|
switch ($this->getTransactionType()) {
|
||||||
|
case self::TYPE_CONTENT:
|
||||||
|
// TODO: This is not so good.
|
||||||
|
return pht(
|
||||||
|
'%s edited their answer to %s',
|
||||||
|
$this->renderHandleLink($author_phid),
|
||||||
|
$this->renderHandleLink($object_phid));
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->getTitle();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -134,7 +134,55 @@ final class PonderQuestionTransaction
|
|||||||
return $view->render();
|
return $view->render();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getTitleForFeed() {
|
||||||
|
$author_phid = $this->getAuthorPHID();
|
||||||
|
$object_phid = $this->getObjectPHID();
|
||||||
|
|
||||||
|
$old = $this->getOldValue();
|
||||||
|
$new = $this->getNewValue();
|
||||||
|
|
||||||
|
switch ($this->getTransactionType()) {
|
||||||
|
case self::TYPE_TITLE:
|
||||||
|
if ($old === null) {
|
||||||
|
return pht(
|
||||||
|
'%s asked a question: %s',
|
||||||
|
$this->renderHandleLink($author_phid),
|
||||||
|
$this->renderHandleLink($object_phid));
|
||||||
|
} else {
|
||||||
|
return pht(
|
||||||
|
'%s edited the title of %s (was "%s")',
|
||||||
|
$this->renderHandleLink($author_phid),
|
||||||
|
$this->renderHandleLink($object_phid),
|
||||||
|
$old);
|
||||||
|
}
|
||||||
|
case self::TYPE_CONTENT:
|
||||||
|
return pht(
|
||||||
|
'%s edited the description of %s',
|
||||||
|
$this->renderHandleLink($author_phid),
|
||||||
|
$this->renderHandleLink($object_phid));
|
||||||
|
case self::TYPE_ANSWERS:
|
||||||
|
// TODO: This could be richer, too.
|
||||||
|
return pht(
|
||||||
|
'%s answered %s',
|
||||||
|
$this->renderHandleLink($author_phid),
|
||||||
|
$this->renderHandleLink($object_phid));
|
||||||
|
case self::TYPE_STATUS:
|
||||||
|
switch ($new) {
|
||||||
|
case PonderQuestionStatus::STATUS_OPEN:
|
||||||
|
return pht(
|
||||||
|
'%s reopened %s',
|
||||||
|
$this->renderHandleLink($author_phid),
|
||||||
|
$this->renderHandleLink($object_phid));
|
||||||
|
case PonderQuestionStatus::STATUS_CLOSED:
|
||||||
|
return pht(
|
||||||
|
'%s closed %s',
|
||||||
|
$this->renderHandleLink($author_phid),
|
||||||
|
$this->renderHandleLink($object_phid));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->getTitle();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1307,7 +1307,7 @@ abstract class PhabricatorApplicationTransactionEditor
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* -( Custom Fields )------------------------------------------------------- */
|
/* -( Custom Fields )------------------------------------------------------ */
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user