mirror of
https://we.phorge.it/source/phorge.git
synced 2025-03-12 20:34:54 +01:00
Summary: Ref T13202. See PHI881. These stories have bad rendering methods, but they didn't previously render into the timeilne (since Phriction documents didn't have a timeline). Update the rendering to work. The rendered outcome isn't great (it isn't very clear or explicit about exactly what moved where), but I'll fix that in a followup. This is a net improvement since it doesn't fatal the page, at least. Test Plan: - Moved page "X" to "Y". - Viewed the old page "X". - Before patch: bad timeline story would fatal rendering. - After patch: story renders, at least, just not great. Reviewers: amckinley Maniphest Tasks: T13202 Differential Revision: https://secure.phabricator.com/D19682
64 lines
1.4 KiB
PHP
64 lines
1.4 KiB
PHP
<?php
|
|
|
|
final class PhrictionDocumentMoveAwayTransaction
|
|
extends PhrictionDocumentVersionTransaction {
|
|
|
|
const TRANSACTIONTYPE = 'move-away';
|
|
|
|
public function generateOldValue($object) {
|
|
return null;
|
|
}
|
|
|
|
public function generateNewValue($object, $value) {
|
|
$document = $value;
|
|
$dict = array(
|
|
'id' => $document->getID(),
|
|
'phid' => $document->getPHID(),
|
|
'content' => $document->getContent()->getContent(),
|
|
'title' => $document->getContent()->getTitle(),
|
|
);
|
|
return $dict;
|
|
}
|
|
|
|
public function applyInternalEffects($object, $value) {
|
|
$object->setStatus(PhrictionDocumentStatus::STATUS_MOVED);
|
|
|
|
$content = $this->getNewDocumentContent($object);
|
|
|
|
$content->setContent('');
|
|
$content->setChangeType(PhrictionChangeType::CHANGE_MOVE_AWAY);
|
|
$content->setChangeRef($value['id']);
|
|
}
|
|
|
|
public function getActionName() {
|
|
return pht('Moved Away');
|
|
}
|
|
|
|
public function getTitle() {
|
|
$new = $this->getNewValue();
|
|
|
|
return pht(
|
|
'%s moved this document to %s.',
|
|
$this->renderAuthor(),
|
|
$this->renderObject($new['phid']));
|
|
}
|
|
|
|
public function getTitleForFeed() {
|
|
$new = $this->getNewValue();
|
|
|
|
return pht(
|
|
'%s moved %s to %s.',
|
|
$this->renderAuthor(),
|
|
$this->renderObject(),
|
|
$this->renderObject($new['phid']));
|
|
}
|
|
|
|
public function getIcon() {
|
|
return 'fa-arrows';
|
|
}
|
|
|
|
public function shouldHideForFeed() {
|
|
return true;
|
|
}
|
|
|
|
}
|