@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.

Make the "Test" adapter support both SMS and email

Summary:
Depends on D20012. Ref T920. If you have a test adapter configured, it should swallow messages and prevent them from ever hitting a lower-priority adapter.

Make the test adapter support SMS so this actually happens.

Test Plan: Ran `bin/mail send-test --type sms ...` with a test adapter (first) and a Twilio adapter (second). Got SMS swallowed by test adapter instead of live SMS messages.

Reviewers: amckinley

Reviewed By: amckinley

Maniphest Tasks: T920

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

+29 -9
+29 -9
src/applications/metamta/adapter/PhabricatorMailTestAdapter.php
··· 33 33 public function getSupportedMessageTypes() { 34 34 return array( 35 35 PhabricatorMailEmailMessage::MESSAGETYPE, 36 + PhabricatorMailSMSMessage::MESSAGETYPE, 36 37 ); 37 38 } 38 39 ··· 63 64 pht('Unit Test (Temporary)')); 64 65 } 65 66 67 + switch ($message->getMessageType()) { 68 + case PhabricatorMailEmailMessage::MESSAGETYPE: 69 + $guts = $this->newEmailGuts($message); 70 + break; 71 + case PhabricatorMailSMSMessage::MESSAGETYPE: 72 + $guts = $this->newSMSGuts($message); 73 + break; 74 + } 75 + 76 + $guts['did-send'] = true; 77 + $this->guts = $guts; 78 + } 79 + 80 + public function getBody() { 81 + return idx($this->guts, 'body'); 82 + } 83 + 84 + public function getHTMLBody() { 85 + return idx($this->guts, 'html-body'); 86 + } 87 + 88 + private function newEmailGuts(PhabricatorMailExternalMessage $message) { 66 89 $guts = array(); 67 90 68 91 $from = $message->getFromAddress(); ··· 123 146 } 124 147 $guts['attachments'] = $file_list; 125 148 126 - $guts['did-send'] = true; 127 - 128 - $this->guts = $guts; 149 + return $guts; 129 150 } 130 151 152 + private function newSMSGuts(PhabricatorMailExternalMessage $message) { 153 + $guts = array(); 131 154 132 - public function getBody() { 133 - return idx($this->guts, 'body'); 134 - } 155 + $guts['to'] = $message->getToNumber(); 156 + $guts['body'] = $message->getTextBody(); 135 157 136 - public function getHTMLBody() { 137 - return idx($this->guts, 'html-body'); 158 + return $guts; 138 159 } 139 - 140 160 141 161 }