From 2de195d20cf00e1836c64f94593fd5b08d1b7a06 Mon Sep 17 00:00:00 2001 From: Alexei Sorokin Date: Sun, 9 Aug 2020 21:00:14 +0300 Subject: [PATCH] [NOTICES] Restore FullNoticeStream But only allow a select number of verbs. This is to display optional subscription notices. --- lib/notices/fullnoticestream.php | 45 +++++++++++++++++++++++ lib/notices/inboxnoticestream.php | 2 +- lib/notices/networkpublicnoticestream.php | 2 +- lib/notices/profilenoticestream.php | 2 +- lib/notices/publicnoticestream.php | 2 +- 5 files changed, 49 insertions(+), 4 deletions(-) create mode 100644 lib/notices/fullnoticestream.php diff --git a/lib/notices/fullnoticestream.php b/lib/notices/fullnoticestream.php new file mode 100644 index 0000000000..3b7b3de1f5 --- /dev/null +++ b/lib/notices/fullnoticestream.php @@ -0,0 +1,45 @@ +. + +/** + * Description of this file. + * + * @category Stream + * @package GNUsocial + * @author Mikael Nordfeldth + * @copyright 2016 Free Software Foundation, Inc http://www.fsf.org + * @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later + */ + +defined('GNUSOCIAL') || die(); + +/** + * Class for notice streams that filter as little as possible. + * + * @copyright 2016 Free Software Foundation, Inc http://www.fsf.org + * @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later + */ +abstract class FullNoticeStream extends NoticeStream +{ + protected $selectVerbs = [ + ActivityVerb::POST => true, + ActivityVerb::SHARE => true, + ActivityVerb::FOLLOW => true, + ActivityVerb::UNFOLLOW => true, + ActivityVerb::JOIN => true, + ActivityVerb::LEAVE => true, + ]; +} diff --git a/lib/notices/inboxnoticestream.php b/lib/notices/inboxnoticestream.php index bc0cb62eec..1c8a7d1556 100644 --- a/lib/notices/inboxnoticestream.php +++ b/lib/notices/inboxnoticestream.php @@ -66,7 +66,7 @@ class InboxNoticeStream extends ScopingNoticeStream * @copyright 2014 Free Software Foundation, Inc http://www.fsf.org * @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later */ -class RawInboxNoticeStream extends NoticeStream +class RawInboxNoticeStream extends FullNoticeStream { protected $target = null; protected $inbox = null; diff --git a/lib/notices/networkpublicnoticestream.php b/lib/notices/networkpublicnoticestream.php index bf0c53727c..c69a23a1ff 100644 --- a/lib/notices/networkpublicnoticestream.php +++ b/lib/notices/networkpublicnoticestream.php @@ -46,7 +46,7 @@ class NetworkPublicNoticeStream extends ModeratedNoticeStream * @copyright 2011 StatusNet, Inc. * @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later */ -class RawNetworkPublicNoticeStream extends NoticeStream +class RawNetworkPublicNoticeStream extends FullNoticeStream { public function getNoticeIds($offset, $limit, $since_id, $max_id) { diff --git a/lib/notices/profilenoticestream.php b/lib/notices/profilenoticestream.php index d1e6a7c8dd..3af892a695 100644 --- a/lib/notices/profilenoticestream.php +++ b/lib/notices/profilenoticestream.php @@ -104,7 +104,7 @@ class ProfileNoticeStream extends ScopingNoticeStream * @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later */ -class RawProfileNoticeStream extends NoticeStream +class RawProfileNoticeStream extends FullNoticeStream { protected $target; diff --git a/lib/notices/publicnoticestream.php b/lib/notices/publicnoticestream.php index 0a239a7c39..4ab0ebda64 100644 --- a/lib/notices/publicnoticestream.php +++ b/lib/notices/publicnoticestream.php @@ -60,7 +60,7 @@ class PublicNoticeStream extends ModeratedNoticeStream * @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later */ -class RawPublicNoticeStream extends NoticeStream +class RawPublicNoticeStream extends FullNoticeStream { public function getNoticeIds($offset, $limit, $since_id, $max_id) {