nodebb-plugin-simple-contact 2.0.0 → 2.0.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.
Files changed (2) hide show
  1. package/library.js +20 -4
  2. package/package.json +1 -1
package/library.js CHANGED
@@ -221,12 +221,28 @@ async function deleteRequest(req, res) {
221
221
  }
222
222
  async function replyToContact(req, res) {
223
223
  const { email, subject, content, original_id } = req.body;
224
- if (!email || !content) return res.status(400).json({ error: 'חסרים נתונים לשליחה' });
224
+
225
+ if (!email || !content) {
226
+ return res.status(400).json({ error: 'חסרים נתונים לשליחה' });
227
+ }
228
+
225
229
  try {
226
- await emailer.sendToEmail('banned', email, 'he', { subject: subject || 'תשובה', username: email, message: content.replace(/\n/g, '<br>'), body: content.replace(/\n/g, '<br>') });
227
- if (original_id) await db.setObjectField('contact-request:' + original_id, 'handled', true);
230
+ await emailer.sendToEmail('notification', email, 'he', {
231
+ subject: subject || 'תשובה לפנייתך בצור קשר',
232
+ username: email,
233
+ message: content.replace(/\n/g, '<br>'),
234
+ body: content.replace(/\n/g, '<br>')
235
+ });
236
+
237
+ if (original_id) {
238
+ await db.setObjectField('contact-request:' + original_id, 'handled', true);
239
+ }
240
+
228
241
  res.json({ success: true });
229
- } catch (err) { res.status(500).json({ error: err.message }); }
242
+ } catch (err) {
243
+ console.error(err);
244
+ res.status(500).json({ error: 'שגיאה בשליחת המייל: ' + err.message });
245
+ }
230
246
  }
231
247
 
232
248
  ContactPlugin.addNavigation = async function (header) { if (header && Array.isArray(header.navigation)) { header.navigation.push({ route: '/contact', iconClass: 'fa-envelope', text: 'צור קשר', title: 'צור קשר' }); } return header; };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nodebb-plugin-simple-contact",
3
- "version": "2.0.0",
3
+ "version": "2.0.1",
4
4
  "description": "תוסף טופס צור קשר עם התראות למנהלים וניהול פניות",
5
5
  "main": "library.js",
6
6
  "nbbpm": {