Default to not include delete verbs in notice streams

This commit is contained in:
Mikael Nordfeldth 2016-01-07 23:33:47 +01:00
parent c48871cf1b
commit e6f2676c5c
2 changed files with 6 additions and 1 deletions

View File

@ -85,6 +85,7 @@ class RawInboxNoticeStream extends NoticeStream
function __construct(Profile $target) function __construct(Profile $target)
{ {
$this->target = $target; $this->target = $target;
$this->unselectVerbs = array(ActivityVerb::DELETE);
} }
/** /**
@ -121,6 +122,9 @@ class RawInboxNoticeStream extends NoticeStream
if (!empty($this->selectVerbs)) { if (!empty($this->selectVerbs)) {
$notice->whereAddIn('verb', $this->selectVerbs, $notice->columnType('verb')); $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->limit($offset, $limit);
// notice.id will give us even really old posts, which were // notice.id will give us even really old posts, which were
// recently imported. For example if a remote instance had // recently imported. For example if a remote instance had

View File

@ -46,12 +46,13 @@ if (!defined('STATUSNET')) {
*/ */
abstract class NoticeStream abstract class NoticeStream
{ {
// Will only get notices with the 'post' activityverb by default.
protected $selectVerbs = array(); protected $selectVerbs = array();
protected $unselectVerbs = array();
public function __construct() public function __construct()
{ {
$this->selectVerbs = array(ActivityVerb::POST, ActivityUtils::resolveUri(ActivityVerb::POST, true)); $this->selectVerbs = array(ActivityVerb::POST, ActivityUtils::resolveUri(ActivityVerb::POST, true));
$this->unselectVerbs = array(ActivityVerb::DELETE);
} }
abstract function getNoticeIds($offset, $limit, $since_id, $max_id); abstract function getNoticeIds($offset, $limit, $since_id, $max_id);