Skip to content

Commit 5b2a0fd

Browse files
committed
Adjust to repository from session worker
1 parent 9354af3 commit 5b2a0fd

File tree

3 files changed

+5
-7
lines changed

3 files changed

+5
-7
lines changed

src/api/controllers/instance.controller.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -753,7 +753,7 @@ export class InstanceController {
753753
this.logger.verbose('deleting instance: ' + instanceName);
754754

755755
try {
756-
this.waMonitor.waInstances[instanceName].sendDataWebhook(Events.INSTANCE_DELETE, {
756+
this.waMonitor.waInstances[instanceName]?.sendDataWebhook(Events.INSTANCE_DELETE, {
757757
instanceName,
758758
instanceId: (await this.repository.auth.find(instanceName))?.instanceId,
759759
});

src/api/services/channels/whatsapp.baileys.service.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1478,15 +1478,15 @@ export class BaileysStartupService extends ChannelStartupService {
14781478
this.logger.verbose('Sending data to webhook in event LABELS_ASSOCIATION');
14791479

14801480
// Atualiza labels nos chats
1481-
if (database.SAVE_DATA.CHATS) {
1481+
if (database.ENABLED && database.SAVE_DATA.CHATS) {
14821482
const chats = await this.repository.chat.find({
14831483
where: {
14841484
owner: this.instance.name,
14851485
},
14861486
});
14871487
const chat = chats.find((c) => c.id === data.association.chatId);
14881488
if (chat) {
1489-
let labels = [...chat?.labels];
1489+
let labels = [...chat.labels];
14901490
if (data.type === 'remove') {
14911491
labels = labels.filter((label) => label !== data.association.labelId);
14921492
} else if (data.type === 'add') {

src/api/services/monitor.service.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -271,19 +271,17 @@ export class WAMonitoringService {
271271
this.logger.verbose('cleaning up instance in files: ' + instanceName);
272272
if (this.providerSession?.ENABLED) {
273273
await this.providerFiles.removeSession(instanceName);
274-
} else {
275-
rmSync(join(INSTANCE_DIR, instanceName), { recursive: true, force: true });
276274
}
275+
rmSync(join(INSTANCE_DIR, instanceName), { recursive: true, force: true });
277276
}
278277

279278
public async cleaningStoreFiles(instanceName: string) {
280279
if (!this.db.ENABLED) {
281280
this.logger.verbose('cleaning store files instance: ' + instanceName);
282281
if (this.providerSession?.ENABLED) {
283282
await this.providerFiles.removeSession(instanceName);
284-
} else {
285-
rmSync(join(INSTANCE_DIR, instanceName), { recursive: true, force: true });
286283
}
284+
rmSync(join(INSTANCE_DIR, instanceName), { recursive: true, force: true });
287285

288286
execSync(`rm -rf ${join(STORE_DIR, 'chats', instanceName)}`);
289287
execSync(`rm -rf ${join(STORE_DIR, 'contacts', instanceName)}`);

0 commit comments

Comments
 (0)