Add very basic scaffolding for Pholio
Summary:
I'm not going to land this until it's a bit more fleshed out since it would just confuse users, but this is probably more reviewable as a few diffs adding a couple features than one ULTRA-diff adding everything. Implement application basics for Pholio. This does more or less nothing, but adds storage, subscribe, flag, markup, indexing, query basics, PHIDs, handle loads, a couple of realy really basic controllers, etc.
Basic hierarchy is:
- **Moleskine**: Top-level object like a Differential Revision, like "Ponder Feed Ideas".
- **Image**: Each Moleskine has one or more images, like the unexpanded / expanded / mobile / empty states of feed.
- **Transaction**: Comment or edit, like Maniphest. I generally want to move most apps to a transaction model so we can log edits.
- **PixelComment**: Equivalent of an inline comment.
Test Plan: Created a fake object and viewed it.
Reviewers: btrahan, chad
Reviewed By: btrahan
CC: aran, davidreuss
Maniphest Tasks: T2097
Differential Revision: https://secure.phabricator.com/D3817
2012-11-22 02:22:36 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @group pholio
|
|
|
|
*/
|
2012-12-11 22:59:20 +01:00
|
|
|
final class PholioMockEditor extends PhabricatorApplicationTransactionEditor {
|
Add very basic scaffolding for Pholio
Summary:
I'm not going to land this until it's a bit more fleshed out since it would just confuse users, but this is probably more reviewable as a few diffs adding a couple features than one ULTRA-diff adding everything. Implement application basics for Pholio. This does more or less nothing, but adds storage, subscribe, flag, markup, indexing, query basics, PHIDs, handle loads, a couple of realy really basic controllers, etc.
Basic hierarchy is:
- **Moleskine**: Top-level object like a Differential Revision, like "Ponder Feed Ideas".
- **Image**: Each Moleskine has one or more images, like the unexpanded / expanded / mobile / empty states of feed.
- **Transaction**: Comment or edit, like Maniphest. I generally want to move most apps to a transaction model so we can log edits.
- **PixelComment**: Equivalent of an inline comment.
Test Plan: Created a fake object and viewed it.
Reviewers: btrahan, chad
Reviewed By: btrahan
CC: aran, davidreuss
Maniphest Tasks: T2097
Differential Revision: https://secure.phabricator.com/D3817
2012-11-22 02:22:36 +01:00
|
|
|
|
2012-12-11 22:59:20 +01:00
|
|
|
public function getTransactionTypes() {
|
|
|
|
$types = parent::getTransactionTypes();
|
Add very basic scaffolding for Pholio
Summary:
I'm not going to land this until it's a bit more fleshed out since it would just confuse users, but this is probably more reviewable as a few diffs adding a couple features than one ULTRA-diff adding everything. Implement application basics for Pholio. This does more or less nothing, but adds storage, subscribe, flag, markup, indexing, query basics, PHIDs, handle loads, a couple of realy really basic controllers, etc.
Basic hierarchy is:
- **Moleskine**: Top-level object like a Differential Revision, like "Ponder Feed Ideas".
- **Image**: Each Moleskine has one or more images, like the unexpanded / expanded / mobile / empty states of feed.
- **Transaction**: Comment or edit, like Maniphest. I generally want to move most apps to a transaction model so we can log edits.
- **PixelComment**: Equivalent of an inline comment.
Test Plan: Created a fake object and viewed it.
Reviewers: btrahan, chad
Reviewed By: btrahan
CC: aran, davidreuss
Maniphest Tasks: T2097
Differential Revision: https://secure.phabricator.com/D3817
2012-11-22 02:22:36 +01:00
|
|
|
|
2012-12-11 22:59:20 +01:00
|
|
|
$types[] = PhabricatorTransactions::TYPE_VIEW_POLICY;
|
|
|
|
$types[] = PhabricatorTransactions::TYPE_EDIT_POLICY;
|
2012-11-22 02:27:44 +01:00
|
|
|
|
2012-12-11 22:59:20 +01:00
|
|
|
$types[] = PholioTransactionType::TYPE_NAME;
|
|
|
|
$types[] = PholioTransactionType::TYPE_DESCRIPTION;
|
|
|
|
return $types;
|
2012-11-22 02:27:44 +01:00
|
|
|
}
|
|
|
|
|
2012-12-11 22:59:20 +01:00
|
|
|
protected function getCustomTransactionOldValue(
|
|
|
|
PhabricatorLiskDAO $object,
|
|
|
|
PhabricatorApplicationTransaction $xaction) {
|
2012-11-22 02:38:57 +01:00
|
|
|
|
2012-12-11 22:59:20 +01:00
|
|
|
switch ($xaction->getTransactionType()) {
|
|
|
|
case PholioTransactionType::TYPE_NAME:
|
|
|
|
return $object->getName();
|
|
|
|
case PholioTransactionType::TYPE_DESCRIPTION:
|
|
|
|
return $object->getDescription();
|
2012-11-22 02:38:57 +01:00
|
|
|
}
|
2012-12-11 22:59:20 +01:00
|
|
|
}
|
2012-11-22 02:38:57 +01:00
|
|
|
|
2012-12-11 22:59:20 +01:00
|
|
|
protected function getCustomTransactionNewValue(
|
|
|
|
PhabricatorLiskDAO $object,
|
|
|
|
PhabricatorApplicationTransaction $xaction) {
|
2012-11-22 02:27:44 +01:00
|
|
|
|
2012-12-11 22:59:20 +01:00
|
|
|
switch ($xaction->getTransactionType()) {
|
|
|
|
case PholioTransactionType::TYPE_NAME:
|
|
|
|
case PholioTransactionType::TYPE_DESCRIPTION:
|
|
|
|
return $xaction->getNewValue();
|
2012-11-22 02:27:44 +01:00
|
|
|
}
|
2012-12-11 22:59:20 +01:00
|
|
|
}
|
2012-11-22 02:27:44 +01:00
|
|
|
|
2012-12-11 22:59:20 +01:00
|
|
|
protected function applyCustomInternalTransaction(
|
|
|
|
PhabricatorLiskDAO $object,
|
|
|
|
PhabricatorApplicationTransaction $xaction) {
|
2012-11-22 02:27:44 +01:00
|
|
|
|
2012-12-11 22:59:20 +01:00
|
|
|
switch ($xaction->getTransactionType()) {
|
|
|
|
case PholioTransactionType::TYPE_NAME:
|
|
|
|
$object->setName($xaction->getNewValue());
|
|
|
|
if ($object->getOriginalName() === null) {
|
|
|
|
$object->setOriginalName($xaction->getNewValue());
|
2012-11-22 02:38:57 +01:00
|
|
|
}
|
2012-12-11 22:59:20 +01:00
|
|
|
break;
|
|
|
|
case PholioTransactionType::TYPE_DESCRIPTION:
|
|
|
|
$object->setDescription($xaction->getNewValue());
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2012-11-22 02:38:57 +01:00
|
|
|
|
2012-12-11 22:59:20 +01:00
|
|
|
protected function applyCustomExternalTransaction(
|
|
|
|
PhabricatorLiskDAO $object,
|
|
|
|
PhabricatorApplicationTransaction $xaction) {
|
|
|
|
return;
|
|
|
|
}
|
2012-11-22 02:27:44 +01:00
|
|
|
|
2012-12-11 22:59:20 +01:00
|
|
|
protected function mergeTransactions(
|
|
|
|
PhabricatorApplicationTransaction $u,
|
|
|
|
PhabricatorApplicationTransaction $v) {
|
2012-11-22 02:39:46 +01:00
|
|
|
|
2012-12-11 22:59:20 +01:00
|
|
|
$type = $u->getTransactionType();
|
|
|
|
switch ($type) {
|
|
|
|
case PholioTransactionType::TYPE_NAME:
|
|
|
|
case PholioTransactionType::TYPE_DESCRIPTION:
|
|
|
|
return $v;
|
|
|
|
}
|
2012-11-22 02:27:44 +01:00
|
|
|
|
2012-12-11 22:59:20 +01:00
|
|
|
return parent::mergeTransactions($u, $v);
|
2012-11-22 02:27:44 +01:00
|
|
|
}
|
|
|
|
|
2012-12-11 23:00:07 +01:00
|
|
|
protected function supportsMail() {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
protected function buildReplyHandler(PhabricatorLiskDAO $object) {
|
|
|
|
return id(new PholioReplyHandler())
|
|
|
|
->setMailReceiver($object);
|
|
|
|
}
|
2012-12-11 22:59:20 +01:00
|
|
|
|
2012-12-11 23:00:07 +01:00
|
|
|
protected function buildMailTemplate(PhabricatorLiskDAO $object) {
|
|
|
|
$id = $object->getID();
|
|
|
|
$name = $object->getName();
|
|
|
|
$original_name = $object->getOriginalName();
|
2012-11-22 02:39:46 +01:00
|
|
|
|
2012-12-11 23:00:07 +01:00
|
|
|
return id(new PhabricatorMetaMTAMail())
|
|
|
|
->setSubject("M{$id}: {$name}")
|
|
|
|
->addHeader('Thread-Topic', "M{$id}: {$original_name}");
|
|
|
|
}
|
2012-11-22 02:39:46 +01:00
|
|
|
|
2012-12-11 23:00:07 +01:00
|
|
|
protected function getMailTo(PhabricatorLiskDAO $object) {
|
|
|
|
return array(
|
|
|
|
$object->getAuthorPHID(),
|
2012-11-22 02:39:46 +01:00
|
|
|
$this->requireActor()->getPHID(),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2012-12-11 23:00:07 +01:00
|
|
|
protected function buildMailBody(
|
|
|
|
PhabricatorLiskDAO $object,
|
|
|
|
array $xactions) {
|
2012-11-22 02:39:46 +01:00
|
|
|
|
2012-12-11 23:00:07 +01:00
|
|
|
$body = parent::buildMailBody($object, $xactions);
|
|
|
|
$body->addTextSection(
|
|
|
|
pht('MOCK DETAIL'),
|
|
|
|
PhabricatorEnv::getProductionURI('/M'.$object->getID()));
|
2012-11-22 02:39:46 +01:00
|
|
|
|
2012-12-11 23:00:07 +01:00
|
|
|
return $body;
|
2012-11-22 02:39:46 +01:00
|
|
|
}
|
|
|
|
|
2012-12-11 23:00:07 +01:00
|
|
|
protected function getMailSubjectPrefix() {
|
2012-11-22 02:39:46 +01:00
|
|
|
return PhabricatorEnv::getEnvConfig('metamta.pholio.subject-prefix');
|
|
|
|
}
|
|
|
|
|
2012-12-11 23:00:21 +01:00
|
|
|
protected function supportsFeed() {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2012-12-21 23:21:50 +01:00
|
|
|
protected function supportsSearch() {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
Add very basic scaffolding for Pholio
Summary:
I'm not going to land this until it's a bit more fleshed out since it would just confuse users, but this is probably more reviewable as a few diffs adding a couple features than one ULTRA-diff adding everything. Implement application basics for Pholio. This does more or less nothing, but adds storage, subscribe, flag, markup, indexing, query basics, PHIDs, handle loads, a couple of realy really basic controllers, etc.
Basic hierarchy is:
- **Moleskine**: Top-level object like a Differential Revision, like "Ponder Feed Ideas".
- **Image**: Each Moleskine has one or more images, like the unexpanded / expanded / mobile / empty states of feed.
- **Transaction**: Comment or edit, like Maniphest. I generally want to move most apps to a transaction model so we can log edits.
- **PixelComment**: Equivalent of an inline comment.
Test Plan: Created a fake object and viewed it.
Reviewers: btrahan, chad
Reviewed By: btrahan
CC: aran, davidreuss
Maniphest Tasks: T2097
Differential Revision: https://secure.phabricator.com/D3817
2012-11-22 02:22:36 +01:00
|
|
|
}
|