bda63b6f0a
Resolved conflicts in routes.js and share.html: kept the dev tree's superset (ALLOW_LOCAL_LOGIN dev escape, avatar sync, richer login errors) which already includes the incoming production BizGaze-only behavior; took the more descriptive incoming comments. Restored 5 untracked modules (chat, calls, directory, reminders, webhooks) that were missing from disk — required by routes/signaling. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
26 lines
1.2 KiB
JavaScript
26 lines
1.2 KiB
JavaScript
// Fires a one-shot "starts in ~10 minutes" reminder to a scheduled meeting's host,
|
|
// group members, and invited participants. Runs on a 60s tick; marks each meeting reminded.
|
|
const R = require('./repos');
|
|
const CHAT = require('./chat');
|
|
|
|
function tick() {
|
|
try {
|
|
const now = Date.now();
|
|
const due = R.scheduledMeetings.dueForReminder(now, now + 10 * 60 * 1000); // starting within 10 min
|
|
for (const s of due) {
|
|
const recipients = new Set([s.created_by]);
|
|
let invited = []; try { invited = JSON.parse(s.participants || '[]'); } catch (_) {}
|
|
invited.forEach((id) => recipients.add(id));
|
|
if (s.group_id) { try { R.conversations.members(s.group_id).forEach((m) => recipients.add(m)); } catch (_) {} }
|
|
const evt = { type: 'meeting-reminder', meeting: { id: s.id, title: s.title, scheduledAt: s.scheduled_at, room: s.room_code } };
|
|
recipients.forEach((uid) => { try { CHAT.pushToUser(uid, evt); } catch (_) {} });
|
|
R.scheduledMeetings.markReminded(s.id);
|
|
}
|
|
} catch (_) { /* never let the timer die */ }
|
|
}
|
|
|
|
let timer = null;
|
|
function start() { if (!timer) timer = setInterval(tick, 60 * 1000); }
|
|
start();
|
|
module.exports = { start, tick };
|