Files
wekan/server/notifications/activityIntents.js
T
Lauri Ojansivu 34c6c31a48 Resume pending activity notifications with shared reservations
Scan bounded pending-intent batches after startup, advance past failed and busy rows, and coordinate immediate delivery and recovery through renewable per-intent reservations. Resume saved plans or prepare the first plan from an unchanged persisted activity; retain unresolved orphans without recreating activities.

Validated with 14 Node/MongoDB cases, three additional Node suites, four full-app Meteor cases and twelve Chromium scenarios including scheduled local SMTP recovery. Operator controls and payload retention remain open.

Thanks to xet7.
2026-09-28 14:31:47 +03:00

22 lines
1.2 KiB
JavaScript

import { Meteor } from 'meteor/meteor';
import { Mongo } from 'meteor/mongo';
import Activities from '/models/activities';
import { ensureIndex } from '/server/lib/mongoStartup';
const { ensureActivityNotificationIntent, completeActivityNotificationIntent } = require('/server/lib/activityNotificationIntent');
export const ActivityNotificationIntents = new Mongo.Collection('activityNotificationIntents');
ActivityNotificationIntents.deny({ insert: () => true, update: () => true, remove: () => true });
Meteor.startup(async () => {
await ensureIndex(ActivityNotificationIntents, { state: 1, _id: 1 });
});
const options = (activity, dispatchUserId) => ({ activity, dispatchUserId,
intents: ActivityNotificationIntents.rawCollection(), activities: Activities.rawCollection(),
assertCurrent: async () => {},
});
export function captureActivityNotificationIntent(activity, dispatchUserId) {
return ensureActivityNotificationIntent(options(activity, dispatchUserId ?? null));
}
export function acknowledgeActivityNotifications(activity, dispatchUserId, assertCurrent = async () => {}) {
return completeActivityNotificationIntent({ ...options(activity, dispatchUserId ?? null), assertCurrent });
}