]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - actions/publictagcloud.php
Merge remote-tracking branch 'upstream/master' into social-master
[quix0rs-gnu-social.git] / actions / publictagcloud.php
index 6d0d4237e9d74ce1788863f43eeb9ed14603d96c..8daf18d5042bd8b4dbe2653f6b3a8edb7f551b00 100644 (file)
@@ -110,6 +110,8 @@ class PublictagcloudAction extends Action
          */
         $tags->selectAdd();
         $tags->selectAdd('tag');
+        $tags->selectAdd('notice_id');
+        $tags->selectAdd('scope');
 
         // Add the aggregated columns...
         $tags->selectAdd('max(notice_id) as last_notice_id');
@@ -117,6 +119,7 @@ class PublictagcloudAction extends Action
         $cutoff = sprintf("notice_tag.created > '%s'",
                           common_sql_date(time() - common_config('tag', 'cutoff')));
         $tags->selectAdd($calc . ' as weight');
+        $tags->joinAdd(array('notice_id', 'notice:id'));
         $tags->whereAdd($cutoff);
         $tags->groupBy('tag');
         $tags->orderBy('weight DESC');
@@ -132,8 +135,11 @@ class PublictagcloudAction extends Action
             $tw = array();
             $sum = 0;
             while ($tags->fetch()) {
-                $tw[$tags->tag] = $tags->weight;
-                $sum += $tags->weight;
+                // Check scope:
+                if ($tags->isCurrentProfileInScope()) {
+                    $tw[$tags->tag] = $tags->weight;
+                    $sum += $tags->weight;
+                }
             }
 
             ksort($tw);