]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - lib/attachmentlist.php
Merge branch 'openid-plugin' into 'nightly'
[quix0rs-gnu-social.git] / lib / attachmentlist.php
index 6609cb40daecc66c64492d02bcbf7338b3772d4d..dcae917be36c17c8b0180d9d6982203601ba3016 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;
@@ -74,18 +74,27 @@ class AttachmentList extends Widget
      */
     function show()
     {
-       $att = $this->notice->attachments();
-        if (empty($att)) return 0;
+       $attachments = $this->notice->attachments();
+        foreach ($attachments as $key=>$att) {
+            // Only show attachments representable with a title
+            if ($att->getTitle() === null) {
+                unset($attachments[$key]);
+            }
+        }
+        if (!count($attachments)) {
+            return 0;
+        }
+
         $this->showListStart();
 
-        foreach ($att as $n=>$attachment) {
-            $item = $this->newListItem($attachment);
+        foreach ($attachments as $att) {
+            $item = $this->newListItem($att);
             $item->show();
         }
 
         $this->showListEnd();
 
-        return count($att);
+        return count($attachments);
     }
 
     function showListStart()