Fix display of duplicate attachments
authorMichael M Slusarz <slusarz@curecanti.org>
Wed, 10 Feb 2010 18:00:17 +0000 (11:00 -0700)
committerMichael M Slusarz <slusarz@curecanti.org>
Wed, 10 Feb 2010 18:00:33 +0000 (11:00 -0700)
imp/lib/Ui/Message.php

index f2822ea..548abf3 100644 (file)
@@ -491,13 +491,7 @@ class IMP_Ui_Message
                 continue;
             }
 
-            if ($render_mode = $imp_contents->canDisplay($mime_id, IMP_Contents::RENDER_INLINE | IMP_Contents::RENDER_INFO)) {
-                if (($show_parts == 'atc') &&
-                    !($render_mode & IMP_Contents::RENDER_INLINE) &&
-                    $imp_contents->isAttachment($mime_type)) {
-                    $atc_parts[] = $mime_id;
-                }
-            } else {
+            if (!($render_mode = $imp_contents->canDisplay($mime_id, IMP_Contents::RENDER_INLINE | IMP_Contents::RENDER_INFO))) {
                 if ($imp_contents->isAttachment($mime_type)) {
                     if ($show_parts == 'atc') {
                         $atc_parts[] = $mime_id;
@@ -509,14 +503,17 @@ class IMP_Ui_Message
             }
 
             $render_part = $imp_contents->renderMIMEPart($mime_id, $render_mode);
+            if (($show_parts == 'atc') &&
+                $imp_contents->isAttachment($mime_type) &&
+                (empty($render_part) ||
+                 !($render_mode & IMP_Contents::RENDER_INLINE))) {
+                $atc_parts[] = $mime_id;
+            }
+
             if (empty($render_part)) {
-                /* This meant that nothing was rendered - allow this part to
-                 * appear in the attachment list instead. */
-                if ($show_parts == 'atc') {
-                    $atc_parts[] = $mime_id;
+                if ($imp_contents->isAttachment($mime_type)) {
+                    $msgtext .= $this->formatSummary($imp_contents->getSummary($mime_id, $contents_mask), $part_info_display, true);
                 }
-
-                $msgtext .= $this->formatSummary($imp_contents->getSummary($mime_id, $contents_mask), $part_info_display, true);
                 continue;
             }