up
This commit is contained in:
+13
-3
@@ -2257,7 +2257,8 @@
|
||||
// hide reply preview if any
|
||||
this.hideReplyPreview();
|
||||
if (resp && resp.success) {
|
||||
this.addMessageToView(`Plantilla: ${templateName}`, 'outgoing');
|
||||
const replyToTemplate = document.getElementById('message-input').dataset.replyTo || null;
|
||||
this.addMessageToView(`Plantilla: ${templateName}`, 'outgoing', { reply_to_message_id: replyToTemplate });
|
||||
typeof showAlert !== 'undefined' && showAlert('Mensaje de plantilla enviado correctamente', 'success');
|
||||
await this.loadconversations(this.currentUserId, false);
|
||||
await this.loadConversations();
|
||||
@@ -2284,7 +2285,7 @@
|
||||
}
|
||||
|
||||
// Insertar mensaje saliente en la vista inmediatamente (simular envío)
|
||||
addMessageToView(content, type = 'outgoing') {
|
||||
addMessageToView(content, type = 'outgoing', options = {}) {
|
||||
const msg = {
|
||||
message_id: 'local_' + Date.now(),
|
||||
direction: type === 'outgoing' ? 'outgoing' : 'incoming',
|
||||
@@ -2292,6 +2293,15 @@
|
||||
created_at: new Date().toISOString(),
|
||||
status: 'sent'
|
||||
};
|
||||
// Soportar reply preview inmediato
|
||||
if (options && options.reply_to_message_id) {
|
||||
msg.reply_to_message_id = options.reply_to_message_id;
|
||||
}
|
||||
// Soportar attachments/meta si es necesario
|
||||
if (options && options.message_type) {
|
||||
msg.message_type = options.message_type;
|
||||
}
|
||||
|
||||
this.conversations.push(msg);
|
||||
this.renderconversations();
|
||||
this.scrollToBottom();
|
||||
@@ -2417,7 +2427,7 @@
|
||||
if (result && result.success) {
|
||||
input.value = '';
|
||||
// Mostrar inmediatamente en la vista
|
||||
this.addMessageToView(message, 'outgoing');
|
||||
this.addMessageToView(message, 'outgoing', { reply_to_message_id: replyTo });
|
||||
typeof showAlert !== 'undefined' && showAlert('Mensaje enviado correctamente', 'success');
|
||||
// Recargar mensajes y conversaciones en background
|
||||
this.loadconversations(this.currentUserId, false).catch(e=>console.warn(e));
|
||||
|
||||
Reference in New Issue
Block a user