NoticeStream fixes regarding non-post verbs
This commit is contained in:
parent
6de410bb6b
commit
5ebe01ba36
|
@ -95,10 +95,8 @@ class RawConversationNoticeStream extends NoticeStream
|
||||||
$notice->limit($offset, $limit);
|
$notice->limit($offset, $limit);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$this->allVerbs) {
|
if (!empty($this->selectVerbs)) {
|
||||||
$notice->whereAdd(sprintf('verb="%s" OR verb="%s"',
|
$notice->whereAddIn('verb', $this->selectVerbs, $notice->columnType('verb'));
|
||||||
ActivityVerb::POST,
|
|
||||||
ActivityUtils::resolveUri(ActivityVerb::POST, true)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ORDER BY
|
// ORDER BY
|
||||||
|
|
|
@ -118,6 +118,9 @@ class RawInboxNoticeStream extends NoticeStream
|
||||||
if (!empty($max_id)) {
|
if (!empty($max_id)) {
|
||||||
$notice->whereAdd(sprintf('notice.id <= %d', $max_id));
|
$notice->whereAdd(sprintf('notice.id <= %d', $max_id));
|
||||||
}
|
}
|
||||||
|
if (!empty($this->selectVerbs)) {
|
||||||
|
$notice->whereAddIn('verb', $this->selectVerbs, $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
|
||||||
|
|
|
@ -46,7 +46,13 @@ if (!defined('STATUSNET')) {
|
||||||
*/
|
*/
|
||||||
abstract class NoticeStream
|
abstract class NoticeStream
|
||||||
{
|
{
|
||||||
protected $allVerbs = false; // Will only get 'post' activityverbs by default.
|
// Will only get notices with the 'post' activityverb by default.
|
||||||
|
protected $selectVerbs = array();
|
||||||
|
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$this->selectVerbs = array(ActivityVerb::POST, ActivityUtils::resolveUri(ActivityVerb::POST, true));
|
||||||
|
}
|
||||||
|
|
||||||
abstract function getNoticeIds($offset, $limit, $since_id, $max_id);
|
abstract function getNoticeIds($offset, $limit, $since_id, $max_id);
|
||||||
|
|
||||||
|
|
|
@ -121,6 +121,7 @@ class RawProfileNoticeStream extends NoticeStream
|
||||||
|
|
||||||
function __construct($profile)
|
function __construct($profile)
|
||||||
{
|
{
|
||||||
|
parent::__construct();
|
||||||
$this->profile = $profile;
|
$this->profile = $profile;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -136,12 +137,6 @@ class RawProfileNoticeStream extends NoticeStream
|
||||||
Notice::addWhereSinceId($notice, $since_id);
|
Notice::addWhereSinceId($notice, $since_id);
|
||||||
Notice::addWhereMaxId($notice, $max_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');
|
$notice->orderBy('created DESC, id DESC');
|
||||||
|
|
||||||
if (!is_null($offset)) {
|
if (!is_null($offset)) {
|
||||||
|
|
|
@ -92,10 +92,8 @@ class RawPublicNoticeStream extends NoticeStream
|
||||||
Notice::addWhereSinceId($notice, $since_id);
|
Notice::addWhereSinceId($notice, $since_id);
|
||||||
Notice::addWhereMaxId($notice, $max_id);
|
Notice::addWhereMaxId($notice, $max_id);
|
||||||
|
|
||||||
if (!$this->allVerbs) {
|
if (!empty($this->selectVerbs)) {
|
||||||
$notice->whereAdd(sprintf('verb="%s" OR verb="%s"',
|
$notice->whereAddIn('verb', $this->selectVerbs, $notice->columnType('verb'));
|
||||||
ActivityVerb::POST,
|
|
||||||
ActivityUtils::resolveUri(ActivityVerb::POST, true)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$ids = array();
|
$ids = array();
|
||||||
|
|
|
@ -79,8 +79,12 @@ class RawFaveNoticeStream extends NoticeStream
|
||||||
|
|
||||||
function __construct($user_id, $own)
|
function __construct($user_id, $own)
|
||||||
{
|
{
|
||||||
|
parent::__construct();
|
||||||
|
|
||||||
$this->user_id = $user_id;
|
$this->user_id = $user_id;
|
||||||
$this->own = $own;
|
$this->own = $own;
|
||||||
|
|
||||||
|
$this->selectVerbs = array();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue
Block a user