Reaches Meteor 2.3 building + running against Mongo 3.2, REST smoke test
byte-identical to the 1.6.1.1 baseline (all 12 Flutter endpoints green).
Dead/abandoned Atmosphere packages removed or replaced (the upgrade blockers):
- arkham:comments-ui (no Meteor 2.x build; pinned accounts-password@1.x):
reimplemented the fire-page comments as a React feature:
imports/api/Comments/ (collection, server methods, publication, media
analyzers, new-fire-comment email) + imports/ui/components/Comments/CommentsBox.
Comment text now rendered as safe plain text + image/youtube embed (was
markdown-to-HTML). Wired into Fires.js; sitemaps.js + migration v11 updated
to the new collection. Old Blaze/startup comments files deleted.
- nimble:restivus (REST API; pinned accounts-password@1.3.3, CoffeeScript source
that crashes this build host): vendored as a local package
packages/nimble-restivus with the .coffee precompiled to plain JS and the
accounts-password constraint loosened to 2.x. REST behavior unchanged
(verified by smoke test). This also dropped the entire iron:router stack.
- maximum:server-transform (+ peerlibrary:*, meteorhacks:zones/inject-initial):
unused; removal broke Meteor.publishTransformed in FalsePositives publications
-> replaced with plain Meteor.publish (no transform was configured).
- less, markdown (no source files), and the dead test stack
(meteortesting:mocha, practicalmeteor:chai, xolvio:cleaner) which transitively
pulled coffeescript@1.0.17 — the build plugin that crashed meteor-tool
(node_contextify assertion) on this machine. Removing it unblocked the build.
- fourseven:scss 4.5.4 -> 4.14.1 (node-sass 4.5.3 doesn't build on node 12).
npm-mongo driver at 2.3 is 3.9.x — still compatible with the production Mongo
3.2 replica set.
42 lines
1.6 KiB
JavaScript
42 lines
1.6 KiB
JavaScript
/* eslint-disable import/no-absolute-path */
|
|
import { Meteor } from 'meteor/meteor';
|
|
import i18n from 'i18next';
|
|
import sendEmail, { subjectTruncate } from '/imports/modules/server/send-email';
|
|
import getEmailOf from '/imports/modules/get-email-of-user';
|
|
import Comments from '/imports/api/Comments/Comments';
|
|
|
|
/*
|
|
* When a comment is added to a fire, email the other users who commented on the
|
|
* same fire (uniq, excluding the author). Ported from the old
|
|
* startup/server/comments.js `onEvent` handler.
|
|
*/
|
|
export default function onCommentAdd(payload) {
|
|
const { referenceId, userId } = payload;
|
|
const query = { referenceId, userId: { $ne: userId } };
|
|
|
|
Comments.rawCollection().distinct('userId', query).then((users) => {
|
|
const path = referenceId.replace(/fire-/, 'fire/archive/');
|
|
const fireUrl = Meteor.absoluteUrl(path);
|
|
Meteor.users.find({ _id: { $in: users } }).forEach((user) => {
|
|
const { firstName, emailAddress } = getEmailOf(user);
|
|
if (emailAddress) {
|
|
const emailOpts = {
|
|
to: emailAddress,
|
|
subject: subjectTruncate.apply(i18n.t('Hay más información sobre un fuego')),
|
|
lang: user.lang,
|
|
template: 'new-fire-comment',
|
|
templateVars: {
|
|
applicationName: i18n.t('AppName'),
|
|
firstName,
|
|
fireUrl
|
|
}
|
|
};
|
|
sendEmail(emailOpts).catch((error) => {
|
|
console.warn(`comments new-fire-comment mail failed: ${error}`);
|
|
});
|
|
}
|
|
});
|
|
}).catch((error) => {
|
|
console.warn(`comments distinct() failed: ${error}`);
|
|
});
|
|
}
|