@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 PhabricatorMacroAudioTransaction
4 extends PhabricatorMacroTransactionType {
5
6 const TRANSACTIONTYPE = 'macro:audio';
7
8 public function generateOldValue($object) {
9 return $object->getAudioPHID();
10 }
11
12 public function applyInternalEffects($object, $value) {
13 $object->setAudioPHID($value);
14 }
15
16 public function extractFilePHIDs($object, $value) {
17 $file_phids = array();
18
19 if ($value) {
20 $file_phids[] = $value;
21 }
22
23 return $file_phids;
24 }
25
26 public function getTitle() {
27 $new = $this->getNewValue();
28 $old = $this->getOldValue();
29 if (!$old) {
30 return pht(
31 '%s attached audio: %s.',
32 $this->renderAuthor(),
33 $this->renderHandle($new));
34 } else {
35 return pht(
36 '%s changed the audio for this macro from %s to %s.',
37 $this->renderAuthor(),
38 $this->renderHandle($old),
39 $this->renderHandle($new));
40 }
41 }
42
43 public function getTitleForFeed() {
44 $new = $this->getNewValue();
45 $old = $this->getOldValue();
46 if (!$old) {
47 return pht(
48 '%s attached audio to %s: %s.',
49 $this->renderAuthor(),
50 $this->renderObject(),
51 $this->renderHandle($new));
52 } else {
53 return pht(
54 '%s changed the audio for %s from %s to %s.',
55 $this->renderAuthor(),
56 $this->renderObject(),
57 $this->renderHandle($old),
58 $this->renderHandle($new));
59 }
60 }
61
62 public function getIcon() {
63 return 'fa-music';
64 }
65
66}