nodebb-plugin-simple-contact 2.1.1 → 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 +34 -12
- package/package.json +1 -1
- package/public/templates/admin/plugins/contact.tpl +1 -2
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,28 +229,49 @@ async function replyToContact(req, res) {
|
|
|
228
229
|
}
|
|
229
230
|
|
|
230
231
|
try {
|
|
231
|
-
const
|
|
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
|
+
|
|
245
|
+
const rawHtml = content.replace(/\n/g, '<br>');
|
|
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>';
|
|
232
257
|
|
|
233
258
|
await emailer.sendToEmail('notification', email, 'he', {
|
|
234
259
|
subject: subject || 'תשובה לפנייתך בצור קשר',
|
|
235
|
-
username:
|
|
260
|
+
username: ',',
|
|
236
261
|
|
|
237
262
|
notification: {
|
|
238
263
|
type: 'contact-reply',
|
|
239
264
|
bodyShort: subject || 'תשובה לפנייה',
|
|
240
|
-
bodyLong:
|
|
241
|
-
path: '
|
|
265
|
+
bodyLong: fullBodyHtml,
|
|
266
|
+
path: ''
|
|
242
267
|
},
|
|
243
268
|
|
|
244
|
-
body:
|
|
245
|
-
|
|
246
|
-
|
|
269
|
+
body: fullBodyHtml,
|
|
270
|
+
intro: introHtml,
|
|
271
|
+
site_title: siteTitle,
|
|
272
|
+
url: meta.config['url']
|
|
247
273
|
});
|
|
248
274
|
|
|
249
|
-
if (original_id) {
|
|
250
|
-
await db.setObjectField('contact-request:' + original_id, 'handled', true);
|
|
251
|
-
}
|
|
252
|
-
|
|
253
275
|
res.json({ success: true });
|
|
254
276
|
} catch (err) {
|
|
255
277
|
console.error(err);
|
package/package.json
CHANGED
|
@@ -316,12 +316,11 @@
|
|
|
316
316
|
email: email,
|
|
317
317
|
subject: subject,
|
|
318
318
|
content: content,
|
|
319
|
-
original_id: id,
|
|
320
319
|
_csrf: config.csrf_token
|
|
321
320
|
})
|
|
322
321
|
.done(function(data) {
|
|
323
322
|
$('#emailReplyModal').modal('hide');
|
|
324
|
-
showMessage('success', 'המייל נשלח
|
|
323
|
+
showMessage('success', 'המייל נשלח בהצלחה.');
|
|
325
324
|
setTimeout(function() { ajaxify.refresh(); }, 1000);
|
|
326
325
|
})
|
|
327
326
|
.fail(function(xhr) {
|