1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-26 23:40:57 +01:00

Add even more Differential options

Summary:
These are technically in MetaMTA right now, but I put them in Differential since I think it's probably a better primary category fit and having 120 options in MetaMTA won't do anyone any favors. (We can do some kind of cross-categorization or "related options" later if we get feedback that people are having trouble finding options like these which have multiple reasonable categories.)

Also improve the readability of displayed JSON literals with forward slashes.

Test Plan: Looked at options, edited a couple of them. Looked at JSON literal values, saw them rendered more readably.

Reviewers: codeblock, btrahan

Reviewed By: codeblock

CC: aran

Maniphest Tasks: T2255

Differential Revision: https://secure.phabricator.com/D4464
This commit is contained in:
epriestley 2013-01-16 09:01:16 -08:00
parent 0b7f760a41
commit a9ff58ff27
2 changed files with 73 additions and 1 deletions

View file

@ -13,7 +13,13 @@ final class PhabricatorConfigJSON {
if (is_array($value) && array_keys($value) != range(0, count($value) - 1)) {
return id(new PhutilJSON())->encodeFormatted($value);
} else {
return json_encode($value);
$result = json_encode($value);
// For readability, unescape forward slashes. These are normally escaped
// to prevent the string "</script>" from appearing in a JSON literal,
// but it's irrelevant here and makes reading paths more difficult than
// necessary.
$result = str_replace('\\/', '/', $result);
return $result;
}
}
}

View file

@ -201,6 +201,72 @@ final class PhabricatorDifferentialConfigOptions
pht(
"Similar to `differential.days-fresh` but marks stale revisions. ".
"If the revision is even older than it is when marked as 'old'.")),
$this->newOption(
'metamta.differential.reply-handler-domain',
'string',
null)
->setDescription(
pht('Inbound email domain for Differential replies.')),
$this->newOption(
'metamta.differential.reply-handler',
'class',
'DifferentialReplyHandler')
->setBaseClass('PhabricatorMailReplyHandler')
->setDescription(pht('Alternate reply handler class.')),
$this->newOption(
'metamta.differential.subject-prefix',
'string',
'[Differential]')
->setDescription(pht('Subject prefix for Differential mail.')),
$this->newOption(
'metamta.differential.attach-patches',
'bool',
false)
->setBoolOptions(
array(
pht("Attach Patches"),
pht("Do Not Attach Patches"),
))
->setSummary(pht("Attach patches to email, as text attachments."))
->setDescription(
pht(
"If you set this to true, Phabricator will attach patches to ".
"Differential mail (as text attachments). This will not work if ".
"you are using SendGrid as your mail adapter.")),
$this->newOption(
'metamta.differential.inline-patches',
'int',
0)
->setSummary(pht("Inline patches in email, as body text."))
->setDescription(
pht(
"To include patches inline in email bodies, set this to a ".
"positive integer. Patches will be inlined if they are at most ".
"that many lines. For instance, a value of 100 means 'inline ".
"patches if they are no longer than 100 lines'. By default, ".
"patches are not inlined.")),
// TODO: Implement 'enum'? Options are 'unified' or 'git'.
$this->newOption(
'metamta.differential.patch-format',
'string',
'unified')
->setDescription(
pht("Format for inlined or attached patches: 'git' or 'unified'.")),
$this->newOption(
'metamta.differential.unified-comment-context',
'bool',
false)
->setBoolOptions(
array(
pht("Do not show context"),
pht("Show context"),
))
->setSummary(pht("Show diff context around inline comments in email."))
->setDescription(
pht(
"Normally, inline comments in emails are shown with a file and ".
"line but without any diff context. Enabling this option adds ".
"diff context.")),
);
}