From e6f2676c5c6f3eea36eea6cce68c65cd84b9945e Mon Sep 17 00:00:00 2001 From: Mikael Nordfeldth Date: Thu, 7 Jan 2016 23:33:47 +0100 Subject: [PATCH] Default to not include delete verbs in notice streams --- lib/inboxnoticestream.php | 4 ++++ lib/noticestream.php | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/inboxnoticestream.php b/lib/inboxnoticestream.php index b5a8877d99..496fe0d05d 100644 --- a/lib/inboxnoticestream.php +++ b/lib/inboxnoticestream.php @@ -85,6 +85,7 @@ class RawInboxNoticeStream extends NoticeStream function __construct(Profile $target) { $this->target = $target; + $this->unselectVerbs = array(ActivityVerb::DELETE); } /** @@ -121,6 +122,9 @@ class RawInboxNoticeStream extends NoticeStream if (!empty($this->selectVerbs)) { $notice->whereAddIn('verb', $this->selectVerbs, $notice->columnType('verb')); } + if (!empty($this->unselectVerbs)) { + $notice->whereAddIn('!verb', $this->unselectVerbs, $notice->columnType('verb')); + } $notice->limit($offset, $limit); // notice.id will give us even really old posts, which were // recently imported. For example if a remote instance had diff --git a/lib/noticestream.php b/lib/noticestream.php index 0f53daf83f..3b597fa08c 100644 --- a/lib/noticestream.php +++ b/lib/noticestream.php @@ -46,12 +46,13 @@ if (!defined('STATUSNET')) { */ abstract class NoticeStream { - // Will only get notices with the 'post' activityverb by default. protected $selectVerbs = array(); + protected $unselectVerbs = array(); public function __construct() { $this->selectVerbs = array(ActivityVerb::POST, ActivityUtils::resolveUri(ActivityVerb::POST, true)); + $this->unselectVerbs = array(ActivityVerb::DELETE); } abstract function getNoticeIds($offset, $limit, $since_id, $max_id);