escala 2+3: Meteor 1.8.3 -> 2.3 (Mongo 3.2 compatible), dead-package remediation
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.
This commit is contained in:
parent
ccfc80547a
commit
cd570b9d9c
24 changed files with 1638 additions and 312 deletions
|
|
@ -1,42 +0,0 @@
|
|||
/* global Comments */
|
||||
/* eslint-disable import/no-absolute-path */
|
||||
|
||||
import i18n from '/imports/startup/client/i18n';
|
||||
import '/imports/startup/common/comments';
|
||||
|
||||
import './comments.scss';
|
||||
|
||||
i18n.init((err, t) => {
|
||||
Comments.ui.setContent({
|
||||
title: ' ', // i18n.t('Comentarios'),
|
||||
save: t('Guardar'),
|
||||
reply: t('Responder'),
|
||||
edit: t('Editar'),
|
||||
remove: t('Borrar'),
|
||||
'placeholder-textarea': t('Añadir un comentario'),
|
||||
'add-button-reply': t('Añadir una respuesta'),
|
||||
'add-button': t('Añadir comentario'),
|
||||
'you-need-to-login': t('Necesitas iniciar sesión para'),
|
||||
'add comments': t('añadir comentarios'),
|
||||
'like comments': t('puntuar comentarios'),
|
||||
'rate comments': t('puntuar comentarios'),
|
||||
'add replies': t('responder'),
|
||||
'load-more': t('Más comentarios')
|
||||
});
|
||||
|
||||
/* This in client side */
|
||||
Comments.ui.config({
|
||||
limit: 20, // default 10
|
||||
loadMoreCount: 20, // default 20
|
||||
/* generateAvatar: function genAvatar(user, isAnonymous) {
|
||||
if (isAnonymous) {
|
||||
return i18n.t('Anónimo');
|
||||
}
|
||||
return user.profile && user.profile.name && user.profile.name.first ? user.profile.name.first : null;
|
||||
}, */
|
||||
template: 'bootstrap', // default 'semantic-ui'
|
||||
// default 'http://s3.amazonaws.com/37assets/svn/765-default-avatar.png'
|
||||
defaultAvatar: '/default-avatar.png',
|
||||
markdown: true
|
||||
});
|
||||
});
|
||||
|
|
@ -1,29 +0,0 @@
|
|||
.comments-section {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.comments-box {
|
||||
max-width: inherit;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
p.comment-content {
|
||||
/* white-space: pre-line; */
|
||||
}
|
||||
|
||||
/* remove comment btn danger style */
|
||||
|
||||
div.media-body.comment> div> div> div.btn.btn-danger.remove-action {
|
||||
background-color: white;
|
||||
border: 1px solid rgb(204, 204, 204);
|
||||
color: rgb(51, 51, 51);
|
||||
}
|
||||
|
||||
/* text-area height */
|
||||
.form-control .create-comment {
|
||||
height: 9em;
|
||||
}
|
||||
|
||||
.img-avatar {
|
||||
margin-right: 5px;
|
||||
}
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
/* global Comments */
|
||||
|
||||
// Client and Server
|
||||
Comments.config({
|
||||
rating: 'likes-and-dislikes',
|
||||
allowAnonymous: () => false,
|
||||
allowReplies: () => false, // disabled right now: I don't know hot to get referenceId of replies
|
||||
anonymousSalt: 'klasddl3lala0l3lasdlas0ol3lasdlao3lasdoaslaldal3lasdclasdlal3lasdladlaq',
|
||||
publishUserFields: {
|
||||
profile: 1
|
||||
},
|
||||
mediaAnalyzers: [
|
||||
Comments.analyzers.image,
|
||||
Comments.analyzers.youtube
|
||||
],
|
||||
generateUsername: function genUser(user) {
|
||||
// console.log(JSON.stringify(user));
|
||||
// FIXME
|
||||
return user.profile && user.profile.name && user.profile.name.first ? user.profile.name.first : '';
|
||||
}
|
||||
});
|
||||
|
|
@ -1,80 +0,0 @@
|
|||
/* global Comments */
|
||||
/* 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 '../common/comments';
|
||||
|
||||
/* import i18n from 'i18next';
|
||||
import moment from 'moment';
|
||||
import { dateLongFormat } from '/imports/api/Common/dates';
|
||||
import Notifications from '/imports/api/Notifications/Notifications';
|
||||
// import sendMail from '/imports/startup/server/email';
|
||||
// import { hr } from '/imports/startup/server/email';
|
||||
import getOAuthProfile from '/imports/modules/get-oauth-profile';
|
||||
import image from 'google-maps-image-api-url';
|
||||
import { trim } from '/imports/ui/components/NotificationsObserver/util.js'; */
|
||||
|
||||
Meteor.startup(() => {
|
||||
// On Server or Client (preferably on Server)
|
||||
Comments.config({
|
||||
onEvent: (name, action, payload) => {
|
||||
// e.g send a mail
|
||||
// console.log(`name: ${name}, action: ${action}, payload: ${JSON.stringify(payload)}`);
|
||||
|
||||
// Samples:
|
||||
|
||||
// name: comment, action: add, payload: {"referenceId":"fire-56a9cc5a5586879eb9cc6dd7","content":"asdfasdf asd fasd fas","userId":"tdK4e43ikjDXct7Gj","isAnonymous":false,"createdAt":"2018-03-04T14:53:40.319Z","likes":[],"dislikes":[],"replies":[],"media":{},"status":"approved","starRatings":[],"ratingScore":0,"_id":"mfAe3HL9qNofhiAnh"}
|
||||
// name: reply, action: add, payload: {"replyId":"teSLaz4f8RxHjptBm","content":"sas fasdfasdasdf","userId":"tdK4e43ikjDXct7Gj","createdAt":"2018-03-04T14:54:56.965Z","replies":[],"likes":[],"lastUpdatedAt":"2018-03-04T14:54:56.965Z","isAnonymous":false,"status":"approved","media":{},"ratingScore":0,"_id":"DyHt28rF6rTDnC5fP","rootUserId":"tdK4e43ikjDXct7Gj"}
|
||||
// name: reply, action: like, payload: {"replyId":"teSLaz4f8RxHjptBm","content":"sas fasdfasdasdf","userId":"tdK4e43ikjDXct7Gj","createdAt":"2018-03-04T14:54:56.965Z","replies":[],"likes":["tdK4e43ikjDXct7Gj"],"lastUpdatedAt":"2018-03-04T14:54:56.965Z","isAnonymous":false,"status":"approved","media":{},"ratingScore":1,"_id":"DyHt28rF6rTDnC5fP","ratedUserId":"tdK4e43ikjDXct7Gj","rootUserId":"tdK4e43ikjDXct7Gj"}
|
||||
// name: comment, action: like, payload: {"_id":"mfAe3HL9qNofhiAnh","ratedUserId":"tdK4e43ikjDXct7Gj"}
|
||||
// name: reply, action: edit, payload: {"_id":"DyHt28rF6rTDnC5fP","replyId":"teSLaz4f8RxHjptBm","content":"sas fasdfasdasdf dasd fadsfa","userId":"tdK4e43ikjDXct7Gj","createdAt":"2018-03-04T14:54:56.965Z","replies":[],"likes":[],"lastUpdatedAt":"2018-03-04T14:54:56.965Z","isAnonymous":false,"status":"approved","media":{},"ratingScore":0,"starRatings":[],"ratedUserId":"tdK4e43ikjDXct7Gj","rootUserId":"tdK4e43ikjDXct7Gj"}
|
||||
// name: reply, action: remove, payload: {"_id":"DyHt28rF6rTDnC5fP","rootUserId":"tdK4e43ikjDXct7Gj"}
|
||||
|
||||
// name: (comment|reply)
|
||||
// action: (add|like|edit|remove)
|
||||
|
||||
if (name === 'comment' && action.match(/add|like|edit/)) {
|
||||
if (action === 'add') {
|
||||
// Check for other users that did comments and send an email (uniq users, and not this user)
|
||||
// console.log(payload.referenceId);
|
||||
const query = payload.isAnonymous ?
|
||||
{ referenceId: payload.referenceId } :
|
||||
{ referenceId: payload.referenceId, userId: { $ne: payload.userId } };
|
||||
Comments.getCollection().rawCollection().distinct('userId', query).then((users) => {
|
||||
// console.log(users);
|
||||
const path = payload.referenceId.replace(/fire-/, 'fire/archive/');
|
||||
const fireUrl = Meteor.absoluteUrl(path);
|
||||
// console.log(fireUrl);
|
||||
Meteor.users.find({ _id: { $in: users } }).forEach((user) => {
|
||||
const { firstName, emailAddress } = getEmailOf(user);
|
||||
// console.log(JSON.stringify(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) => {
|
||||
throw new Meteor.Error('500', `${error}`);
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
if (name === 'reply' && action.match(/add|like|edit/)) {
|
||||
// Check for other previous users to this thread and send an email
|
||||
// console.log('Reply op');
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
@ -6,10 +6,10 @@ import './accounts';
|
|||
import './api';
|
||||
import './fixtures';
|
||||
import './email';
|
||||
import '/imports/api/Comments/server';
|
||||
import './IPGeocoder';
|
||||
import './migrations';
|
||||
import './facts';
|
||||
import './comments';
|
||||
import './sitemaps';
|
||||
import './subsUnion';
|
||||
import './prerender';
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
/* global Migrations, Comments */
|
||||
/* global Migrations */
|
||||
/* eslint-disable import/no-absolute-path */
|
||||
import { Meteor } from 'meteor/meteor';
|
||||
import Comments from '/imports/api/Comments/Comments';
|
||||
import { Accounts } from 'meteor/accounts-base';
|
||||
import randomHex from 'crypto-random-hex';
|
||||
import UserSubsToFiresCollection from '/imports/api/Subscriptions/Subscriptions';
|
||||
|
|
@ -163,7 +164,7 @@ Meteor.startup(() => {
|
|||
Migrations.add({
|
||||
version: 11,
|
||||
up: function noAnonComments() {
|
||||
Comments.getCollection().remove({ isAnonymous: true });
|
||||
Comments.remove({ isAnonymous: true });
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
/* global sitemaps Comments */
|
||||
/* global sitemaps */
|
||||
/* eslint-disable import/no-absolute-path */
|
||||
|
||||
import Fires from '/imports/api/Fires/Fires';
|
||||
// import Comments from '/imports/api/Comments/Comments';
|
||||
import Comments from '/imports/api/Comments/Comments';
|
||||
|
||||
const firesMapEnabled = false;
|
||||
|
||||
|
|
@ -32,7 +32,7 @@ sitemaps.add('/sitemap.xml', () => {
|
|||
if (firesMapEnabled) {
|
||||
Fires.find({}, { limit: 100, sort: { createdAt: -1 } }).fetch().forEach((fire) => {
|
||||
// Search the last comment of tha fire
|
||||
const lastComment = Comments.getCollection().findOne({ referenceId: `fire-${fire._id}` }, { sort: { createdAt: -1 } });
|
||||
const lastComment = Comments.findOne({ referenceId: `fire-${fire._id}` }, { sort: { createdAt: -1 } });
|
||||
out.push({
|
||||
page: `/fire/archive/${fire._id._str}`,
|
||||
lastmod: lastComment ? lastComment.createdAt : fire.updatedAt
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue