Merge remote-tracking branch 'upstream/master'
[quix0rs-gnu-social.git] / lib / attachmentlist.php
index a784066fdadf78b413051a53682e82e1b11062c5..f08524e09bd135d531e5174c0e341ab25b0d5c80 100644 (file)
@@ -58,7 +58,7 @@ class AttachmentList extends Widget
      *
      * @param Notice $notice stream of notices from DB_DataObject
      */
-    function __construct($notice, $out=null)
+    function __construct(Notice $notice, $out=null)
     {
         parent::__construct($out);
         $this->notice = $notice;
@@ -75,10 +75,9 @@ class AttachmentList extends Widget
     function show()
     {
        $attachments = $this->notice->attachments();
-        $representable = false;
         foreach ($attachments as $key=>$att) {
-            // Only show attachments representable with a title
-            if ($att->getTitle() === null) {
+            // Remove attachments which are not representable with neither a title nor thumbnail
+            if ($att->getTitle() === null && !$att->hasThumbnail()) {
                 unset($attachments[$key]);
             }
         }