From 83cfbe7bb48d17b463cc86a674bb549de56354e1 Mon Sep 17 00:00:00 2001 From: epriestley Date: Wed, 25 Jun 2014 14:58:56 -0700 Subject: [PATCH] Allow linking to passphrase credential via remarkup Summary: Fixes T5421, add linking to passphrase credentials Test Plan: Open task, add a comment of '{K1}' where K1 is a passphrase credential. Preview and actual comment should be link to credential with the content of credential. Reviewers: epriestley, #blessed_reviewers Reviewed By: epriestley, #blessed_reviewers Subscribers: epriestley, Korvin Maniphest Tasks: T5421 Differential Revision: https://secure.phabricator.com/D9725 --- src/__phutil_library_map__.php | 2 ++ .../PhabricatorApplicationPassphrase.php | 6 ++++++ .../remarkup/PassphraseRemarkupRule.php | 19 +++++++++++++++++++ 3 files changed, 27 insertions(+) create mode 100644 src/applications/passphrase/remarkup/PassphraseRemarkupRule.php diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index cd403c5b1b..fba9a50375 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -1089,6 +1089,7 @@ phutil_register_library_map(array( 'PassphraseDAO' => 'applications/passphrase/storage/PassphraseDAO.php', 'PassphrasePHIDTypeCredential' => 'applications/passphrase/phid/PassphrasePHIDTypeCredential.php', 'PassphrasePasswordKey' => 'applications/passphrase/keys/PassphrasePasswordKey.php', + 'PassphraseRemarkupRule' => 'applications/passphrase/remarkup/PassphraseRemarkupRule.php', 'PassphraseSSHKey' => 'applications/passphrase/keys/PassphraseSSHKey.php', 'PassphraseSecret' => 'applications/passphrase/storage/PassphraseSecret.php', 'PasteCapabilityDefaultView' => 'applications/paste/capability/PasteCapabilityDefaultView.php', @@ -3868,6 +3869,7 @@ phutil_register_library_map(array( 'PassphraseDAO' => 'PhabricatorLiskDAO', 'PassphrasePHIDTypeCredential' => 'PhabricatorPHIDType', 'PassphrasePasswordKey' => 'PassphraseAbstractKey', + 'PassphraseRemarkupRule' => 'PhabricatorRemarkupRuleObject', 'PassphraseSSHKey' => 'PassphraseAbstractKey', 'PassphraseSecret' => 'PassphraseDAO', 'PasteCapabilityDefaultView' => 'PhabricatorPolicyCapability', diff --git a/src/applications/passphrase/application/PhabricatorApplicationPassphrase.php b/src/applications/passphrase/application/PhabricatorApplicationPassphrase.php index a33a44cf77..d04e9335b8 100644 --- a/src/applications/passphrase/application/PhabricatorApplicationPassphrase.php +++ b/src/applications/passphrase/application/PhabricatorApplicationPassphrase.php @@ -45,4 +45,10 @@ final class PhabricatorApplicationPassphrase extends PhabricatorApplication { )); } + public function getRemarkupRules() { + return array( + new PassphraseRemarkupRule(), + ); + } + } diff --git a/src/applications/passphrase/remarkup/PassphraseRemarkupRule.php b/src/applications/passphrase/remarkup/PassphraseRemarkupRule.php new file mode 100644 index 0000000000..aa3fad646c --- /dev/null +++ b/src/applications/passphrase/remarkup/PassphraseRemarkupRule.php @@ -0,0 +1,19 @@ +getEngine()->getConfig('viewer'); + + return id(new PassphraseCredentialQuery()) + ->setViewer($viewer) + ->withIDs($ids) + ->execute(); + + } +}