@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Allow encrypted mail to be more specific about which object is affected

Summary:
Depends on D19487. Ref T13151. See PHI647. For some objects, like revisions, we can build slightly more useful secure email without actually disclosing anything.

In the general case, the object monogram may disclose information (`#acquire-competitor`) but most do not, so applications can whitelist an acceptable nondisclosing subject and link.

Support doing this, and make Differential do it. When we don't have a whitelisted URI but do know the object the mail is about, include a generic PHID-based URI; these are always nondisclosing.

Test Plan:
- Without the Differential changes, sent normal mail (no changes) and secure mail (new generic PHID-based link).
- With the Differential changes, sent secure mail; got richer subject and body link.

Reviewers: amckinley

Reviewed By: amckinley

Maniphest Tasks: T13151

Differential Revision: https://secure.phabricator.com/D19488

+44 -8
+4 -3
src/applications/differential/editor/DifferentialTransactionEditor.php
··· 592 592 } 593 593 594 594 protected function buildMailTemplate(PhabricatorLiskDAO $object) { 595 - $id = $object->getID(); 595 + $monogram = $object->getMonogram(); 596 596 $title = $object->getTitle(); 597 - $subject = "D{$id}: {$title}"; 598 597 599 598 return id(new PhabricatorMetaMTAMail()) 600 - ->setSubject($subject); 599 + ->setSubject(pht('%s: %s', $monogram, $title)) 600 + ->setMustEncryptSubject(pht('%s: Revision Updated', $monogram)) 601 + ->setMustEncryptURI($object->getURI()); 601 602 } 602 603 603 604 protected function getTransactionsForMail(
+40 -5
src/applications/metamta/storage/PhabricatorMetaMTAMail.php
··· 291 291 } 292 292 293 293 public function setMustEncrypt($bool) { 294 - $this->setParam('mustEncrypt', $bool); 295 - return $this; 294 + return $this->setParam('mustEncrypt', $bool); 296 295 } 297 296 298 297 public function getMustEncrypt() { 299 298 return $this->getParam('mustEncrypt', false); 300 299 } 301 300 301 + public function setMustEncryptURI($uri) { 302 + return $this->setParam('mustEncrypt.uri', $uri); 303 + } 304 + 305 + public function getMustEncryptURI() { 306 + return $this->getParam('mustEncrypt.uri'); 307 + } 308 + 309 + public function setMustEncryptSubject($subject) { 310 + return $this->setParam('mustEncrypt.subject', $subject); 311 + } 312 + 313 + public function getMustEncryptSubject() { 314 + return $this->getParam('mustEncrypt.subject'); 315 + } 316 + 302 317 public function setMustEncryptReasons(array $reasons) { 303 - $this->setParam('mustEncryptReasons', $reasons); 304 - return $this; 318 + return $this->setParam('mustEncryptReasons', $reasons); 305 319 } 306 320 307 321 public function getMustEncryptReasons() { ··· 787 801 // If mail content must be encrypted, we replace the subject with 788 802 // a generic one. 789 803 if ($must_encrypt) { 790 - $subject[] = pht('Object Updated'); 804 + $encrypt_subject = $this->getMustEncryptSubject(); 805 + if (!strlen($encrypt_subject)) { 806 + $encrypt_subject = pht('Object Updated'); 807 + } 808 + $subject[] = $encrypt_subject; 791 809 } else { 792 810 $vary_prefix = idx($params, 'vary-subject-prefix'); 793 811 if ($vary_prefix != '') { ··· 845 863 $body = $raw_body; 846 864 if ($must_encrypt) { 847 865 $parts = array(); 866 + 867 + $encrypt_uri = $this->getMustEncryptURI(); 868 + if (!strlen($encrypt_uri)) { 869 + $encrypt_phid = $this->getRelatedPHID(); 870 + if ($encrypt_phid) { 871 + $encrypt_uri = urisprintf( 872 + '/object/%s/', 873 + $encrypt_phid); 874 + } 875 + } 876 + 877 + if (strlen($encrypt_uri)) { 878 + $parts[] = pht( 879 + 'This secure message is notifying you of a change to this object:'); 880 + $parts[] = PhabricatorEnv::getProductionURI($encrypt_uri); 881 + } 882 + 848 883 $parts[] = pht( 849 884 'The content for this message can only be transmitted over a '. 850 885 'secure channel. To view the message content, follow this '.