feat(atom): Hide topics from private forums (#1889)

This commit is contained in:
Roman Kelesidis 2025-05-03 16:24:48 +03:00 committed by GitHub
commit 75e9d5e4a8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -25,10 +25,17 @@ class Atom
*/ */
public static function update_forum_feed($forum_id, $forum_data) public static function update_forum_feed($forum_id, $forum_data)
{ {
global $bb_cfg, $lang; global $bb_cfg, $lang, $datastore;
$sql = null; $sql = null;
$file_path = $bb_cfg['atom']['path'] . '/f/' . $forum_id . '.atom'; $file_path = $bb_cfg['atom']['path'] . '/f/' . $forum_id . '.atom';
$select_tor_sql = $join_tor_sql = ''; $select_tor_sql = $join_tor_sql = '';
if (!$forums = $datastore->get('cat_forums')) {
$datastore->update('cat_forums');
$forums = $datastore->get('cat_forums');
}
$not_forums_id = $forums['not_auth_forums']['guest_view'];
if ($forum_id == 0) { if ($forum_id == 0) {
$forum_data['forum_name'] = $lang['ATOM_GLOBAL_FEED'] ?? $bb_cfg['server_name']; $forum_data['forum_name'] = $lang['ATOM_GLOBAL_FEED'] ?? $bb_cfg['server_name'];
} }
@ -77,6 +84,9 @@ class Atom
$topics_tmp = DB()->fetch_rowset($sql); $topics_tmp = DB()->fetch_rowset($sql);
$topics = []; $topics = [];
foreach ($topics_tmp as $topic) { foreach ($topics_tmp as $topic) {
if (in_array($topic['topic_id'], explode(',', $not_forums_id))) {
continue;
}
if (isset($topic['topic_status'])) { if (isset($topic['topic_status'])) {
if ($topic['topic_status'] == TOPIC_MOVED) { if ($topic['topic_status'] == TOPIC_MOVED) {
continue; continue;