nodebb-plugin-simple-contact 2.1.0 → 2.1.2
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
CHANGED
|
@@ -216,6 +216,9 @@ async function renderAdminPage(req, res) {
|
|
|
216
216
|
async function markAsHandled(req, res) {
|
|
217
217
|
try { await db.setObjectField('contact-request:' + req.body.id, 'handled', true); res.json({ success: true }); } catch (err) { res.status(500).json({ error: err.message }); }
|
|
218
218
|
}
|
|
219
|
+
async function deleteRequest(req, res) {
|
|
220
|
+
try { await db.delete('contact-request:' + req.body.id); await db.sortedSetRemove('contact-requests:sorted', req.body.id); res.json({ success: true }); } catch (err) { res.status(500).json({ error: err.message }); }
|
|
221
|
+
}
|
|
219
222
|
|
|
220
223
|
async function replyToContact(req, res) {
|
|
221
224
|
const { email, subject, content, original_id } = req.body;
|
|
@@ -225,22 +228,18 @@ async function replyToContact(req, res) {
|
|
|
225
228
|
}
|
|
226
229
|
|
|
227
230
|
try {
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
htmlContent = `<div dir="rtl" style="direction: rtl; text-align: right; font-family: Arial, sans-serif; font-size: 14px; line-height: 1.5;">
|
|
231
|
-
${htmlContent}
|
|
232
|
-
</div>`;
|
|
231
|
+
const rawHtml = content.replace(/\n/g, '<br>');
|
|
232
|
+
const htmlContent = '<div dir="rtl" style="direction: rtl; text-align: right; font-family: Arial, sans-serif;">' + rawHtml + '</div>';
|
|
233
233
|
|
|
234
234
|
await emailer.sendToEmail('notification', email, 'he', {
|
|
235
235
|
subject: subject || 'תשובה לפנייתך בצור קשר',
|
|
236
|
-
|
|
237
|
-
username: ' ',
|
|
236
|
+
username: ' ',
|
|
238
237
|
|
|
239
238
|
notification: {
|
|
240
239
|
type: 'contact-reply',
|
|
241
240
|
bodyShort: subject || 'תשובה לפנייה',
|
|
242
|
-
bodyLong: htmlContent,
|
|
243
|
-
path: null
|
|
241
|
+
bodyLong: htmlContent,
|
|
242
|
+
path: null
|
|
244
243
|
},
|
|
245
244
|
|
|
246
245
|
body: htmlContent,
|
|
@@ -248,10 +247,6 @@ async function replyToContact(req, res) {
|
|
|
248
247
|
intro: 'קיבלת תשובה חדשה לפנייתך:'
|
|
249
248
|
});
|
|
250
249
|
|
|
251
|
-
//if (original_id) {
|
|
252
|
-
// await db.setObjectField('contact-request:' + original_id, 'handled', true);
|
|
253
|
-
//}
|
|
254
|
-
|
|
255
250
|
res.json({ success: true });
|
|
256
251
|
} catch (err) {
|
|
257
252
|
console.error(err);
|
package/package.json
CHANGED
|
@@ -316,13 +316,12 @@
|
|
|
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', 'המייל נשלח
|
|
325
|
-
|
|
323
|
+
showMessage('success', 'המייל נשלח בהצלחה.');
|
|
324
|
+
setTimeout(function() { ajaxify.refresh(); }, 1000);
|
|
326
325
|
})
|
|
327
326
|
.fail(function(xhr) {
|
|
328
327
|
var err = xhr.responseJSON ? xhr.responseJSON.error : 'שגיאה בשליחה';
|