nodebb-plugin-simple-contact 2.1.2 → 2.1.3
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/library.js +33 -8
- package/package.json +1 -1
package/library.js
CHANGED
|
@@ -6,6 +6,7 @@ const groups = require.main.require('./src/groups');
|
|
|
6
6
|
const socketIndex = require.main.require('./src/socket.io/index');
|
|
7
7
|
const emailer = require.main.require('./src/emailer');
|
|
8
8
|
const user = require.main.require('./src/user');
|
|
9
|
+
const meta = require.main.require('./src/meta');
|
|
9
10
|
|
|
10
11
|
let chats = null;
|
|
11
12
|
let messaging = null;
|
|
@@ -48,7 +49,7 @@ async function getChatRoom(req, res) {
|
|
|
48
49
|
try {
|
|
49
50
|
let roomId = null;
|
|
50
51
|
|
|
51
|
-
const chatModule = chats || messaging;
|
|
52
|
+
const chatModule = chats || messaging;
|
|
52
53
|
|
|
53
54
|
if (chatModule.getRoomId) {
|
|
54
55
|
roomId = await chatModule.getRoomId(myUid, touid);
|
|
@@ -228,23 +229,47 @@ async function replyToContact(req, res) {
|
|
|
228
229
|
}
|
|
229
230
|
|
|
230
231
|
try {
|
|
232
|
+
const logoUrl = meta.config['brand:emailLogo'] || meta.config['brand:logo'] || '';
|
|
233
|
+
const siteTitle = meta.config['title'] || 'NetFree';
|
|
234
|
+
|
|
235
|
+
let logoHtml = '';
|
|
236
|
+
if (logoUrl) {
|
|
237
|
+
const fullLogoUrl = logoUrl.startsWith('http') ? logoUrl : (meta.config['url'] + logoUrl);
|
|
238
|
+
logoHtml = `<div style="text-align: center; margin-bottom: 20px;">
|
|
239
|
+
<img src="${fullLogoUrl}" alt="${siteTitle}" style="max-height: 50px; width: auto; border: 0;">
|
|
240
|
+
</div>`;
|
|
241
|
+
} else {
|
|
242
|
+
logoHtml = `<div style="text-align: center; margin-bottom: 20px; font-weight: bold; font-size: 18px;">${siteTitle}</div>`;
|
|
243
|
+
}
|
|
244
|
+
|
|
231
245
|
const rawHtml = content.replace(/\n/g, '<br>');
|
|
232
|
-
|
|
246
|
+
|
|
247
|
+
const fullBodyHtml = `
|
|
248
|
+
<div dir="rtl" style="direction: rtl; text-align: right; font-family: Arial, sans-serif; background-color: #ffffff; padding: 10px;">
|
|
249
|
+
${logoHtml}
|
|
250
|
+
<div style="font-size: 14px; color: #333; line-height: 1.6;">
|
|
251
|
+
${rawHtml}
|
|
252
|
+
</div>
|
|
253
|
+
</div>
|
|
254
|
+
`;
|
|
255
|
+
|
|
256
|
+
const introHtml = '<div dir="rtl" style="direction: rtl; text-align: right; font-family: Arial, sans-serif;">שלום, קיבלת תשובה חדשה לפנייתך:</div>';
|
|
233
257
|
|
|
234
258
|
await emailer.sendToEmail('notification', email, 'he', {
|
|
235
259
|
subject: subject || 'תשובה לפנייתך בצור קשר',
|
|
236
|
-
username: '
|
|
260
|
+
username: ',',
|
|
237
261
|
|
|
238
262
|
notification: {
|
|
239
263
|
type: 'contact-reply',
|
|
240
264
|
bodyShort: subject || 'תשובה לפנייה',
|
|
241
|
-
bodyLong:
|
|
242
|
-
path:
|
|
265
|
+
bodyLong: fullBodyHtml,
|
|
266
|
+
path: ''
|
|
243
267
|
},
|
|
244
268
|
|
|
245
|
-
body:
|
|
246
|
-
|
|
247
|
-
|
|
269
|
+
body: fullBodyHtml,
|
|
270
|
+
intro: introHtml,
|
|
271
|
+
site_title: siteTitle,
|
|
272
|
+
url: meta.config['url']
|
|
248
273
|
});
|
|
249
274
|
|
|
250
275
|
res.json({ success: true });
|