Skip to content
Snippets Groups Projects
Commit cdcc8919 authored by echicken's avatar echicken :chicken:
Browse files

It's okay for guests to see some events.

parent 39c0b830
No related branches found
No related tags found
1 merge request!463MRC mods by Codefenix (2024-10-20)
...@@ -4,6 +4,7 @@ var last_subs; ...@@ -4,6 +4,7 @@ var last_subs;
var last_groups; var last_groups;
var last_threads; var last_threads;
var last_run = 0; var last_run = 0;
const is_real_user = is_user();
const frequency = (settings.refresh_interval || 60000) / 1000; const frequency = (settings.refresh_interval || 60000) / 1000;
// Where 'a' is the previous data and 'b' is new // Where 'a' is the previous data and 'b' is new
...@@ -46,7 +47,7 @@ function scan_subs(group) { ...@@ -46,7 +47,7 @@ function scan_subs(group) {
} }
function scan_threads(sub, offset, page_size) { function scan_threads(sub, offset, page_size) {
const scan = getThreadStats(sub, offset, page_size); const scan = getThreadStats(sub, offset, page_size, !is_real_user);
if (!last_threads) { if (!last_threads) {
forum_emit('threads', scan); forum_emit('threads', scan);
} else { } else {
...@@ -66,11 +67,10 @@ function scan_threads(sub, offset, page_size) { ...@@ -66,11 +67,10 @@ function scan_threads(sub, offset, page_size) {
} }
function cycle() { function cycle() {
if (!is_user()) return;
if (time() - last_run <= frequency) return; if (time() - last_run <= frequency) return;
last_run = time(); last_run = time();
if (Request.has_param('groups_unread')) scan_groups(); if (is_real_user && Request.has_param('groups_unread')) scan_groups();
if (Request.has_param('subs_unread')) scan_subs(Request.get_param('subs_unread')); if (is_real_user && Request.has_param('subs_unread')) scan_subs(Request.get_param('subs_unread'));
if (Request.has_param('threads')) scan_threads(Request.get_param('threads'), Request.get_param('offset'), Request.get_param('page_size')); if (Request.has_param('threads')) scan_threads(Request.get_param('threads'), Request.get_param('offset'), Request.get_param('page_size'));
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment