1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-22 21:40:55 +01:00

add a few more email preferences for differential and maniphest

Summary: this makes notifications work better for folks who choose to handle things in Phabricator and not over email

Test Plan: had my test account and "real" account battle each other on a few tasks and divs. Noted that I received emails appropos to the respective settings.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

Maniphest Tasks: T1977

Differential Revision: https://secure.phabricator.com/D3856
This commit is contained in:
Bob Trahan 2012-10-31 17:11:04 -07:00
parent fe329b9738
commit ae616e82d3
4 changed files with 76 additions and 16 deletions

View file

@ -50,10 +50,10 @@ final class DifferentialCommentMail extends DifferentialMail {
}
protected function getMailTags() {
$tags = array();
$comment = $this->getComment();
$action = $comment->getAction();
$action = $comment->getAction();
$tags = array();
switch ($action) {
case DifferentialAction::ACTION_ADDCCS:
$tags[] = MetaMTANotificationType::TYPE_DIFFERENTIAL_CC;
@ -61,6 +61,21 @@ final class DifferentialCommentMail extends DifferentialMail {
case DifferentialAction::ACTION_CLOSE:
$tags[] = MetaMTANotificationType::TYPE_DIFFERENTIAL_CLOSED;
break;
case DifferentialAction::ACTION_ADDREVIEWERS:
$tags[] = MetaMTANotificationType::TYPE_DIFFERENTIAL_REVIEWERS;
break;
case DifferentialAction::ACTION_UPDATE:
$tags[] = MetaMTANotificationType::TYPE_DIFFERENTIAL_UPDATED;
break;
case DifferentialAction::ACTION_REQUEST:
$tags[] = MetaMTANotificationType::TYPE_DIFFERENTIAL_REVIEW_REQUEST;
break;
case DifferentialAction::ACTION_COMMENT:
// this is a comment which we will check separately below for content
break;
default:
$tags[] = MetaMTANotificationType::TYPE_DIFFERENTIAL_OTHER;
break;
}
if (strlen(trim($comment->getContent()))) {

View file

@ -410,6 +410,12 @@ final class ManiphestTransactionEditor extends PhabricatorEditor {
$tags = array();
foreach ($transactions as $xaction) {
switch ($xaction->getTransactionType()) {
case ManiphestTransactionType::TYPE_STATUS:
$tags[] = MetaMTANotificationType::TYPE_MANIPHEST_STATUS;
break;
case ManiphestTransactionType::TYPE_OWNER:
$tags[] = MetaMTANotificationType::TYPE_MANIPHEST_OWNER;
break;
case ManiphestTransactionType::TYPE_CCS:
$tags[] = MetaMTANotificationType::TYPE_MANIPHEST_CC;
break;
@ -419,6 +425,10 @@ final class ManiphestTransactionEditor extends PhabricatorEditor {
case ManiphestTransactionType::TYPE_PRIORITY:
$tags[] = MetaMTANotificationType::TYPE_MANIPHEST_PRIORITY;
break;
case ManiphestTransactionType::TYPE_NONE:
// this is a comment which we will check separately below for
// content
break;
default:
$tags[] = MetaMTANotificationType::TYPE_MANIPHEST_OTHER;
break;

View file

@ -19,14 +19,20 @@
final class MetaMTANotificationType
extends MetaMTAConstants {
const TYPE_DIFFERENTIAL_CLOSED = 'differential-committed';
const TYPE_DIFFERENTIAL_CC = 'differential-cc';
const TYPE_DIFFERENTIAL_COMMENT = 'differential-comment';
const TYPE_DIFFERENTIAL_REVIEWERS = 'differential-reviewers';
const TYPE_DIFFERENTIAL_CLOSED = 'differential-committed';
const TYPE_DIFFERENTIAL_CC = 'differential-cc';
const TYPE_DIFFERENTIAL_COMMENT = 'differential-comment';
const TYPE_DIFFERENTIAL_UPDATED = 'differential-updated';
const TYPE_DIFFERENTIAL_REVIEW_REQUEST = 'differential-review-request';
const TYPE_DIFFERENTIAL_OTHER = 'differential-other';
const TYPE_MANIPHEST_PROJECTS = 'maniphest-projects';
const TYPE_MANIPHEST_STATUS = 'maniphest-status';
const TYPE_MANIPHEST_OWNER = 'maniphest-owner';
const TYPE_MANIPHEST_PRIORITY = 'maniphest-priority';
const TYPE_MANIPHEST_CC = 'maniphest-cc';
const TYPE_MANIPHEST_OTHER = 'maniphest-other';
const TYPE_MANIPHEST_PROJECTS = 'maniphest-projects';
const TYPE_MANIPHEST_COMMENT = 'maniphest-comment';
const TYPE_MANIPHEST_OTHER = 'maniphest-other';
}

View file

@ -223,16 +223,36 @@ final class PhabricatorSettingsPanelEmailPreferences
private function getMailTags() {
return array(
MetaMTANotificationType::TYPE_DIFFERENTIAL_CC =>
"Send me email when a revision's CCs change.",
MetaMTANotificationType::TYPE_DIFFERENTIAL_REVIEWERS =>
pht("Send me email when a revision's reviewers change."),
MetaMTANotificationType::TYPE_DIFFERENTIAL_CLOSED =>
"Send me email when a revision is closed.",
MetaMTANotificationType::TYPE_MANIPHEST_PROJECTS =>
"Send me email when a task's associated projects change.",
pht("Send me email when a revision is closed."),
MetaMTANotificationType::TYPE_DIFFERENTIAL_CC =>
pht("Send me email when a revision's CCs change."),
MetaMTANotificationType::TYPE_DIFFERENTIAL_COMMENT =>
pht("Send me email when a revision is commented on."),
MetaMTANotificationType::TYPE_DIFFERENTIAL_UPDATED =>
pht("Send me email when a revision is updated."),
MetaMTANotificationType::TYPE_DIFFERENTIAL_REVIEW_REQUEST =>
pht("Send me email when I am requested to review a revision."),
MetaMTANotificationType::TYPE_DIFFERENTIAL_OTHER =>
pht("Send me email for any other activity not listed above."),
MetaMTANotificationType::TYPE_MANIPHEST_STATUS =>
pht("Send me email when a task's status changes."),
MetaMTANotificationType::TYPE_MANIPHEST_OWNER =>
pht("Send me email when a task's owner changes."),
MetaMTANotificationType::TYPE_MANIPHEST_PRIORITY =>
"Send me email when a task's priority changes.",
pht("Send me email when a task's priority changes."),
MetaMTANotificationType::TYPE_MANIPHEST_CC =>
"Send me email when a task's CCs change.",
pht("Send me email when a task's CCs change."),
MetaMTANotificationType::TYPE_MANIPHEST_PROJECTS =>
pht("Send me email when a task's associated projects change."),
MetaMTANotificationType::TYPE_MANIPHEST_COMMENT =>
pht("Send me email when a task is commented on."),
MetaMTANotificationType::TYPE_MANIPHEST_OTHER =>
pht("Send me email for any other activity not listed above."),
);
}
@ -240,9 +260,13 @@ final class PhabricatorSettingsPanelEmailPreferences
return array_select_keys(
$this->getMailTags(),
array(
MetaMTANotificationType::TYPE_MANIPHEST_PROJECTS,
MetaMTANotificationType::TYPE_MANIPHEST_STATUS,
MetaMTANotificationType::TYPE_MANIPHEST_OWNER,
MetaMTANotificationType::TYPE_MANIPHEST_PRIORITY,
MetaMTANotificationType::TYPE_MANIPHEST_CC,
MetaMTANotificationType::TYPE_MANIPHEST_PROJECTS,
MetaMTANotificationType::TYPE_MANIPHEST_COMMENT,
MetaMTANotificationType::TYPE_MANIPHEST_OTHER,
));
}
@ -250,8 +274,13 @@ final class PhabricatorSettingsPanelEmailPreferences
return array_select_keys(
$this->getMailTags(),
array(
MetaMTANotificationType::TYPE_DIFFERENTIAL_CC,
MetaMTANotificationType::TYPE_DIFFERENTIAL_REVIEWERS,
MetaMTANotificationType::TYPE_DIFFERENTIAL_CLOSED,
MetaMTANotificationType::TYPE_DIFFERENTIAL_CC,
MetaMTANotificationType::TYPE_DIFFERENTIAL_COMMENT,
MetaMTANotificationType::TYPE_DIFFERENTIAL_UPDATED,
MetaMTANotificationType::TYPE_DIFFERENTIAL_REVIEW_REQUEST,
MetaMTANotificationType::TYPE_DIFFERENTIAL_OTHER,
));
}