mirror of
https://github.com/EvolutionAPI/evolution-api.git
synced 2025-12-19 03:42:23 -06:00
chore: Improve code consistency and readability
Refactored the initialization of `LocalSettings` in `channel.service.ts` to only set the properties that have been explicitly provided. This refactoring improves code consistency and readability. Also, removed the unused `initStoreFolders` method from `repository.service.ts` and its related imports. In addition, updated the import style for `PrismaClient` in `repository.service.ts`. The modified files are: - src/api/controllers/instance.controller.ts - src/api/repository/repository.service.ts - src/api/services/channel.service.ts - src/api/services/channels/whatsapp.baileys.service.ts
This commit is contained in:
@@ -189,7 +189,13 @@ export class ChannelStartupService {
|
||||
},
|
||||
});
|
||||
|
||||
Object.assign(this.localSettings, data);
|
||||
this.localSettings.rejectCall = data?.rejectCall;
|
||||
this.localSettings.msgCall = data?.msgCall;
|
||||
this.localSettings.groupsIgnore = data?.groupsIgnore;
|
||||
this.localSettings.alwaysOnline = data?.alwaysOnline;
|
||||
this.localSettings.readMessages = data?.readMessages;
|
||||
this.localSettings.readStatus = data?.readStatus;
|
||||
this.localSettings.syncFullHistory = data?.syncFullHistory;
|
||||
}
|
||||
|
||||
public async findSettings() {
|
||||
|
||||
@@ -256,7 +256,7 @@ export class BaileysStartupService extends ChannelStartupService {
|
||||
public async getProfileStatus() {
|
||||
const status = await this.client.fetchStatus(this.instance.wuid);
|
||||
|
||||
return status[0]?.status;
|
||||
return status?.status;
|
||||
}
|
||||
|
||||
public get profilePictureUrl() {
|
||||
@@ -551,6 +551,8 @@ export class BaileysStartupService extends ChannelStartupService {
|
||||
|
||||
this.logger.info(log);
|
||||
|
||||
this.logger.info(`Group Ignore: ${this.localSettings.groupsIgnore}`);
|
||||
|
||||
let options;
|
||||
|
||||
if (this.localProxy.enabled) {
|
||||
@@ -625,7 +627,6 @@ export class BaileysStartupService extends ChannelStartupService {
|
||||
},
|
||||
userDevicesCache: this.userDevicesCache,
|
||||
transactionOpts: { maxCommitRetries: 5, delayBetweenTriesMs: 2500 },
|
||||
// forceGroupsPrekey: false,
|
||||
patchMessageBeforeSending(message) {
|
||||
if (
|
||||
message.deviceSentMessage?.message?.listMessage?.listType ===
|
||||
@@ -1667,7 +1668,7 @@ export class BaileysStartupService extends ChannelStartupService {
|
||||
try {
|
||||
return {
|
||||
wuid: jid,
|
||||
status: (await this.client.fetchStatus(jid))[0]?.status,
|
||||
status: (await this.client.fetchStatus(jid))?.status,
|
||||
};
|
||||
} catch (error) {
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user