Page MenuHomePhabricator

D12235.id.diff
No OneTemporary

D12235.id.diff

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

Mime Type
text/plain
Expires
Oct 15 2024, 10:27 PM (4 w, 6 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6712755
Default Alt Text
D12235.id.diff (2 KB)

Event Timeline