mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-12 08:36:13 +01:00
c3f95bc410
Summary: Ref T10448. Currently, we use "mail tags" (in {nav Settings > Email Preferences}) to give users some ability to route mail. There are a number of major issues with this: - It isn't modular and can't be extended by third-party applications. - The UI is a giant mess of 5,000 individual settings. - Settings don't map clearly to actual edits. - A lot of stuff isn't covered by any setting. This adds a new system, called "mail stamps", which is similar to "mail tags" but tries to fix all these problems. I called these "stamps" because: stamps make sense with mail; we can't throw away the old system just yet and need to keep it around for a bit; we don't use this term for anything else; it avoids confusion with project tags. (Conceptually, imagine these as ink stamps like "RETURN TO SENDER" or "FRAGILE", not actual postage stamps.) The only real "trick" here is that later versions of this will need to enumerate possible stamps for an object and maybe all possible stamps for all objects in the system. This is why stamp generation is separated into a "template" phase and a "value" phase. In future changes, the "template" phase can be used on its own to generate documentation and typeaheads and let users build rules. This may need some more refinement before it really works since I haven't built any of that yet. Also adds a preference for getting stamps in the header only (default) or header and body (better for Gmail, which can't route based on headers). Test Plan: Fiddled with preference, sent some mail and saw a "STAMPS" setting in the body and an "X-Phabricator-Stamps" header. {F5411694} Reviewers: amckinley Reviewed By: amckinley Maniphest Tasks: T10448 Differential Revision: https://secure.phabricator.com/D18991
47 lines
1.2 KiB
PHP
47 lines
1.2 KiB
PHP
<?php
|
|
|
|
final class PhabricatorEmailStampsSetting
|
|
extends PhabricatorSelectSetting {
|
|
|
|
const SETTINGKEY = 'stamps';
|
|
|
|
const VALUE_BODY_STAMPS = 'body';
|
|
const VALUE_HEADER_STAMPS = 'header';
|
|
|
|
public function getSettingName() {
|
|
return pht('Send Stamps');
|
|
}
|
|
|
|
public function getSettingPanelKey() {
|
|
return PhabricatorEmailFormatSettingsPanel::PANELKEY;
|
|
}
|
|
|
|
protected function getSettingOrder() {
|
|
return 400;
|
|
}
|
|
|
|
protected function getControlInstructions() {
|
|
return pht(<<<EOREMARKUP
|
|
Phabricator stamps mail with labels like `actor(alice)` which can be used to
|
|
write client mail rules to organize mail. By default, these stamps are sent
|
|
in an `X-Phabricator-Stamps` header.
|
|
|
|
If you use a client which can not use headers to route mail (like Gmail),
|
|
you can also include the stamps in the message body so mail rules based on
|
|
body content can route messages.
|
|
EOREMARKUP
|
|
);
|
|
}
|
|
|
|
public function getSettingDefaultValue() {
|
|
return self::VALUE_HEADER_STAMPS;
|
|
}
|
|
|
|
protected function getSelectOptions() {
|
|
return array(
|
|
self::VALUE_HEADER_STAMPS => pht('Mail Headers'),
|
|
self::VALUE_BODY_STAMPS => pht('Mail Headers and Body'),
|
|
);
|
|
}
|
|
|
|
}
|