nodebb-plugin-simple-contact 2.1.0 → 2.1.1

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,17 @@ async function replyToContact(req, res) {
225
228
  }
226
229
 
227
230
  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>`;
231
+ const htmlContent = content.replace(/\n/g, '<br>');
233
232
 
234
233
  await emailer.sendToEmail('notification', email, 'he', {
235
234
  subject: subject || 'תשובה לפנייתך בצור קשר',
236
-
237
- username: ' ',
235
+ username: email,
238
236
 
239
237
  notification: {
240
238
  type: 'contact-reply',
241
239
  bodyShort: subject || 'תשובה לפנייה',
242
- bodyLong: htmlContent,
243
- path: null
240
+ bodyLong: htmlContent,
241
+ path: '/'
244
242
  },
245
243
 
246
244
  body: htmlContent,
@@ -248,9 +246,9 @@ async function replyToContact(req, res) {
248
246
  intro: 'קיבלת תשובה חדשה לפנייתך:'
249
247
  });
250
248
 
251
- //if (original_id) {
252
- // await db.setObjectField('contact-request:' + original_id, 'handled', true);
253
- //}
249
+ if (original_id) {
250
+ await db.setObjectField('contact-request:' + original_id, 'handled', true);
251
+ }
254
252
 
255
253
  res.json({ success: true });
256
254
  } catch (err) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nodebb-plugin-simple-contact",
3
- "version": "2.1.0",
3
+ "version": "2.1.1",
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 : 'שגיאה בשליחה';