Merge branch 'align_with_newer_gnusocial' into 'master'

Align with newer gnusocial

In case someone updates GNU social then the NoticeStream "selectVerbs" class variables have changed behaviour.

This request makes Qvitter work with both the old and new.

A consequence of this is that I call parent::__construct() in actions/apitimelinefriendshiddenreplies.php for RawInboxNoticeStreamHiddenReplies, which is why I have to set the class variable $selectVerbs = array(); (because it would otherwise only select POST verbs as a result of parent::__construct(), this retains the old behaviour and everything is exactly as it should be).

See merge request !21
This commit is contained in:
hannes 2016-02-16 10:50:46 +00:00
commit 0bc9d2cd26

View File

@ -390,6 +390,8 @@ class RawInboxNoticeStreamHiddenReplies extends NoticeStream
protected $target = null;
protected $inbox = null;
protected $selectVerbs = array();
/**
* Constructor
*
@ -397,6 +399,7 @@ class RawInboxNoticeStreamHiddenReplies extends NoticeStream
*/
function __construct(Profile $target)
{
parent::__construct();
$this->target = $target;
}
@ -453,9 +456,17 @@ class RawInboxNoticeStreamHiddenReplies extends NoticeStream
if (!empty($max_id)) {
$notice->whereAdd(sprintf('notice.id <= %d', $max_id));
}
if (!empty($this->selectVerbs)) {
// We have changed how selectVerbs work in GNUsocial, so it's an associative array
// where each verb is in the key and then the value (true/false) is how to filter.
// $this->unselectVerbs is always unset in newer GNUsocials.
if (!isset($this->unselectVerbs)) {
self::filterVerbs($notice, $this->selectVerbs);
} elseif (!empty($this->selectVerbs)) {
// old behaviour was just if there were selectVerbs set
$notice->whereAddIn('verb', $this->selectVerbs, $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