Fire comments email notifications
This commit is contained in:
parent
90f1e5ba9c
commit
a8a1c43f2c
24 changed files with 820 additions and 42 deletions
19
imports/modules/get-email-of-user.js
Normal file
19
imports/modules/get-email-of-user.js
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
/* eslint-disable import/no-absolute-path */
|
||||
|
||||
import getOAuthProfile from '/imports/modules/get-oauth-profile';
|
||||
|
||||
const getEmailOf = (user) => {
|
||||
const hasPassword = user.services && user.services.password && user.services.password.bcrypt;
|
||||
|
||||
// console.log(`Has password: ${hasPassword}`);
|
||||
const OAuthProfile = getOAuthProfile({
|
||||
password: hasPassword,
|
||||
profile: user.profile
|
||||
}, user);
|
||||
const firstName = OAuthProfile ? OAuthProfile.name.first : user.profile.name.first;
|
||||
const emailAddress = OAuthProfile ? OAuthProfile.email :
|
||||
user && user.emails[0] && user.emails[0].verified ? user.emails[0].address : null;
|
||||
return { emailAddress, firstName };
|
||||
};
|
||||
|
||||
export default getEmailOf;
|
||||
|
|
@ -1,11 +1,21 @@
|
|||
/* eslint-disable import/no-absolute-path */
|
||||
|
||||
import { Meteor } from 'meteor/meteor';
|
||||
// import { Email } from 'meteor/email';
|
||||
import i18n from 'i18next';
|
||||
import { getFileNameOfLang } from '/imports/api/Utility/server/files.js';
|
||||
import sendMail from '/imports/startup/server/email';
|
||||
import getPrivateFile from './get-private-file';
|
||||
import templateToText from './handlebars-email-to-text';
|
||||
import templateToHTML from './handlebars-email-to-html';
|
||||
import { getFileNameOfLang } from '/imports/api/Utility/server/files.js';
|
||||
import sendMail from '/imports/startup/server/email';
|
||||
import i18n from 'i18next';
|
||||
|
||||
export function subjectTruncate(n = 70, useWordBoundary = true) {
|
||||
// https://stackoverflow.com/questions/1199352/smart-way-to-shorten-long-strings-with-javascript
|
||||
if (this.length <= n) {
|
||||
return `${this}`;
|
||||
}
|
||||
const subString = this.substr(0, n - 1);
|
||||
return `${useWordBoundary ? subString.substr(0, subString.lastIndexOf(' ')) : subString}...`;
|
||||
}
|
||||
|
||||
const sendEmail = (options, { resolve, reject }) => {
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -3,7 +3,8 @@
|
|||
// Client and Server
|
||||
Comments.config({
|
||||
rating: 'likes-and-dislikes',
|
||||
allowAnonymous: () => true,
|
||||
allowAnonymous: () => false,
|
||||
allowReplies: () => false, // disabled right now: I don't know hot to get referenceId of replies
|
||||
anonymousSalt: 'klasddl3lala0l3lasdlas0ol3lasdlao3lasdoaslaldal3lasdclasdlal3lasdladlaq',
|
||||
publishUserFields: {
|
||||
profile: 1
|
||||
|
|
|
|||
80
imports/startup/server/comments.js
Normal file
80
imports/startup/server/comments.js
Normal file
|
|
@ -0,0 +1,80 @@
|
|||
/* 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');
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
@ -8,7 +8,7 @@ import './IPGeocoder';
|
|||
import './migrations';
|
||||
import './notificationsObserver';
|
||||
import './facts';
|
||||
import '../common/comments';
|
||||
import './comments';
|
||||
import './sitemaps';
|
||||
import './subsUnion';
|
||||
import './prerender';
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* global Migrations */
|
||||
/* global Migrations, Comments */
|
||||
/* eslint-disable import/no-absolute-path */
|
||||
import { Meteor } from 'meteor/meteor';
|
||||
import { Accounts } from 'meteor/accounts-base';
|
||||
|
|
@ -157,6 +157,12 @@ Meteor.startup(() => {
|
|||
}
|
||||
});
|
||||
|
||||
Migrations.add({
|
||||
version: 11,
|
||||
up: function noAnonComments() {
|
||||
Comments.getCollection().remove({ isAnonymous: true });
|
||||
}
|
||||
});
|
||||
|
||||
// Set createdAt in users & subs
|
||||
Migrations.migrateTo('latest');
|
||||
|
|
|
|||
|
|
@ -6,24 +6,13 @@ 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 sendEmail from '/imports/modules/server/send-email';
|
||||
import sendEmail, { subjectTruncate } from '/imports/modules/server/send-email';
|
||||
// import { hr } from '/imports/startup/server/email';
|
||||
import getOAuthProfile from '/imports/modules/get-oauth-profile';
|
||||
import getEmailOf from '/imports/modules/get-email-of-user';
|
||||
import image from 'google-maps-image-api-url';
|
||||
import { trim } from '/imports/ui/components/NotificationsObserver/util.js';
|
||||
|
||||
Meteor.startup(() => {
|
||||
// https://stackoverflow.com/questions/1199352/smart-way-to-shorten-long-strings-with-javascript
|
||||
function truncate(n, useWordBoundary) {
|
||||
if (this.length <= n) {
|
||||
return this;
|
||||
}
|
||||
const subString = this.substr(0, n - 1);
|
||||
return `${useWordBoundary ?
|
||||
subString.substr(0, subString.lastIndexOf(' ')) :
|
||||
subString}...`;
|
||||
}
|
||||
|
||||
// https://www.npmjs.com/package/google-maps-image-api-url
|
||||
// https://stackoverflow.com/questions/24355007/is-there-no-way-to-embed-a-google-map-into-an-html-email
|
||||
// https://developers.google.com/maps/documentation/static-maps/intro
|
||||
|
|
@ -49,16 +38,8 @@ Meteor.startup(() => {
|
|||
function process(notif) {
|
||||
if (notif.type === 'web' && !notif.emailNotified) {
|
||||
const user = Meteor.users.findOne({ _id: notif.userId });
|
||||
const hasPassword = user.services && user.services.password && user.services.password.bcrypt;
|
||||
const { firstName, emailAddress } = getEmailOf(user);
|
||||
|
||||
// console.log(`Has password: ${hasPassword}`);
|
||||
const OAuthProfile = getOAuthProfile({
|
||||
password: hasPassword,
|
||||
profile: user.profile
|
||||
}, user);
|
||||
const firstName = OAuthProfile ? OAuthProfile.name.first : user.profile.name.first;
|
||||
const emailAddress = OAuthProfile ? OAuthProfile.email :
|
||||
user && user.emails[0] && user.emails[0].verified ? user.emails[0].address : null;
|
||||
if (emailAddress) {
|
||||
const img = imgUrl(notif.geo.coordinates[1], notif.geo.coordinates[0]);
|
||||
// const url = imgUrl(notif.geo.coordinates[1], notif.geo.coordinates[0]);
|
||||
|
|
@ -77,7 +58,7 @@ Meteor.startup(() => {
|
|||
to: emailAddress,
|
||||
// userName: firstName,
|
||||
// sendAt: new Date(),
|
||||
subject: truncate.apply(message, [50, true]),
|
||||
subject: subjectTruncate.apply(message),
|
||||
// text: `${message}\n\n${fireTextUrl}\n\n`,
|
||||
// template: '<body><h2>{{appName}}</h2>{{{html}}}</body>',
|
||||
lang: user.lang,
|
||||
|
|
|
|||
317
private/email-templates/new-fire-comment-en.html
Normal file
317
private/email-templates/new-fire-comment-en.html
Normal file
|
|
@ -0,0 +1,317 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta name="viewport" content="width=device-width" />
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||
<title>[{{applicationName}}] There is more information about a fire</title>
|
||||
<style>
|
||||
/* -------------------------------------
|
||||
GLOBAL
|
||||
A very basic CSS reset
|
||||
------------------------------------- */
|
||||
* {
|
||||
margin: 0;
|
||||
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
|
||||
box-sizing: border-box;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
img {
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
body {
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-webkit-text-size-adjust: none;
|
||||
width: 100% !important;
|
||||
height: 100%;
|
||||
line-height: 1.6em;
|
||||
/* 1.6em * 14px = 22.4px, use px to get airier line-height also in Thunderbird, and Yahoo!, Outlook.com, AOL webmail clients */
|
||||
/*line-height: 22px;*/
|
||||
}
|
||||
|
||||
/* Let's make sure all tables have defaults */
|
||||
table td {
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
/* -------------------------------------
|
||||
BODY & CONTAINER
|
||||
------------------------------------- */
|
||||
|
||||
body {
|
||||
background-color: #f6f6f6;
|
||||
}
|
||||
|
||||
.body-wrap {
|
||||
background-color: #f6f6f6;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.container {
|
||||
display: block !important;
|
||||
max-width: 600px !important;
|
||||
margin: 0 auto !important;
|
||||
/* makes it centered */
|
||||
clear: both !important;
|
||||
}
|
||||
|
||||
.content {
|
||||
max-width: 600px;
|
||||
margin: 0 auto;
|
||||
display: block;
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
/* -------------------------------------
|
||||
HEADER, FOOTER, MAIN
|
||||
------------------------------------- */
|
||||
|
||||
.main {
|
||||
background-color: #fff;
|
||||
border: 1px solid #e9e9e9;
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
.content-wrap {
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.content-block {
|
||||
padding: 0 0 20px;
|
||||
}
|
||||
|
||||
.header {
|
||||
width: 100%;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.footer {
|
||||
width: 100%;
|
||||
clear: both;
|
||||
color: #999;
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.footer p, .footer a, .footer td {
|
||||
color: #999;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
/* -------------------------------------
|
||||
TYPOGRAPHY
|
||||
------------------------------------- */
|
||||
|
||||
h1, h2, h3 {
|
||||
font-family: "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
|
||||
color: #000;
|
||||
margin: 40px 0 0;
|
||||
line-height: 1.2em;
|
||||
font-weight: 400;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 32px;
|
||||
font-weight: 500;
|
||||
/* 1.2em * 32px = 38.4px, use px to get airier line-height also in Thunderbird, and Yahoo!, Outlook.com, AOL webmail clients */
|
||||
/*line-height: 38px;*/
|
||||
}
|
||||
|
||||
h2 {
|
||||
font-size: 24px;
|
||||
/* 1.2em * 24px = 28.8px, use px to get airier line-height also in Thunderbird, and Yahoo!, Outlook.com, AOL webmail clients */
|
||||
/*line-height: 29px;*/
|
||||
}
|
||||
|
||||
h3 {
|
||||
font-size: 18px;
|
||||
/* 1.2em * 18px = 21.6px, use px to get airier line-height also in Thunderbird, and Yahoo!, Outlook.com, AOL webmail clients */
|
||||
/*line-height: 22px;*/
|
||||
}
|
||||
|
||||
h4 {
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
p, ul, ol {
|
||||
margin-bottom: 10px;
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
p li, ul li, ol li {
|
||||
margin-left: 5px;
|
||||
list-style-position: inside;
|
||||
}
|
||||
|
||||
/* -------------------------------------
|
||||
LINKS & BUTTONS
|
||||
------------------------------------- */
|
||||
|
||||
a {
|
||||
color: #348eda;
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.btn-primary {
|
||||
text-decoration: none;
|
||||
color: #FFF;
|
||||
background-color: #4285F4;
|
||||
border: solid #4285F4;
|
||||
border-width: 10px 20px;
|
||||
line-height: 2em;
|
||||
/* 2em * 14px = 28px, use px to get airier line-height also in Thunderbird, and Yahoo!, Outlook.com, AOL webmail clients */
|
||||
/*line-height: 28px;*/
|
||||
font-weight: bold;
|
||||
text-align: center;
|
||||
cursor: pointer;
|
||||
display: inline-block;
|
||||
border-radius: 2px;
|
||||
text-transform: capitalize;
|
||||
}
|
||||
|
||||
/* -------------------------------------
|
||||
OTHER STYLES THAT MIGHT BE USEFUL
|
||||
------------------------------------- */
|
||||
|
||||
.last {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.first {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
.aligncenter {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.alignright {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.alignleft {
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.clear {
|
||||
clear: both;
|
||||
}
|
||||
|
||||
/* -------------------------------------
|
||||
ALERTS
|
||||
Change the class depending on warning email, good email or bad email
|
||||
------------------------------------- */
|
||||
|
||||
.alert {
|
||||
font-size: 16px;
|
||||
color: #fff;
|
||||
font-weight: 500;
|
||||
padding: 20px;
|
||||
text-align: center;
|
||||
border-radius: 3px 3px 0 0;
|
||||
}
|
||||
|
||||
.alert a {
|
||||
color: #fff;
|
||||
text-decoration: none;
|
||||
font-weight: 500;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
/* -------------------------------------
|
||||
RESPONSIVE AND MOBILE FRIENDLY STYLES
|
||||
------------------------------------- */
|
||||
@media only screen and (max-width: 640px) {
|
||||
body {
|
||||
padding: 0 !important;
|
||||
}
|
||||
|
||||
h1, h2, h3, h4 {
|
||||
font-weight: 800 !important;
|
||||
margin: 20px 0 5px !important;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 22px !important;
|
||||
}
|
||||
|
||||
h2 {
|
||||
font-size: 18px !important;
|
||||
}
|
||||
|
||||
h3 {
|
||||
font-size: 16px !important;
|
||||
}
|
||||
|
||||
.container {
|
||||
padding: 0 !important;
|
||||
width: 100% !important;
|
||||
}
|
||||
|
||||
.content {
|
||||
padding: 0 !important;
|
||||
}
|
||||
|
||||
.content-wrap {
|
||||
padding: 10px !important;
|
||||
}
|
||||
|
||||
.invoice {
|
||||
width: 100% !important;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body itemscope itemtype="http://schema.org/EmailMessage">
|
||||
|
||||
<table class="body-wrap">
|
||||
<tr>
|
||||
<td></td>
|
||||
<td class="container" width="600">
|
||||
<div class="content">
|
||||
<table class="main" width="100%" cellpadding="0" cellspacing="0" itemprop="action" itemscope itemtype="http://schema.org/UpdateAction">
|
||||
<tr>
|
||||
<td class="content-wrap">
|
||||
<meta itemprop="name" content="Fire info"/>
|
||||
<table width="100%" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td class="content-block">
|
||||
Hey, {{firstName}}!
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="content-block">
|
||||
There is more information about a fire to which you made comments:
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="content-block" itemprop="handler" itemscope itemtype="http://schema.org/HttpActionHandler">
|
||||
<a href="{{fireUrl}}" class="btn-primary" itemprop="url">More information about this fire</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="content-block">
|
||||
Thanks! <br />
|
||||
{{applicationName}} Team
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<div class="footer">
|
||||
<table width="100%">
|
||||
<tr>
|
||||
<td class="aligncenter content-block">Follow <a href="http://twitter.com/TsContraElFuego">@TsContraElFuego</a> on Twitter.</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div></div>
|
||||
</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
8
private/email-templates/new-fire-comment-en.txt
Normal file
8
private/email-templates/new-fire-comment-en.txt
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
Hey, {{firstName}}!
|
||||
|
||||
There is more information about a fire to which you made comments:
|
||||
|
||||
{{fireUrl}}
|
||||
|
||||
Thanks!
|
||||
{{applicationName}} Team
|
||||
317
private/email-templates/new-fire-comment-es.html
Normal file
317
private/email-templates/new-fire-comment-es.html
Normal file
|
|
@ -0,0 +1,317 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta name="viewport" content="width=device-width" />
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||
<title>[{{applicationName}}] Hay más información sobre un fuego</title>
|
||||
<style>
|
||||
/* -------------------------------------
|
||||
GLOBAL
|
||||
A very basic CSS reset
|
||||
------------------------------------- */
|
||||
* {
|
||||
margin: 0;
|
||||
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
|
||||
box-sizing: border-box;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
img {
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
body {
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-webkit-text-size-adjust: none;
|
||||
width: 100% !important;
|
||||
height: 100%;
|
||||
line-height: 1.6em;
|
||||
/* 1.6em * 14px = 22.4px, use px to get airier line-height also in Thunderbird, and Yahoo!, Outlook.com, AOL webmail clients */
|
||||
/*line-height: 22px;*/
|
||||
}
|
||||
|
||||
/* Let's make sure all tables have defaults */
|
||||
table td {
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
/* -------------------------------------
|
||||
BODY & CONTAINER
|
||||
------------------------------------- */
|
||||
|
||||
body {
|
||||
background-color: #f6f6f6;
|
||||
}
|
||||
|
||||
.body-wrap {
|
||||
background-color: #f6f6f6;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.container {
|
||||
display: block !important;
|
||||
max-width: 600px !important;
|
||||
margin: 0 auto !important;
|
||||
/* makes it centered */
|
||||
clear: both !important;
|
||||
}
|
||||
|
||||
.content {
|
||||
max-width: 600px;
|
||||
margin: 0 auto;
|
||||
display: block;
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
/* -------------------------------------
|
||||
HEADER, FOOTER, MAIN
|
||||
------------------------------------- */
|
||||
|
||||
.main {
|
||||
background-color: #fff;
|
||||
border: 1px solid #e9e9e9;
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
.content-wrap {
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.content-block {
|
||||
padding: 0 0 20px;
|
||||
}
|
||||
|
||||
.header {
|
||||
width: 100%;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.footer {
|
||||
width: 100%;
|
||||
clear: both;
|
||||
color: #999;
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.footer p, .footer a, .footer td {
|
||||
color: #999;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
/* -------------------------------------
|
||||
TYPOGRAPHY
|
||||
------------------------------------- */
|
||||
|
||||
h1, h2, h3 {
|
||||
font-family: "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
|
||||
color: #000;
|
||||
margin: 40px 0 0;
|
||||
line-height: 1.2em;
|
||||
font-weight: 400;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 32px;
|
||||
font-weight: 500;
|
||||
/* 1.2em * 32px = 38.4px, use px to get airier line-height also in Thunderbird, and Yahoo!, Outlook.com, AOL webmail clients */
|
||||
/*line-height: 38px;*/
|
||||
}
|
||||
|
||||
h2 {
|
||||
font-size: 24px;
|
||||
/* 1.2em * 24px = 28.8px, use px to get airier line-height also in Thunderbird, and Yahoo!, Outlook.com, AOL webmail clients */
|
||||
/*line-height: 29px;*/
|
||||
}
|
||||
|
||||
h3 {
|
||||
font-size: 18px;
|
||||
/* 1.2em * 18px = 21.6px, use px to get airier line-height also in Thunderbird, and Yahoo!, Outlook.com, AOL webmail clients */
|
||||
/*line-height: 22px;*/
|
||||
}
|
||||
|
||||
h4 {
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
p, ul, ol {
|
||||
margin-bottom: 10px;
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
p li, ul li, ol li {
|
||||
margin-left: 5px;
|
||||
list-style-position: inside;
|
||||
}
|
||||
|
||||
/* -------------------------------------
|
||||
LINKS & BUTTONS
|
||||
------------------------------------- */
|
||||
|
||||
a {
|
||||
color: #348eda;
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.btn-primary {
|
||||
text-decoration: none;
|
||||
color: #FFF;
|
||||
background-color: #4285F4;
|
||||
border: solid #4285F4;
|
||||
border-width: 10px 20px;
|
||||
line-height: 2em;
|
||||
/* 2em * 14px = 28px, use px to get airier line-height also in Thunderbird, and Yahoo!, Outlook.com, AOL webmail clients */
|
||||
/*line-height: 28px;*/
|
||||
font-weight: bold;
|
||||
text-align: center;
|
||||
cursor: pointer;
|
||||
display: inline-block;
|
||||
border-radius: 2px;
|
||||
text-transform: capitalize;
|
||||
}
|
||||
|
||||
/* -------------------------------------
|
||||
OTHER STYLES THAT MIGHT BE USEFUL
|
||||
------------------------------------- */
|
||||
|
||||
.last {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.first {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
.aligncenter {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.alignright {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.alignleft {
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.clear {
|
||||
clear: both;
|
||||
}
|
||||
|
||||
/* -------------------------------------
|
||||
ALERTS
|
||||
Change the class depending on warning email, good email or bad email
|
||||
------------------------------------- */
|
||||
|
||||
.alert {
|
||||
font-size: 16px;
|
||||
color: #fff;
|
||||
font-weight: 500;
|
||||
padding: 20px;
|
||||
text-align: center;
|
||||
border-radius: 3px 3px 0 0;
|
||||
}
|
||||
|
||||
.alert a {
|
||||
color: #fff;
|
||||
text-decoration: none;
|
||||
font-weight: 500;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
/* -------------------------------------
|
||||
RESPONSIVE AND MOBILE FRIENDLY STYLES
|
||||
------------------------------------- */
|
||||
@media only screen and (max-width: 640px) {
|
||||
body {
|
||||
padding: 0 !important;
|
||||
}
|
||||
|
||||
h1, h2, h3, h4 {
|
||||
font-weight: 800 !important;
|
||||
margin: 20px 0 5px !important;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 22px !important;
|
||||
}
|
||||
|
||||
h2 {
|
||||
font-size: 18px !important;
|
||||
}
|
||||
|
||||
h3 {
|
||||
font-size: 16px !important;
|
||||
}
|
||||
|
||||
.container {
|
||||
padding: 0 !important;
|
||||
width: 100% !important;
|
||||
}
|
||||
|
||||
.content {
|
||||
padding: 0 !important;
|
||||
}
|
||||
|
||||
.content-wrap {
|
||||
padding: 10px !important;
|
||||
}
|
||||
|
||||
.invoice {
|
||||
width: 100% !important;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body itemscope itemtype="http://schema.org/EmailMessage">
|
||||
|
||||
<table class="body-wrap">
|
||||
<tr>
|
||||
<td></td>
|
||||
<td class="container" width="600">
|
||||
<div class="content">
|
||||
<table class="main" width="100%" cellpadding="0" cellspacing="0" itemprop="action" itemscope itemtype="http://schema.org/UpdateAction">
|
||||
<tr>
|
||||
<td class="content-wrap">
|
||||
<meta itemprop="name" content="Fire info"/>
|
||||
<table width="100%" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td class="content-block">
|
||||
Hola, {{firstName}}!
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="content-block">
|
||||
Hay más información sobre un fuego al que hiciste comentarios:
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="content-block" itemprop="handler" itemscope itemtype="http://schema.org/HttpActionHandler">
|
||||
<a href="{{fireUrl}}" class="btn-primary" itemprop="url">Más información sobre ese fuego</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="content-block">
|
||||
Gracias! <br />
|
||||
El equipo de {{applicationName}}
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<div class="footer">
|
||||
<table width="100%">
|
||||
<tr>
|
||||
<td class="aligncenter content-block">Sigue a <a href="http://twitter.com/TsContraElFuego">@TsContraElFuego</a> en Twitter.</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div></div>
|
||||
</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
8
private/email-templates/new-fire-comment-es.txt
Normal file
8
private/email-templates/new-fire-comment-es.txt
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
Hola, {{firstName}}!
|
||||
|
||||
Hay más información sobre un fuego al que hiciste comentarios:
|
||||
|
||||
{{fireUrl}}
|
||||
|
||||
Gracias!
|
||||
El equipo de {{applicationName}}
|
||||
|
|
@ -274,7 +274,7 @@
|
|||
<table class="main" width="100%" cellpadding="0" cellspacing="0" itemprop="action" itemscope itemtype="http://schema.org/UpdateAction">
|
||||
<tr>
|
||||
<td class="content-wrap">
|
||||
<meta itemprop="name" content="Reset Password"/>
|
||||
<meta itemprop="name" content="Fire info"/>
|
||||
<table width="100%" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td class="content-block">
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ Hey, {{firstName}}!
|
|||
|
||||
{{message}}
|
||||
|
||||
[More information about this fire]({{fireUrl}})
|
||||
More information about this fire: {{fireUrl}}
|
||||
|
||||
Isn't it a forest fire? In the previous link you can tell us what kind of fire it is and help us improve our notifications.
|
||||
|
||||
|
|
|
|||
|
|
@ -274,7 +274,7 @@
|
|||
<table class="main" width="100%" cellpadding="0" cellspacing="0" itemprop="action" itemscope itemtype="http://schema.org/UpdateAction">
|
||||
<tr>
|
||||
<td class="content-wrap">
|
||||
<meta itemprop="name" content="Reset Password"/>
|
||||
<meta itemprop="name" content="Fire info"/>
|
||||
<table width="100%" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td class="content-block">
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ Hola, {{firstName}}!
|
|||
|
||||
{{message}}
|
||||
|
||||
[Más información sobre este fuego]({{fireUrl}})
|
||||
Más información sobre este fuego: {{fireUrl}}
|
||||
|
||||
¿No es un fuego forestal? En el enlace anterior puedes indicarnos de que tipo de fuego se trata y ayudarnos así a mejorar nuestras notificaciones.
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ A password reset has been requested for the account related to this email addres
|
|||
|
||||
To reset the password, visit the following link:
|
||||
|
||||
[Reset Password]({{resetUrl}})
|
||||
{{resetUrl}}
|
||||
|
||||
Thanks!
|
||||
{{applicationName}} Team
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ Se ha solicitado un reseteo de contraseña para la cuenta asociada a este correo
|
|||
|
||||
Para resetear la contraseña, visita el siguiente enlace:
|
||||
|
||||
[Resetea la contraseña]({{resetUrl}})
|
||||
{{resetUrl}}
|
||||
|
||||
Gracias!
|
||||
El equipo de {{applicationName}}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ Hey, {{firstName}}!
|
|||
|
||||
Can you do us a favor and verify your email address?
|
||||
|
||||
[Verify Email Address]({{verifyUrl}})
|
||||
Verify Email Address: {{verifyUrl}}
|
||||
|
||||
Thanks!
|
||||
{{applicationName}} Team
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ Hola, {{firstName}}!
|
|||
|
||||
¿Nos puedes hacer un favor y verificar tu correo electrónico?
|
||||
|
||||
[Verificar correo electrónico]({{verifyUrl}})
|
||||
Verificar correo electrónico: {{verifyUrl}}
|
||||
|
||||
Gracias!
|
||||
El equipo de {{applicationName}}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ Welcome to {{applicationName}}. We thank you for collaborating with us.
|
|||
|
||||
Ready to get started?
|
||||
|
||||
[View Your Subscriptions to Fires]({{welcomeUrl}})
|
||||
View Your Subscriptions to Fires: {{welcomeUrl}}
|
||||
|
||||
Thanks,
|
||||
{{applicationName}} Team
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ Bienvenid@ a {{applicationName}}. Te agradecemos que colabores con nosotr@s.
|
|||
|
||||
¿Preparada para empezar?
|
||||
|
||||
[Ver tus subscripciones a fuegos]({{welcomeUrl}})
|
||||
Ver tus subscripciones a fuegos: {{welcomeUrl}}
|
||||
|
||||
Gracias,
|
||||
El equipo de {{applicationName}}
|
||||
|
|
|
|||
|
|
@ -243,5 +243,7 @@
|
|||
"Cancelar":
|
||||
"Cancel",
|
||||
"Nota: Las nubes pueden entorpecer la detección de fuegos activos.":
|
||||
"Note: Cloud cover might obscure active fire detections."
|
||||
"Note: Cloud cover might obscure active fire detections.",
|
||||
"Hay más información sobre un fuego":
|
||||
"There is more information about a fire"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -328,5 +328,7 @@
|
|||
"Cancelar":
|
||||
"Cancelar",
|
||||
"Nota: Las nubes pueden entorpecer la detección de fuegos activos.":
|
||||
"Nota: Las nubes pueden entorpecer la detección de fuegos activos."
|
||||
"Nota: Las nubes pueden entorpecer la detección de fuegos activos.",
|
||||
"Hay más información sobre un fuego":
|
||||
"Hay más información sobre un fuego"
|
||||
}
|
||||
|
|
|
|||
27
test/email.test.js
Normal file
27
test/email.test.js
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
/* eslint-env mocha */
|
||||
/* eslint-disable func-names, prefer-arrow-callback */
|
||||
/* eslint-disable import/no-absolute-path */
|
||||
|
||||
import { chai } from 'meteor/practicalmeteor:chai';
|
||||
import { subjectTruncate } from '/imports/modules/server/send-email';
|
||||
|
||||
describe('check email utilities', () => {
|
||||
it('small words', async () => {
|
||||
chai.expect('something').equal(subjectTruncate.apply('something', [50, true]));
|
||||
});
|
||||
|
||||
it('big sentences', async () => {
|
||||
chai.expect('Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam eget sed.')
|
||||
.equal(subjectTruncate.apply('Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam eget sed.'));
|
||||
});
|
||||
|
||||
it('big sentences space break', async () => {
|
||||
chai.expect('Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi...')
|
||||
.equal(subjectTruncate.apply('Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi mollis cras amet.'));
|
||||
});
|
||||
|
||||
it('big sentences no break', async () => {
|
||||
chai.expect('Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi mollis...')
|
||||
.equal(subjectTruncate.apply('Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi mollis cras amet.', [70, false]));
|
||||
});
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue