@live-change/email-service 0.8.19 → 0.8.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/auth.js +4 -1
- package/package.json +3 -3
- package/render.js +2 -2
package/auth.js
CHANGED
|
@@ -141,7 +141,10 @@ definition.trigger({
|
|
|
141
141
|
async execute({ user, email }, { service }, emit) {
|
|
142
142
|
if(!email) throw new Error("no email")
|
|
143
143
|
const emailData = await Email.get(email)
|
|
144
|
-
if(emailData)
|
|
144
|
+
if(emailData) {
|
|
145
|
+
if(emailData.user === user) return false
|
|
146
|
+
throw { properties: { email: 'taken' } }
|
|
147
|
+
}
|
|
145
148
|
await service.trigger({
|
|
146
149
|
type: 'contactConnected',
|
|
147
150
|
contactType: 'email_Email',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@live-change/email-service",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.21",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"url": "https://www.viamage.com/"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@live-change/framework": "
|
|
24
|
+
"@live-change/framework": "0.8.21",
|
|
25
25
|
"got": "^11.8.3",
|
|
26
26
|
"html-to-text": "8.1.0",
|
|
27
27
|
"inline-css": "4.0.2",
|
|
@@ -29,6 +29,6 @@
|
|
|
29
29
|
"juice": "9.1.0",
|
|
30
30
|
"nodemailer": "^6.7.2"
|
|
31
31
|
},
|
|
32
|
-
"gitHead": "
|
|
32
|
+
"gitHead": "4453aa639a9fe1a857d93d73ebd28a82c97fdd87",
|
|
33
33
|
"type": "module"
|
|
34
34
|
}
|
package/render.js
CHANGED
|
@@ -41,7 +41,7 @@ definition.authenticator({
|
|
|
41
41
|
function processElement(element, images) {
|
|
42
42
|
for(let i = 0; i < element.attributes.length; i++) {
|
|
43
43
|
const attribute = element.attributes[i]
|
|
44
|
-
const remove = attribute.nodeName
|
|
44
|
+
const remove = attribute.nodeName === 'class' || attribute.nodeName.slice(0, 4) === 'data'
|
|
45
45
|
if(remove) {
|
|
46
46
|
element.removeAttribute(attribute.nodeName)
|
|
47
47
|
i--
|
|
@@ -112,7 +112,7 @@ async function renderEmail(data) {
|
|
|
112
112
|
}
|
|
113
113
|
if(toText !== null) {
|
|
114
114
|
email.text = htmlToText(messageElement.outerHTML)
|
|
115
|
-
if(messageElement.tagName
|
|
115
|
+
if(messageElement.tagName === 'PRE') {
|
|
116
116
|
const indentation = email.text.match(/^ */)[0]
|
|
117
117
|
const indentationRegex = new RegExp('\n' + indentation, 'g')
|
|
118
118
|
email.text = email.text.slice(indentation.length).replace(indentationRegex, '\n')
|