@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.)
hq.recaptime.dev/wiki/Phorge
phorge
phabricator
1<?php
2
3final class PhrictionDocumentMoveAwayTransaction
4 extends PhrictionDocumentVersionTransaction {
5
6 const TRANSACTIONTYPE = 'move-away';
7
8 public function generateOldValue($object) {
9 return null;
10 }
11
12 public function generateNewValue($object, $value) {
13 $document = $value;
14 $dict = array(
15 'id' => $document->getID(),
16 'phid' => $document->getPHID(),
17 'content' => $document->getContent()->getContent(),
18 'title' => $document->getContent()->getTitle(),
19 );
20 return $dict;
21 }
22
23 public function applyInternalEffects($object, $value) {
24 $object->setStatus(PhrictionDocumentStatus::STATUS_MOVED);
25
26 $content = $this->getNewDocumentContent($object);
27
28 $content->setContent('');
29 $content->setChangeType(PhrictionChangeType::CHANGE_MOVE_AWAY);
30 $content->setChangeRef($value['id']);
31 }
32
33 public function getActionName() {
34 return pht('Moved Away');
35 }
36
37 public function getTitle() {
38 $new = $this->getNewValue();
39
40 return pht(
41 '%s moved this document to %s.',
42 $this->renderAuthor(),
43 $this->renderObject($new['phid']));
44 }
45
46 public function getTitleForFeed() {
47 $new = $this->getNewValue();
48
49 return pht(
50 '%s moved %s to %s.',
51 $this->renderAuthor(),
52 $this->renderObject(),
53 $this->renderObject($new['phid']));
54 }
55
56 public function getIcon() {
57 return 'fa-arrows';
58 }
59
60 public function shouldHideForFeed() {
61 return true;
62 }
63
64}