Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F13960235
D12235.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D12235.diff
View Options
diff --git a/src/applications/conpherence/mail/ConpherenceReplyHandler.php b/src/applications/conpherence/mail/ConpherenceReplyHandler.php
--- a/src/applications/conpherence/mail/ConpherenceReplyHandler.php
+++ b/src/applications/conpherence/mail/ConpherenceReplyHandler.php
@@ -58,11 +58,7 @@
->setParentMessageID($mail->getMessageID());
$body = $mail->getCleanTextBody();
- $file_phids = $mail->getAttachments();
- $body = $this->enhanceBodyWithAttachments(
- $body,
- $file_phids,
- '{F%d}');
+ $body = $this->enhanceBodyWithAttachments($body, $mail->getAttachments());
$xactions = array();
if ($this->getMailAddedParticipantPHIDs()) {
diff --git a/src/applications/metamta/replyhandler/PhabricatorMailReplyHandler.php b/src/applications/metamta/replyhandler/PhabricatorMailReplyHandler.php
--- a/src/applications/metamta/replyhandler/PhabricatorMailReplyHandler.php
+++ b/src/applications/metamta/replyhandler/PhabricatorMailReplyHandler.php
@@ -319,30 +319,56 @@
return $this->getSingleReplyHandlerPrefix($address);
}
- final protected function enhanceBodyWithAttachments(
+ final protected function enhanceBodyWithAttachments(
$body,
- array $attachments,
- $format = '- {F%d, layout=link}') {
+ array $attachments) {
+
if (!$attachments) {
return $body;
}
+ // NOTE: This is safe, but not entirely correct. Clean it up after
+ // T7712. These files have the install-default policy right now, which
+ // may or may not be permissive.
$files = id(new PhabricatorFileQuery())
- ->setViewer($this->getActor())
+ ->setViewer(PhabricatorUser::getOmnipotentUser())
->withPHIDs($attachments)
->execute();
- // if we have some text then double return before adding our file list
- if ($body) {
- $body .= "\n\n";
- }
+ $output = array();
+ $output[] = $body;
+ // We're going to put all the non-images first in a list, then embed
+ // the images.
+ $head = array();
+ $tail = array();
foreach ($files as $file) {
- $file_str = sprintf($format, $file->getID());
- $body .= $file_str."\n";
+ if ($file->isViewableImage()) {
+ $tail[] = $file;
+ } else {
+ $head[] = $file;
+ }
+ }
+
+ if ($head) {
+ $list = array();
+ foreach ($head as $file) {
+ $list[] = ' - {'.$file->getMonogram().', layout=link}';
+ }
+ $output[] = implode("\n", $list);
+ }
+
+ if ($tail) {
+ $list = array();
+ foreach ($tail as $file) {
+ $list[] = '{'.$file->getMonogram().'}';
+ }
+ $output[] = implode("\n\n", $list);
}
- return rtrim($body);
+ $output = implode("\n\n", $output);
+
+ return rtrim($output);
}
private function expandRecipientHandles(array $handles) {
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Oct 15 2024, 10:31 PM (4 w, 6 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6712755
Default Alt Text
D12235.diff (2 KB)
Attached To
Mode
D12235: Improve rules for embedding files received via email
Attached
Detach File
Event Timeline
Log In to Comment