nodebb-plugin-simple-contact 2.0.1 → 2.1.0

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,9 +216,7 @@ 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
  async function replyToContact(req, res) {
223
221
  const { email, subject, content, original_id } = req.body;
224
222
 
@@ -227,16 +225,32 @@ async function replyToContact(req, res) {
227
225
  }
228
226
 
229
227
  try {
228
+ let htmlContent = content.replace(/\n/g, '<br>');
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>`;
233
+
230
234
  await emailer.sendToEmail('notification', email, 'he', {
231
235
  subject: subject || 'תשובה לפנייתך בצור קשר',
232
- username: email,
233
- message: content.replace(/\n/g, '<br>'),
234
- body: content.replace(/\n/g, '<br>')
236
+
237
+ username: ' ',
238
+
239
+ notification: {
240
+ type: 'contact-reply',
241
+ bodyShort: subject || 'תשובה לפנייה',
242
+ bodyLong: htmlContent,
243
+ path: null
244
+ },
245
+
246
+ body: htmlContent,
247
+ message: htmlContent,
248
+ intro: 'קיבלת תשובה חדשה לפנייתך:'
235
249
  });
236
250
 
237
- if (original_id) {
238
- await db.setObjectField('contact-request:' + original_id, 'handled', true);
239
- }
251
+ //if (original_id) {
252
+ // await db.setObjectField('contact-request:' + original_id, 'handled', true);
253
+ //}
240
254
 
241
255
  res.json({ success: true });
242
256
  } catch (err) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nodebb-plugin-simple-contact",
3
- "version": "2.0.1",
3
+ "version": "2.1.0",
4
4
  "description": "תוסף טופס צור קשר עם התראות למנהלים וניהול פניות",
5
5
  "main": "library.js",
6
6
  "nbbpm": {
@@ -321,8 +321,8 @@
321
321
  })
322
322
  .done(function(data) {
323
323
  $('#emailReplyModal').modal('hide');
324
- showMessage('success', 'המייל נשלח בהצלחה והפנייה סומנה כטופלה');
325
- setTimeout(function() { ajaxify.refresh(); }, 1000);
324
+ showMessage('success', 'המייל נשלח בהצלחה');
325
+ //setTimeout(function() { ajaxify.refresh(); }, 1000);
326
326
  })
327
327
  .fail(function(xhr) {
328
328
  var err = xhr.responseJSON ? xhr.responseJSON.error : 'שגיאה בשליחה';