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.
- package/library.js +20 -4
- 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
|
-
|
|
224
|
+
|
|
225
|
+
if (!email || !content) {
|
|
226
|
+
return res.status(400).json({ error: 'חסרים נתונים לשליחה' });
|
|
227
|
+
}
|
|
228
|
+
|
|
225
229
|
try {
|
|
226
|
-
await emailer.sendToEmail('
|
|
227
|
-
|
|
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) {
|
|
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; };
|