@peopl-health/nexus 4.2.11 → 4.2.13
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.
|
@@ -92,24 +92,24 @@ class ScheduledMessageJob extends BaseJob {
|
|
|
92
92
|
});
|
|
93
93
|
}
|
|
94
94
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
95
|
+
try {
|
|
96
|
+
let parentMessageId = msg.parentMessageId || null;
|
|
97
|
+
if (!parentMessageId) {
|
|
98
|
+
const storage = this.requireMessageStorage?.();
|
|
99
|
+
if (storage?.savePendingMessage) {
|
|
100
|
+
const parent = await storage.savePendingMessage({
|
|
101
|
+
code: msg.code, body: msg.message, fileUrl: msg.fileUrl, fileType: msg.fileType,
|
|
102
|
+
contentSid: msg.contentSid, variables: msg.variables,
|
|
103
|
+
fromMe: true, processed: true,
|
|
104
|
+
frontendId: msg.frontendId, triggeredBy: msg.triggeredBy
|
|
105
|
+
});
|
|
106
|
+
parentMessageId = parent?._id || null;
|
|
107
|
+
if (parentMessageId) {
|
|
108
|
+
await ScheduledMessage.updateOne({ _id: scheduledMessageId }, { $set: { parentMessageId } });
|
|
109
|
+
}
|
|
108
110
|
}
|
|
109
111
|
}
|
|
110
|
-
}
|
|
111
112
|
|
|
112
|
-
try {
|
|
113
113
|
const result = await this.sendMessage({
|
|
114
114
|
code: msg.code,
|
|
115
115
|
body: msg.message,
|
|
@@ -79,10 +79,11 @@ class MongoStorage {
|
|
|
79
79
|
}
|
|
80
80
|
|
|
81
81
|
_emitMessageNew(doc, from, frontendId, status = null) {
|
|
82
|
-
|
|
82
|
+
const fromValue = from || doc?.numero;
|
|
83
|
+
if (!fromValue || !doc?._id) return;
|
|
83
84
|
safeEmit(getStatusEventBus(), 'message:new', createEvent('message:new', {
|
|
84
85
|
messageId: String(doc._id),
|
|
85
|
-
from,
|
|
86
|
+
from: fromValue,
|
|
86
87
|
code: doc.numero,
|
|
87
88
|
name: doc.nombre_whatsapp,
|
|
88
89
|
origin: doc.origin,
|