Differential D15740 Diff 37930 src/applications/repository/storage/PhabricatorRepositoryTransaction.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/repository/storage/PhabricatorRepositoryTransaction.php
<?php | <?php | ||||
final class PhabricatorRepositoryTransaction | final class PhabricatorRepositoryTransaction | ||||
extends PhabricatorApplicationTransaction { | extends PhabricatorApplicationTransaction { | ||||
const TYPE_VCS = 'repo:vcs'; | const TYPE_VCS = 'repo:vcs'; | ||||
const TYPE_ACTIVATE = 'repo:activate'; | const TYPE_ACTIVATE = 'repo:activate'; | ||||
const TYPE_NAME = 'repo:name'; | const TYPE_NAME = 'repo:name'; | ||||
const TYPE_DESCRIPTION = 'repo:description'; | const TYPE_DESCRIPTION = 'repo:description'; | ||||
const TYPE_ENCODING = 'repo:encoding'; | const TYPE_ENCODING = 'repo:encoding'; | ||||
const TYPE_DEFAULT_BRANCH = 'repo:default-branch'; | const TYPE_DEFAULT_BRANCH = 'repo:default-branch'; | ||||
const TYPE_TRACK_ONLY = 'repo:track-only'; | const TYPE_TRACK_ONLY = 'repo:track-only'; | ||||
const TYPE_AUTOCLOSE_ONLY = 'repo:autoclose-only'; | const TYPE_AUTOCLOSE_ONLY = 'repo:autoclose-only'; | ||||
const TYPE_SVN_SUBPATH = 'repo:svn-subpath'; | const TYPE_SVN_SUBPATH = 'repo:svn-subpath'; | ||||
const TYPE_UUID = 'repo:uuid'; | |||||
const TYPE_NOTIFY = 'repo:notify'; | const TYPE_NOTIFY = 'repo:notify'; | ||||
const TYPE_AUTOCLOSE = 'repo:autoclose'; | const TYPE_AUTOCLOSE = 'repo:autoclose'; | ||||
const TYPE_REMOTE_URI = 'repo:remote-uri'; | |||||
const TYPE_LOCAL_PATH = 'repo:local-path'; | |||||
const TYPE_HOSTING = 'repo:hosting'; | |||||
const TYPE_PROTOCOL_HTTP = 'repo:serve-http'; | |||||
const TYPE_PROTOCOL_SSH = 'repo:serve-ssh'; | |||||
const TYPE_PUSH_POLICY = 'repo:push-policy'; | const TYPE_PUSH_POLICY = 'repo:push-policy'; | ||||
const TYPE_CREDENTIAL = 'repo:credential'; | |||||
const TYPE_DANGEROUS = 'repo:dangerous'; | const TYPE_DANGEROUS = 'repo:dangerous'; | ||||
const TYPE_SLUG = 'repo:slug'; | const TYPE_SLUG = 'repo:slug'; | ||||
const TYPE_SERVICE = 'repo:service'; | const TYPE_SERVICE = 'repo:service'; | ||||
const TYPE_SYMBOLS_SOURCES = 'repo:symbol-source'; | const TYPE_SYMBOLS_SOURCES = 'repo:symbol-source'; | ||||
const TYPE_SYMBOLS_LANGUAGE = 'repo:symbol-language'; | const TYPE_SYMBOLS_LANGUAGE = 'repo:symbol-language'; | ||||
const TYPE_STAGING_URI = 'repo:staging-uri'; | const TYPE_STAGING_URI = 'repo:staging-uri'; | ||||
const TYPE_AUTOMATION_BLUEPRINTS = 'repo:automation-blueprints'; | const TYPE_AUTOMATION_BLUEPRINTS = 'repo:automation-blueprints'; | ||||
const TYPE_CALLSIGN = 'repo:callsign'; | const TYPE_CALLSIGN = 'repo:callsign'; | ||||
// TODO: Clean up these legacy transaction types. | // TODO: Clean up these legacy transaction types. | ||||
const TYPE_SSH_LOGIN = 'repo:ssh-login'; | const TYPE_SSH_LOGIN = 'repo:ssh-login'; | ||||
const TYPE_SSH_KEY = 'repo:ssh-key'; | const TYPE_SSH_KEY = 'repo:ssh-key'; | ||||
const TYPE_SSH_KEYFILE = 'repo:ssh-keyfile'; | const TYPE_SSH_KEYFILE = 'repo:ssh-keyfile'; | ||||
const TYPE_HTTP_LOGIN = 'repo:http-login'; | const TYPE_HTTP_LOGIN = 'repo:http-login'; | ||||
const TYPE_HTTP_PASS = 'repo:http-pass'; | const TYPE_HTTP_PASS = 'repo:http-pass'; | ||||
const TYPE_CREDENTIAL = 'repo:credential'; | |||||
const TYPE_PROTOCOL_HTTP = 'repo:serve-http'; | |||||
const TYPE_PROTOCOL_SSH = 'repo:serve-ssh'; | |||||
const TYPE_HOSTING = 'repo:hosting'; | |||||
const TYPE_LOCAL_PATH = 'repo:local-path'; | |||||
const TYPE_REMOTE_URI = 'repo:remote-uri'; | |||||
const TYPE_UUID = 'repo:uuid'; | |||||
public function getApplicationName() { | public function getApplicationName() { | ||||
return 'repository'; | return 'repository'; | ||||
} | } | ||||
public function getApplicationTransactionType() { | public function getApplicationTransactionType() { | ||||
return PhabricatorRepositoryRepositoryPHIDType::TYPECONST; | return PhabricatorRepositoryRepositoryPHIDType::TYPECONST; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 81 Lines • ▼ Show 20 Lines | public function getTitle() { | ||||
$new = $this->getNewValue(); | $new = $this->getNewValue(); | ||||
switch ($this->getTransactionType()) { | switch ($this->getTransactionType()) { | ||||
case self::TYPE_VCS: | case self::TYPE_VCS: | ||||
return pht( | return pht( | ||||
'%s created this repository.', | '%s created this repository.', | ||||
$this->renderHandleLink($author_phid)); | $this->renderHandleLink($author_phid)); | ||||
case self::TYPE_ACTIVATE: | case self::TYPE_ACTIVATE: | ||||
if ($new) { | // TODO: Old versions of this transaction use a boolean value, but | ||||
Lint: TODO Comment: This comment has a TODO. | |||||
// should be migrated. | |||||
$is_deactivate = | |||||
(!$new) || | |||||
($new == PhabricatorRepository::STATUS_INACTIVE); | |||||
if (!$is_deactivate) { | |||||
return pht( | return pht( | ||||
'%s activated this repository.', | '%s activated this repository.', | ||||
$this->renderHandleLink($author_phid)); | $this->renderHandleLink($author_phid)); | ||||
} else { | } else { | ||||
return pht( | return pht( | ||||
'%s deactivated this repository.', | '%s deactivated this repository.', | ||||
$this->renderHandleLink($author_phid)); | $this->renderHandleLink($author_phid)); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 365 Lines • Show Last 20 Lines |
This comment has a TODO.