@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 PassphraseCredentialDestroyTransaction
4 extends PassphraseCredentialTransactionType {
5
6 const TRANSACTIONTYPE = 'passphrase:destroy';
7
8 public function generateOldValue($object) {
9 return $object->getIsDestroyed();
10 }
11
12 public function applyInternalEffects($object, $value) {
13 $is_destroyed = $value;
14 $object->setIsDestroyed($is_destroyed);
15 if ($is_destroyed) {
16 $secret_id = $object->getSecretID();
17 if ($secret_id) {
18 $this->destroySecret($secret_id);
19 $object->setSecretID(null);
20 }
21 }
22 }
23
24 public function shouldHide() {
25 $new = $this->getNewValue();
26 if (!$new) {
27 return true;
28 }
29 }
30
31 public function getTitle() {
32 return pht(
33 '%s destroyed the secret for this credential.',
34 $this->renderAuthor());
35 }
36
37 public function getTitleForFeed() {
38 return pht(
39 '%s destroyed the secret for credential %s.',
40 $this->renderAuthor(),
41 $this->renderObject());
42 }
43
44 public function getIcon() {
45 return 'fa-ban';
46 }
47
48 public function getColor() {
49 return 'red';
50 }
51
52}