From 26519cea4b095143e81c4082d618ff371cb519a9 Mon Sep 17 00:00:00 2001 From: Tim Taubert Date: Fri, 16 Jun 2017 11:26:48 +0200 Subject: [PATCH] Remove Postmark dependency --- src/email.js | 29 ----------------------------- src/index.js | 12 ------------ 2 files changed, 41 deletions(-) delete mode 100644 src/email.js diff --git a/src/email.js b/src/email.js deleted file mode 100644 index 6751655..0000000 --- a/src/email.js +++ /dev/null @@ -1,29 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -import postmark_ from "postmark"; -const postmark = postmark_(process.env.POSTMARK_API_TOKEN); - -const FROM = "NSS Taskcluster "; - -async function send(recipients, subject, body) { - let addresses = recipients.map(recipient => { - if (recipient.email) { - return `"${recipient.name || recipient.email}" <${recipient.email}>`; - } - }).filter(x => x); - - if (!addresses.length) { - return; - } - - postmark.send({ - From: FROM, - To: addresses.join(", "), - Subject: subject, - TextBody: body - }); -} - -module.exports.send = send; diff --git a/src/index.js b/src/index.js index 29bcf85..bc12555 100644 --- a/src/index.js +++ b/src/index.js @@ -5,7 +5,6 @@ import hg from "./hg"; import irc from "./irc"; import tcc from "./tcc"; -import email from "./email"; import colors from "irc-colors"; import unique from "array-unique"; @@ -95,17 +94,6 @@ tcc.onTaskFailed(async function (msg) { let blame = unique(authors.map(author => author.name)).join(", "); irc.say(`[${level}] ${url} — ${task.metadata.name} @ ${platform} ${collection} (blame: ${blame})`); - - // Build descriptions. - let descriptions = changesets.map(changeset => { - return `${changeset.author.name} — ${changeset.desc}\n${changeset.href}`; - }); - - // Send emails. - email.send(authors, - `[NSS Taskcluster] ${task.metadata.name} FAILING on ${platform} ${collection} @ ${revision}`, - `${task.metadata.name} @ ${platform} ${collection}\n` + - `${url}\n\n${descriptions.join("\n\n")}`); }); // Join ASAP.