mirror of
https://github.com/EvolutionAPI/evolution-api.git
synced 2025-07-15 03:32:55 -06:00
fix: receive medias on chatwoot
This commit is contained in:
parent
5401ecd2c4
commit
34769e2293
@ -933,11 +933,13 @@ export class ChatwootService {
|
|||||||
) {
|
) {
|
||||||
if (sourceId && this.isImportHistoryAvailable()) {
|
if (sourceId && this.isImportHistoryAvailable()) {
|
||||||
const messageAlreadySaved = await chatwootImport.getExistingSourceIds([sourceId]);
|
const messageAlreadySaved = await chatwootImport.getExistingSourceIds([sourceId]);
|
||||||
|
if (messageAlreadySaved) {
|
||||||
if (messageAlreadySaved.size > 0) {
|
if (messageAlreadySaved.size > 0) {
|
||||||
this.logger.warn('Message already saved on chatwoot');
|
this.logger.warn('Message already saved on chatwoot');
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
const data = new FormData();
|
const data = new FormData();
|
||||||
|
|
||||||
if (content) {
|
if (content) {
|
||||||
@ -2442,6 +2444,7 @@ export class ChatwootService {
|
|||||||
chatwootConfig: ChatwootDto,
|
chatwootConfig: ChatwootDto,
|
||||||
prepareMessage: (message: any) => any,
|
prepareMessage: (message: any) => any,
|
||||||
) {
|
) {
|
||||||
|
try {
|
||||||
if (!this.isImportHistoryAvailable()) {
|
if (!this.isImportHistoryAvailable()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -2494,5 +2497,8 @@ export class ChatwootService {
|
|||||||
await chatwootImport.importHistoryMessages(instance, this, inbox, this.provider);
|
await chatwootImport.importHistoryMessages(instance, this, inbox, this.provider);
|
||||||
const waInstance = this.waMonitor.waInstances[instance.instanceName];
|
const waInstance = this.waMonitor.waInstances[instance.instanceName];
|
||||||
waInstance.clearCacheChatwoot();
|
waInstance.clearCacheChatwoot();
|
||||||
|
} catch (error) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -170,6 +170,7 @@ class ChatwootImport {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public async getExistingSourceIds(sourceIds: string[]): Promise<Set<string>> {
|
public async getExistingSourceIds(sourceIds: string[]): Promise<Set<string>> {
|
||||||
|
try {
|
||||||
const existingSourceIdsSet = new Set<string>();
|
const existingSourceIdsSet = new Set<string>();
|
||||||
|
|
||||||
if (sourceIds.length === 0) {
|
if (sourceIds.length === 0) {
|
||||||
@ -186,6 +187,9 @@ class ChatwootImport {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return existingSourceIdsSet;
|
return existingSourceIdsSet;
|
||||||
|
} catch (error) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public async importHistoryMessages(
|
public async importHistoryMessages(
|
||||||
|
Loading…
Reference in New Issue
Block a user