meteor3: Comments methods and mail fan-out to async

comments.insert/edit/remove/like/dislike use *Async collection APIs;
requireOwner/toggle helpers are async; onCommentAdd iterates users with
forEachAsync. subscriptions.* methods were already async. REST smoke stays
byte-identical (12/12).
This commit is contained in:
vjrj 2026-07-14 06:52:32 +02:00
parent feaf66fe34
commit 66bab7a43b
3 changed files with 25 additions and 20 deletions

View file

@ -14,10 +14,10 @@ export default function onCommentAdd(payload) {
const { referenceId, userId } = payload;
const query = { referenceId, userId: { $ne: userId } };
Comments.rawCollection().distinct('userId', query).then((users) => {
Comments.rawCollection().distinct('userId', query).then(async (users) => {
const path = referenceId.replace(/fire-/, 'fire/archive/');
const fireUrl = Meteor.absoluteUrl(path);
Meteor.users.find({ _id: { $in: users } }).forEach((user) => {
await Meteor.users.find({ _id: { $in: users } }).forEachAsync((user) => {
const { firstName, emailAddress } = getEmailOf(user);
if (emailAddress) {
const emailOpts = {