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:
epriestley
2013-07-29 06:30:07 -07:00
parent 5037ba1cf8
commit 1720d651da
7 changed files with 99 additions and 3 deletions

View File

@@ -3920,7 +3920,7 @@ celerity_register_resource_map(array(
),
'ponder-vote-css' =>
array(
'uri' => '/res/28b71b13/rsrc/css/application/ponder/vote.css',
'uri' => '/res/6bbe8538/rsrc/css/application/ponder/vote.css',
'type' => 'css',
'requires' =>
array(

View File

@@ -56,7 +56,22 @@ final class PhabricatorObjectHandleData {
$xactions = array();
foreach ($subtypes as $subtype => $subtype_phids) {
// TODO: Do this magically.
// TODO: ^^^ Really do that ^^^
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:
$results = id(new PholioTransactionQuery())
->setViewer($this->viewer)

View File

@@ -62,5 +62,13 @@ final class PonderAnswerEditor
return parent::mergeTransactions($u, $v);
}
protected function supportsFeed() {
return true;
}
protected function getMailTo(PhabricatorLiskDAO $object) {
return array($object->getAuthorPHID());
}
}

View File

@@ -145,7 +145,14 @@ final class PonderQuestionEditor
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
}

View File

@@ -25,6 +25,24 @@ final class PonderAnswerTransaction
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();
}
}

View File

@@ -134,7 +134,55 @@ final class PonderQuestionTransaction
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();
}
}

View File

@@ -1307,7 +1307,7 @@ abstract class PhabricatorApplicationTransactionEditor
}
/* -( Custom Fields )------------------------------------------------------- */
/* -( Custom Fields )------------------------------------------------------ */
/**