mirror of
https://we.phorge.it/source/phorge.git
synced 2025-01-03 03:11:01 +01:00
Allow Herald to be disabled while importing a repository so we don't send a
billion zillion emails.
This commit is contained in:
parent
d6d8598d68
commit
40083bfa0e
4 changed files with 42 additions and 1 deletions
|
@ -240,6 +240,14 @@ class PhabricatorRepositoryEditController
|
||||||
'default-owners-path',
|
'default-owners-path',
|
||||||
'/'));
|
'/'));
|
||||||
|
|
||||||
|
$repository->setDetail(
|
||||||
|
'herald-disabled',
|
||||||
|
$request->getInt('herald-disabled', 0));
|
||||||
|
|
||||||
|
if ($is_svn) {
|
||||||
|
$repository->setUUID($request->getStr('uuid'));
|
||||||
|
}
|
||||||
|
|
||||||
$repository->setDetail(
|
$repository->setDetail(
|
||||||
'detail-parser',
|
'detail-parser',
|
||||||
$request->getStr(
|
$request->getStr(
|
||||||
|
@ -375,6 +383,21 @@ class PhabricatorRepositoryEditController
|
||||||
'/'))
|
'/'))
|
||||||
->setCaption('Default path in Owners tool.'));
|
->setCaption('Default path in Owners tool.'));
|
||||||
|
|
||||||
|
$form
|
||||||
|
->appendChild(
|
||||||
|
id(new AphrontFormSelectControl())
|
||||||
|
->setName('herald-disabled')
|
||||||
|
->setLabel('Herald Enabled')
|
||||||
|
->setValue($repository->getDetail('herald-disabled', 0))
|
||||||
|
->setOptions(
|
||||||
|
array(
|
||||||
|
0 => 'Enabled - Send Email',
|
||||||
|
1 => 'Disabled - Do Not Send Email',
|
||||||
|
))
|
||||||
|
->setCaption(
|
||||||
|
'You can temporarily disable Herald notifications when reparsing '.
|
||||||
|
'a repository or importing a new repository.'));
|
||||||
|
|
||||||
$parsers = id(new PhutilSymbolLoader())
|
$parsers = id(new PhutilSymbolLoader())
|
||||||
->setAncestorClass('PhabricatorRepositoryCommitMessageDetailParser')
|
->setAncestorClass('PhabricatorRepositoryCommitMessageDetailParser')
|
||||||
->selectSymbolsWithoutLoading();
|
->selectSymbolsWithoutLoading();
|
||||||
|
@ -395,7 +418,19 @@ class PhabricatorRepositoryEditController
|
||||||
->setValue(
|
->setValue(
|
||||||
$repository->getDetail(
|
$repository->getDetail(
|
||||||
'detail-parser',
|
'detail-parser',
|
||||||
'PhabricatorRepositoryDefaultCommitMessageDetailParser')))
|
'PhabricatorRepositoryDefaultCommitMessageDetailParser')));
|
||||||
|
|
||||||
|
if ($is_svn) {
|
||||||
|
$form
|
||||||
|
->appendChild(
|
||||||
|
id(new AphrontFormTextControl())
|
||||||
|
->setName('uuid')
|
||||||
|
->setLabel('UUID')
|
||||||
|
->setValue($repository->getUUID())
|
||||||
|
->setCaption('Repository UUID from <tt>svn info</tt>.'));
|
||||||
|
}
|
||||||
|
|
||||||
|
$form
|
||||||
->appendChild(
|
->appendChild(
|
||||||
id(new AphrontFormSubmitControl())
|
id(new AphrontFormSubmitControl())
|
||||||
->setValue('Save'));
|
->setValue('Save'));
|
||||||
|
|
|
@ -16,6 +16,7 @@ phutil_require_module('phabricator', 'applications/repository/storage/repository
|
||||||
phutil_require_module('phabricator', 'infrastructure/env');
|
phutil_require_module('phabricator', 'infrastructure/env');
|
||||||
phutil_require_module('phabricator', 'view/control/table');
|
phutil_require_module('phabricator', 'view/control/table');
|
||||||
phutil_require_module('phabricator', 'view/form/base');
|
phutil_require_module('phabricator', 'view/form/base');
|
||||||
|
phutil_require_module('phabricator', 'view/form/control/select');
|
||||||
phutil_require_module('phabricator', 'view/form/control/submit');
|
phutil_require_module('phabricator', 'view/form/control/submit');
|
||||||
phutil_require_module('phabricator', 'view/form/control/text');
|
phutil_require_module('phabricator', 'view/form/control/text');
|
||||||
phutil_require_module('phabricator', 'view/form/error');
|
phutil_require_module('phabricator', 'view/form/error');
|
||||||
|
|
|
@ -27,6 +27,7 @@ class PhabricatorRepository extends PhabricatorRepositoryDAO {
|
||||||
protected $phid;
|
protected $phid;
|
||||||
protected $name;
|
protected $name;
|
||||||
protected $callsign;
|
protected $callsign;
|
||||||
|
protected $uuid;
|
||||||
|
|
||||||
protected $versionControlSystem;
|
protected $versionControlSystem;
|
||||||
protected $details = array();
|
protected $details = array();
|
||||||
|
|
|
@ -23,6 +23,10 @@ class PhabricatorRepositoryCommitHeraldWorker
|
||||||
PhabricatorRepository $repository,
|
PhabricatorRepository $repository,
|
||||||
PhabricatorRepositoryCommit $commit) {
|
PhabricatorRepositoryCommit $commit) {
|
||||||
|
|
||||||
|
if ($repository->getDetail('herald-disabled')) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$data = id(new PhabricatorRepositoryCommitData())->loadOneWhere(
|
$data = id(new PhabricatorRepositoryCommitData())->loadOneWhere(
|
||||||
'commitID = %d',
|
'commitID = %d',
|
||||||
$commit->getID());
|
$commit->getID());
|
||||||
|
|
Loading…
Reference in a new issue