Page MenuHomePhabricator

D9644.id23160.diff
No OneTemporary

D9644.id23160.diff

diff --git a/src/applications/metamta/constants/MetaMTANotificationType.php b/src/applications/metamta/constants/MetaMTANotificationType.php
--- a/src/applications/metamta/constants/MetaMTANotificationType.php
+++ b/src/applications/metamta/constants/MetaMTANotificationType.php
@@ -19,4 +19,9 @@
const TYPE_MANIPHEST_COMMENT = 'maniphest-comment';
const TYPE_MANIPHEST_OTHER = 'maniphest-other';
+ const TYPE_PHOLIO_STATUS = 'pholio-status';
+ const TYPE_PHOLIO_COMMENT = 'pholio-comment';
+ const TYPE_PHOLIO_UPDATED = 'pholio-updated';
+ const TYPE_PHOLIO_OTHER = 'pholio-other';
+
}
diff --git a/src/applications/pholio/storage/PholioTransaction.php b/src/applications/pholio/storage/PholioTransaction.php
--- a/src/applications/pholio/storage/PholioTransaction.php
+++ b/src/applications/pholio/storage/PholioTransaction.php
@@ -79,6 +79,32 @@
return parent::getIcon();
}
+ public function getMailTags() {
+ $tags = array();
+ switch ($this->getTransactionType()) {
+ case PholioTransactionType::TYPE_INLINE:
+ case PhabricatorTransactions::TYPE_COMMENT:
+ $tags[] = MetaMTANotificationType::TYPE_PHOLIO_COMMENT;
+ break;
+ case PholioTransactionType::TYPE_STATUS:
+ $tags[] = MetaMTANotificationType::TYPE_PHOLIO_STATUS;
+ break;
+ case PholioTransactionType::TYPE_NAME:
+ case PholioTransactionType::TYPE_DESCRIPTION:
+ case PholioTransactionType::TYPE_IMAGE_NAME:
+ case PholioTransactionType::TYPE_IMAGE_DESCRIPTION:
+ case PholioTransactionType::TYPE_IMAGE_SEQUENCE:
+ case PholioTransactionType::TYPE_IMAGE_FILE:
+ case PholioTransactionType::TYPE_IMAGE_REPLACE:
+ $tags[] = MetaMTANotificationType::TYPE_PHOLIO_UPDATED;
+ break;
+ default:
+ $tags[] = MetaMTANotificationType::TYPE_PHOLIO_OTHER;
+ break;
+ }
+ return $tags;
+ }
+
public function getTitle() {
$author_phid = $this->getAuthorPHID();
diff --git a/src/applications/settings/panel/PhabricatorSettingsPanelEmailPreferences.php b/src/applications/settings/panel/PhabricatorSettingsPanelEmailPreferences.php
--- a/src/applications/settings/panel/PhabricatorSettingsPanelEmailPreferences.php
+++ b/src/applications/settings/panel/PhabricatorSettingsPanelEmailPreferences.php
@@ -58,6 +58,11 @@
$all_tags = array_diff_key($all_tags, $this->getManiphestMailTags());
}
+ $pholio = 'PhabricatorApplicationPholio';
+ if (!PhabricatorApplication::isClassInstalled($pholio)) {
+ $all_tags = array_diff_key($all_tags, $this->getPholioMailTags());
+ }
+
foreach ($all_tags as $key => $label) {
$mailtags[$key] = (bool)idx($new_tags, $key, false);
}
@@ -180,15 +185,18 @@
"\n\n".
'**Phabricator will send an email to your primary account when:**'));
- $form
- ->appendChild(
- $this->buildMailTagCheckboxes(
- $this->getDifferentialMailTags(),
- $mailtags)
- ->setLabel(pht('Differential')));
+ if (PhabricatorApplication::isClassInstalledForViewer(
+ 'PhabricatorApplicationDifferential', $user)) {
+ $form
+ ->appendChild(
+ $this->buildMailTagCheckboxes(
+ $this->getDifferentialMailTags(),
+ $mailtags)
+ ->setLabel(pht('Differential')));
+ }
- $maniphest = 'PhabricatorApplicationManiphest';
- if (PhabricatorApplication::isClassInstalled($maniphest)) {
+ if (PhabricatorApplication::isClassInstalledForViewer(
+ 'PhabricatorApplicationManiphest', $user)) {
$form->appendChild(
$this->buildMailTagCheckboxes(
$this->getManiphestMailTags(),
@@ -196,6 +204,15 @@
->setLabel(pht('Maniphest')));
}
+ if (PhabricatorApplication::isClassInstalledForViewer(
+ 'PhabricatorApplicationPholio', $user)) {
+ $form->appendChild(
+ $this->buildMailTagCheckboxes(
+ $this->getPholioMailTags(),
+ $mailtags)
+ ->setLabel(pht('Pholio')));
+ }
+
$form
->appendChild(
id(new AphrontFormSubmitControl())
@@ -244,7 +261,14 @@
pht("A task's associated projects change."),
MetaMTANotificationType::TYPE_MANIPHEST_OTHER =>
pht('Other task activity not listed above occurs.'),
-
+ MetaMTANotificationType::TYPE_PHOLIO_STATUS =>
+ pht("A mock's status changes."),
+ MetaMTANotificationType::TYPE_PHOLIO_COMMENT =>
+ pht('Someone comments on a mock.'),
+ MetaMTANotificationType::TYPE_PHOLIO_UPDATED =>
+ pht('Mock images or descriptions change.'),
+ MetaMTANotificationType::TYPE_PHOLIO_OTHER =>
+ pht('Other mock activity not listed above occurs.'),
);
}
@@ -276,6 +300,17 @@
));
}
+ private function getPholioMailTags() {
+ return array_select_keys(
+ $this->getMailTags(),
+ array(
+ MetaMTANotificationType::TYPE_PHOLIO_STATUS,
+ MetaMTANotificationType::TYPE_PHOLIO_COMMENT,
+ MetaMTANotificationType::TYPE_PHOLIO_UPDATED,
+ MetaMTANotificationType::TYPE_PHOLIO_OTHER,
+ ));
+ }
+
private function buildMailTagCheckboxes(
array $tags,
array $prefs) {

File Metadata

Mime Type
text/plain
Expires
Mon, Nov 4, 7:44 PM (1 w, 1 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6710515
Default Alt Text
D9644.id23160.diff (5 KB)

Event Timeline