]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Only get POST verbs for noticestreams for now
authorMikael Nordfeldth <mmn@hethane.se>
Wed, 9 Jul 2014 11:37:09 +0000 (13:37 +0200)
committerMikael Nordfeldth <mmn@hethane.se>
Wed, 9 Jul 2014 11:37:09 +0000 (13:37 +0200)
Since we store 'favorite' verbs as notices now too, they caused a lot of
"null" notices that might not be interesting before we handle them better
in the UIs.

lib/conversationnoticestream.php
lib/noticestream.php
lib/profilenoticestream.php
lib/publicnoticestream.php
lib/replynoticestream.php

index b9b03c45c5b6354b262a8a6ba02967c95dcea7a8..21b942c018fc3ab74d7a2a61f93a9ac885459f8c 100644 (file)
@@ -95,6 +95,12 @@ class RawConversationNoticeStream extends NoticeStream
             $notice->limit($offset, $limit);
         }
 
+        if (!$this->allVerbs) {
+            $notice->whereAdd(sprintf('verb="%s" OR verb="%s"',
+                                      ActivityVerb::POST,
+                                      ActivityUtils::resolveUri(ActivityVerb::POST, true)));
+        }
+
         // ORDER BY
         // currently imitates the previously used "_reverseChron" sorting
         $notice->orderBy('notice.created DESC');
index e9ff47b68c154eb73641cbaf97dbb1b0126c2cae..c072941a693e78b7435d09f01a295f6de7f12271 100644 (file)
@@ -46,6 +46,8 @@ if (!defined('STATUSNET')) {
  */
 abstract class NoticeStream
 {
+    protected $allVerbs = false;    // Will only get 'post' activityverbs by default.
+
     abstract function getNoticeIds($offset, $limit, $since_id, $max_id);
 
     function getNotices($offset, $limit, $sinceId = null, $maxId = null)
index ac18e1c8cdd2505f2db3b51d16380c6c15ac3dc0..a59a5d848b8ce06429e2a173e1b48a66260ea919 100644 (file)
@@ -136,6 +136,12 @@ class RawProfileNoticeStream extends NoticeStream
         Notice::addWhereSinceId($notice, $since_id);
         Notice::addWhereMaxId($notice, $max_id);
 
+        if (!$this->allVerbs) {
+            $notice->whereAdd(sprintf('verb="%s" OR verb="%s"',
+                                      ActivityVerb::POST,
+                                      ActivityUtils::resolveUri(ActivityVerb::POST, true)));
+        }
+
         $notice->orderBy('created DESC, id DESC');
 
         if (!is_null($offset)) {
index 044701aaf68bb2b7e983a2ec4e8837910b6bd446..222eead0efb1c940db610388f5392c0684763d45 100644 (file)
@@ -92,6 +92,12 @@ class RawPublicNoticeStream extends NoticeStream
         Notice::addWhereSinceId($notice, $since_id);
         Notice::addWhereMaxId($notice, $max_id);
 
+        if (!$this->allVerbs) {
+            $notice->whereAdd(sprintf('verb="%s" OR verb="%s"',
+                                      ActivityVerb::POST,
+                                      ActivityUtils::resolveUri(ActivityVerb::POST, true)));
+        }
+
         $ids = array();
 
         if ($notice->find()) {
@@ -105,4 +111,4 @@ class RawPublicNoticeStream extends NoticeStream
 
         return $ids;
     }
-}
\ No newline at end of file
+}
index ec13ff9a67f6906bd80d6e7149f10832906031da..b5f0621a9eb43a63dd04fdf90980bc30186d927d 100644 (file)
@@ -86,6 +86,12 @@ class RawReplyNoticeStream extends NoticeStream
         Notice::addWhereSinceId($reply, $since_id, 'notice_id', 'modified');
         Notice::addWhereMaxId($reply, $max_id, 'notice_id', 'modified');
 
+        if (!$this->allVerbs) {
+            $notice->whereAdd(sprintf('verb="%s" OR verb="%s"',
+                                      ActivityVerb::POST,
+                                      ActivityUtils::resolveUri(ActivityVerb::POST, true)));
+        }
+
         $reply->orderBy('modified DESC, notice_id DESC');
 
         if (!is_null($offset)) {
@@ -102,4 +108,4 @@ class RawReplyNoticeStream extends NoticeStream
 
         return $ids;
     }
-}
\ No newline at end of file
+}