mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-22 13:30:55 +01:00
Fix "request" and "update" mail preferences for Differential
Summary: Fixes T3030. T1977 attempted to fix this but either didn't work (I think this is the case) or was broken later. We don't send `DifferentialCommentMail` on a create or update; we send `DifferentialReviewRequestMail`. Also update the details to be more clear. Test Plan: Verified review request mail is marked undeliverable: ``` $ ./bin/mail show-outbound --id 6644 ... PARAMETERS ... mailtags: ["differential-review-request"] ... subject: D922: asdf subject-prefix: [Differential] vary-subject-prefix: [Request, 100 lines] ... RECIPIENTS ! duck (duck) - This mail has tags which control which users receive it, and this recipient has not elected to receive mail with any of the tags on this message (Settings > Email Preferences). BODY epriestley requested code review of "asdf". ... ``` Verified update mail is marked undeliverable: ``` $ ./bin/mail show-outbound --id 6646 ... Message: Message has no valid recipients: all To/Cc are disabled, invalid, or configured not to receive this mail. PARAMETERS ... mailtags: ["differential-updated"] ... subject: D922: asdf subject-prefix: [Differential] vary-subject-prefix: [Updated, 100 lines] ... RECIPIENTS ! duck (duck) - This mail has tags which control which users receive it, and this recipient has not elected to receive mail with any of the tags on this message (Settings > Email Preferences). BODY epriestley updated the revision "asdf". ... ``` Reviewers: btrahan Reviewed By: btrahan CC: aran Maniphest Tasks: T3030 Differential Revision: https://secure.phabricator.com/D6518
This commit is contained in:
parent
f32e0e9330
commit
cf255cde3d
3 changed files with 63 additions and 47 deletions
|
@ -48,12 +48,6 @@ final class DifferentialCommentMail extends DifferentialMail {
|
||||||
case DifferentialAction::ACTION_ADDREVIEWERS:
|
case DifferentialAction::ACTION_ADDREVIEWERS:
|
||||||
$tags[] = MetaMTANotificationType::TYPE_DIFFERENTIAL_REVIEWERS;
|
$tags[] = MetaMTANotificationType::TYPE_DIFFERENTIAL_REVIEWERS;
|
||||||
break;
|
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:
|
case DifferentialAction::ACTION_COMMENT:
|
||||||
// this is a comment which we will check separately below for content
|
// this is a comment which we will check separately below for content
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -140,4 +140,14 @@ abstract class DifferentialReviewRequestMail extends DifferentialMail {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function getMailTags() {
|
||||||
|
$tags = array();
|
||||||
|
if ($this->isFirstMailToRecipients()) {
|
||||||
|
$tags[] = MetaMTANotificationType::TYPE_DIFFERENTIAL_REVIEW_REQUEST;
|
||||||
|
} else {
|
||||||
|
$tags[] = MetaMTANotificationType::TYPE_DIFFERENTIAL_UPDATED;
|
||||||
|
}
|
||||||
|
return $tags;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -167,21 +167,34 @@ final class PhabricatorSettingsPanelEmailPreferences
|
||||||
pht('This option adds more information to email subjects, but may '.
|
pht('This option adds more information to email subjects, but may '.
|
||||||
'break threading in some clients.')));
|
'break threading in some clients.')));
|
||||||
|
|
||||||
$form
|
|
||||||
->appendChild(hsprintf(
|
|
||||||
'<br />'.
|
|
||||||
'<p class="aphront-form-instructions">%s</p>'.
|
|
||||||
'<p class="aphront-form-instructions">'.
|
|
||||||
'<strong>%s</strong> %s</p>',
|
|
||||||
pht('You can customize what mail you receive from Phabricator here.'),
|
|
||||||
pht('NOTE:'),
|
|
||||||
pht('If an update makes several changes (like '.
|
|
||||||
'adding CCs to a task, closing it, and adding a comment) you will '.
|
|
||||||
'still receive an email as long as at least one of the changes '.
|
|
||||||
'is set to notify you.')));
|
|
||||||
|
|
||||||
$mailtags = $preferences->getPreference('mailtags', array());
|
$mailtags = $preferences->getPreference('mailtags', array());
|
||||||
|
|
||||||
|
$form->appendChild(
|
||||||
|
id(new PHUIFormDividerControl()));
|
||||||
|
|
||||||
|
$form->appendRemarkupInstructions(
|
||||||
|
pht(
|
||||||
|
'You can customize which kinds of events you receive email for '.
|
||||||
|
'here. If you turn off email for a certain type of event, you '.
|
||||||
|
'will receive an unread notification in Phabricator instead.'.
|
||||||
|
"\n\n".
|
||||||
|
'Phabricator notifications (shown in the menu bar) which you receive '.
|
||||||
|
'an email for are marked read by default in Phabricator. If you turn '.
|
||||||
|
'off email for a certain type of event, the corresponding '.
|
||||||
|
'notification will not be marked read.'.
|
||||||
|
"\n\n".
|
||||||
|
'Note that if an update makes several changes (like adding CCs to a '.
|
||||||
|
'task, closing it, and adding a comment) you will still receive '.
|
||||||
|
'an email as long as at least one of the changes is set to notify '.
|
||||||
|
'you.'.
|
||||||
|
"\n\n".
|
||||||
|
'These preferences **only** apply to objects you are connected to '.
|
||||||
|
'(for example, Revisions where you are a reviewer or tasks you are '.
|
||||||
|
'CC\'d on). To receive email alerts when other objects are created, '.
|
||||||
|
'configure [[ /herald/ | Herald Rules ]].'.
|
||||||
|
"\n\n".
|
||||||
|
'**Phabricator will send an email to your primary account when:**'));
|
||||||
|
|
||||||
$form
|
$form
|
||||||
->appendChild(
|
->appendChild(
|
||||||
$this->buildMailTagCheckboxes(
|
$this->buildMailTagCheckboxes(
|
||||||
|
@ -217,35 +230,34 @@ final class PhabricatorSettingsPanelEmailPreferences
|
||||||
|
|
||||||
private function getMailTags() {
|
private function getMailTags() {
|
||||||
return array(
|
return array(
|
||||||
MetaMTANotificationType::TYPE_DIFFERENTIAL_REVIEWERS =>
|
|
||||||
pht("Send me email when a revision's reviewers change."),
|
|
||||||
MetaMTANotificationType::TYPE_DIFFERENTIAL_CLOSED =>
|
|
||||||
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 =>
|
MetaMTANotificationType::TYPE_DIFFERENTIAL_REVIEW_REQUEST =>
|
||||||
pht("Send me email when I am requested to review a revision."),
|
pht("A revision is created."),
|
||||||
|
MetaMTANotificationType::TYPE_DIFFERENTIAL_UPDATED =>
|
||||||
|
pht("A revision is updated."),
|
||||||
|
MetaMTANotificationType::TYPE_DIFFERENTIAL_COMMENT =>
|
||||||
|
pht("Someone comments on a revision."),
|
||||||
|
MetaMTANotificationType::TYPE_DIFFERENTIAL_REVIEWERS =>
|
||||||
|
pht("A revision's reviewers change."),
|
||||||
|
MetaMTANotificationType::TYPE_DIFFERENTIAL_CLOSED =>
|
||||||
|
pht("A revision is closed."),
|
||||||
|
MetaMTANotificationType::TYPE_DIFFERENTIAL_CC =>
|
||||||
|
pht("A revision's CCs change."),
|
||||||
MetaMTANotificationType::TYPE_DIFFERENTIAL_OTHER =>
|
MetaMTANotificationType::TYPE_DIFFERENTIAL_OTHER =>
|
||||||
pht("Send me email for any other activity not listed above."),
|
pht("Other revision activity not listed above occurs."),
|
||||||
|
|
||||||
MetaMTANotificationType::TYPE_MANIPHEST_STATUS =>
|
MetaMTANotificationType::TYPE_MANIPHEST_STATUS =>
|
||||||
pht("Send me email when a task's status changes."),
|
pht("A task's status changes."),
|
||||||
MetaMTANotificationType::TYPE_MANIPHEST_OWNER =>
|
MetaMTANotificationType::TYPE_MANIPHEST_OWNER =>
|
||||||
pht("Send me email when a task's owner changes."),
|
pht("A task's owner changes."),
|
||||||
MetaMTANotificationType::TYPE_MANIPHEST_PRIORITY =>
|
|
||||||
pht("Send me email when a task's priority changes."),
|
|
||||||
MetaMTANotificationType::TYPE_MANIPHEST_CC =>
|
|
||||||
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 =>
|
MetaMTANotificationType::TYPE_MANIPHEST_COMMENT =>
|
||||||
pht("Send me email when a task is commented on."),
|
pht("Someone comments on a task."),
|
||||||
|
MetaMTANotificationType::TYPE_MANIPHEST_PRIORITY =>
|
||||||
|
pht("A task's priority changes."),
|
||||||
|
MetaMTANotificationType::TYPE_MANIPHEST_CC =>
|
||||||
|
pht("A task's CCs change."),
|
||||||
|
MetaMTANotificationType::TYPE_MANIPHEST_PROJECTS =>
|
||||||
|
pht("A task's associated projects change."),
|
||||||
MetaMTANotificationType::TYPE_MANIPHEST_OTHER =>
|
MetaMTANotificationType::TYPE_MANIPHEST_OTHER =>
|
||||||
pht("Send me email for any other activity not listed above."),
|
pht("Other task activity not listed above occurs."),
|
||||||
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -268,12 +280,12 @@ final class PhabricatorSettingsPanelEmailPreferences
|
||||||
return array_select_keys(
|
return array_select_keys(
|
||||||
$this->getMailTags(),
|
$this->getMailTags(),
|
||||||
array(
|
array(
|
||||||
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_REVIEW_REQUEST,
|
||||||
|
MetaMTANotificationType::TYPE_DIFFERENTIAL_UPDATED,
|
||||||
|
MetaMTANotificationType::TYPE_DIFFERENTIAL_COMMENT,
|
||||||
|
MetaMTANotificationType::TYPE_DIFFERENTIAL_CLOSED,
|
||||||
|
MetaMTANotificationType::TYPE_DIFFERENTIAL_REVIEWERS,
|
||||||
|
MetaMTANotificationType::TYPE_DIFFERENTIAL_CC,
|
||||||
MetaMTANotificationType::TYPE_DIFFERENTIAL_OTHER,
|
MetaMTANotificationType::TYPE_DIFFERENTIAL_OTHER,
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue