mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-18 21:02:41 +01:00
Fix text for Passphrase credential destruction transaction when restoring credentials
Summary: Fixes T10211. This transaction can either be setting or removing the "destroyed" flag, but we show "destroyed" in both cases. Instead, if the transaction is clearing the flag, render "restored". Test Plan: {F1068142} Reviewers: chad Reviewed By: chad Maniphest Tasks: T10211 Differential Revision: https://secure.phabricator.com/D15096
This commit is contained in:
parent
0b67e89904
commit
0b4ed94cc6
1 changed files with 17 additions and 4 deletions
|
@ -26,6 +26,7 @@ final class PassphraseCredentialTransaction
|
||||||
|
|
||||||
public function shouldHide() {
|
public function shouldHide() {
|
||||||
$old = $this->getOldValue();
|
$old = $this->getOldValue();
|
||||||
|
$new = $this->getNewValue();
|
||||||
switch ($this->getTransactionType()) {
|
switch ($this->getTransactionType()) {
|
||||||
case self::TYPE_DESCRIPTION:
|
case self::TYPE_DESCRIPTION:
|
||||||
return ($old === null);
|
return ($old === null);
|
||||||
|
@ -35,6 +36,12 @@ final class PassphraseCredentialTransaction
|
||||||
return !strlen($old);
|
return !strlen($old);
|
||||||
case self::TYPE_LOOKEDATSECRET:
|
case self::TYPE_LOOKEDATSECRET:
|
||||||
return false;
|
return false;
|
||||||
|
case self::TYPE_DESTROY:
|
||||||
|
// Don't show "undestroy" transactions because they're a bit confusing
|
||||||
|
// and redundant with restoring a secret.
|
||||||
|
if (!$new) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return parent::shouldHide();
|
return parent::shouldHide();
|
||||||
}
|
}
|
||||||
|
@ -77,12 +84,18 @@ final class PassphraseCredentialTransaction
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case self::TYPE_SECRET_ID:
|
case self::TYPE_SECRET_ID:
|
||||||
return pht(
|
if ($old === null) {
|
||||||
'%s updated the secret for this credential.',
|
return pht(
|
||||||
$this->renderHandleLink($author_phid));
|
'%s attached a new secret to this credential.',
|
||||||
|
$this->renderHandleLink($author_phid));
|
||||||
|
} else {
|
||||||
|
return pht(
|
||||||
|
'%s updated the secret for this credential.',
|
||||||
|
$this->renderHandleLink($author_phid));
|
||||||
|
}
|
||||||
case self::TYPE_DESTROY:
|
case self::TYPE_DESTROY:
|
||||||
return pht(
|
return pht(
|
||||||
'%s destroyed this credential.',
|
'%s destroyed the secret for this credential.',
|
||||||
$this->renderHandleLink($author_phid));
|
$this->renderHandleLink($author_phid));
|
||||||
case self::TYPE_LOOKEDATSECRET:
|
case self::TYPE_LOOKEDATSECRET:
|
||||||
return pht(
|
return pht(
|
||||||
|
|
Loading…
Reference in a new issue