Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/phabricator
Path: blob/master/src/applications/passphrase/xaction/PassphraseCredentialSecretIDTransaction.php
12256 views
1
<?php
2
3
final class PassphraseCredentialSecretIDTransaction
4
extends PassphraseCredentialTransactionType {
5
6
const TRANSACTIONTYPE = 'passphrase:secretID';
7
8
public function generateOldValue($object) {
9
return $object->getSecretID();
10
}
11
12
public function applyInternalEffects($object, $value) {
13
$old_id = $object->getSecretID();
14
if ($old_id) {
15
$this->destroySecret($old_id);
16
}
17
$object->setSecretID($value);
18
}
19
20
public function getTitle() {
21
$old = $this->getOldValue();
22
if (!$old) {
23
return pht(
24
'%s attached a new secret to this credential.',
25
$this->renderAuthor());
26
} else {
27
return pht(
28
'%s updated the secret for this credential.',
29
$this->renderAuthor());
30
}
31
}
32
33
public function getTitleForFeed() {
34
$old = $this->getOldValue();
35
if ($old === null) {
36
return pht(
37
'%s attached a new secret to %s.',
38
$this->renderAuthor(),
39
$this->renderObject());
40
} else {
41
return pht(
42
'%s updated the secret for %s.',
43
$this->renderAuthor(),
44
$this->renderObject());
45
}
46
}
47
48
public function getIcon() {
49
return 'fa-key';
50
}
51
52
}
53
54