From bb49a51be3b7fedb28b0b0ff6e52bbc02880f510 Mon Sep 17 00:00:00 2001 From: Mario Date: Tue, 9 Dec 2025 12:05:19 +0000 Subject: [PATCH] feed: fix channel links and check for top=0. also filter out Add and Remove activities when building the feed (we should probably do this in fetch_items() but that will require some refactoring --- Zotlabs/Module/Channel.php | 4 ++-- Zotlabs/Module/Feed.php | 2 +- include/feedutils.php | 4 ++++ 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/Zotlabs/Module/Channel.php b/Zotlabs/Module/Channel.php index 0a3a4aae6..2c7fa90d0 100644 --- a/Zotlabs/Module/Channel.php +++ b/Zotlabs/Module/Channel.php @@ -148,14 +148,14 @@ class Channel extends Controller { 'rel' => 'alternate', 'type' => 'application/atom+xml', 'title' => t('Posts and comments'), - 'href' => z_root() . '/feed/' . $which + 'href' => z_root() . '/feed/' . $which . '?top=0' ]); head_add_link([ 'rel' => 'alternate', 'type' => 'application/atom+xml', 'title' => t('Only posts'), - 'href' => z_root() . '/feed/' . $which . '?f=&top=1' + 'href' => z_root() . '/feed/' . $which . '?top=1' ]); diff --git a/Zotlabs/Module/Feed.php b/Zotlabs/Module/Feed.php index cc0f3a2de..65ab313df 100644 --- a/Zotlabs/Module/Feed.php +++ b/Zotlabs/Module/Feed.php @@ -25,7 +25,7 @@ class Feed extends Controller { $params['end'] = $_REQUEST['date_end'] ?? ''; $params['type'] = 'xml'; $params['pages'] = ((!empty($_REQUEST['pages'])) ? intval($_REQUEST['pages']) : 0); - $params['top'] = ((!empty($_REQUEST['top'])) ? intval($_REQUEST['top']) : PConfig::Get($channel['channel_id'], 'system', 'channel_simple_feed', 1)); + $params['top'] = ((array_key_exists('top', $_REQUEST)) ? intval($_REQUEST['top']) : PConfig::Get($channel['channel_id'], 'system', 'channel_simple_feed', 1)); $params['start'] = ((!empty($_REQUEST['start'])) ? intval($_REQUEST['start']) : 0); $params['records'] = ((!empty($_REQUEST['records'])) ? intval($_REQUEST['records']) : 10); $params['cat'] = ((!empty($_REQUEST['cat'])) ? escape_tags($_REQUEST['cat']) : ''); diff --git a/include/feedutils.php b/include/feedutils.php index 1487ea2d6..f3836f036 100644 --- a/include/feedutils.php +++ b/include/feedutils.php @@ -160,6 +160,10 @@ function get_feed_for($channel, $observer_hash, $params) { if($item['item_private']) continue; + if (in_array($item['verb'], ['Add', 'Remove'])) { + continue; + } + $atom .= atom_entry($item, $type, null, $channel, true, '', $params['compat']); } }