]> git.mxchange.org Git - friendica.git/commitdiff
method, not property
authorDomovoy <domovoy@errlock.org>
Fri, 24 Aug 2012 02:57:32 +0000 (04:57 +0200)
committerDomovoy <domovoy@errlock.org>
Fri, 24 Aug 2012 02:57:32 +0000 (04:57 +0200)
include/conversation.php

index 9468832db8299c299dc371b3bebf0a4a0d89e69b..be7327fbefea46867e73d31132e05fd27a97ac45 100644 (file)
@@ -521,7 +521,7 @@ function prepare_threads_body($a, $items, $cmnt_tpl, $page_writeable, $mode, $pr
                                                        $owner_url = zrl($matches[0][1]);
                                                        $owner_name = $matches[0][2];
                                                        // Use the nosign
-                                                       $owner_photo = $a->get_baseurl .'/images/nosign.jpg';
+                                                       $owner_photo = $a->get_baseurl() .'/images/nosign.jpg';
                                                }
                                        }
                                }
@@ -910,22 +910,41 @@ function conversation(&$a, $items, $mode, $update, $preview = false) {
                        // Normal View
                        $page_template = get_markup_template("threaded_conversation.tpl");
 
+                       require_once('object/Conversation.php');
+                       require_once('object/Item.php');
+
+                       $conv = new Conversation($mode);
+
                        // get all the topmost parents
-                       // this shouldn't be needed, as we should have only them in ou array
+                       // this shouldn't be needed, as we should have only them in our array
                        // But for now, this array respects the old style, just in case
 
                        $threads = array();
                        foreach($items as $item) {
 
+                               // Can we put this after the visibility check?
                                like_puller($a,$item,$alike,'like');
                                like_puller($a,$item,$dlike,'dislike');
 
+                               // Only add what is visible
+                               if($item['network'] === NETWORK_MAIL && local_user() != $item['uid']) {
+                                       continue;
+                               }
+                               if($item['verb'] === ACTIVITY_LIKE || $item['verb'] === ACTIVITY_DISLIKE) {
+                                       continue;
+                               }
+
                                if($item['id'] == $item['parent']) {
-                                       $threads[] = $item;
+                                       $item_object = new Item($item);
+                                       $conv->add_thread($item_object);
                                }
                        }
 
-                       $threads = prepare_threads_body($a, $threads, $cmnt_tpl, $page_writeable, $mode,  $profile_owner, $alike, $dlike);
+                       $threads = $conv->get_template_data($alike, $dlike);
+                       if(!$threads) {
+                               logger('[ERROR] conversation : Failed to get template data.', LOGGER_DEBUG);
+                               $threads = array();
+                       }
                }
        }