fix: fix in update settings that needed to restart after updated

This commit is contained in:
Davidson Gomes
2023-07-21 09:34:39 -03:00
parent 5121374d60
commit 763e30bd1d
3 changed files with 25 additions and 2 deletions

View File

@@ -2364,6 +2364,9 @@ export class WAStartupService {
public async fetchMessages(query: MessageQuery) {
this.logger.verbose('Fetching messages');
if (query?.where) {
if (query.where?.key?.remoteJid) {
query.where.key.remoteJid = this.createJid(query.where.key.remoteJid);
}
query.where.owner = this.instance.name;
} else {
query = {
@@ -2379,6 +2382,9 @@ export class WAStartupService {
public async fetchStatusMessage(query: MessageUpQuery) {
this.logger.verbose('Fetching status messages');
if (query?.where) {
if (query.where?.remoteJid) {
query.where.remoteJid = this.createJid(query.where.remoteJid);
}
query.where.owner = this.instance.name;
} else {
query = {
@@ -2423,8 +2429,19 @@ export class WAStartupService {
this.logger.verbose('Groups add privacy updated');
// reinicia a instancia
this.client?.ws?.close();
return { update: 'success', data: await this.client.fetchPrivacySettings() };
return {
update: 'success',
data: {
readreceipts: settings.privacySettings.readreceipts,
profile: settings.privacySettings.profile,
status: settings.privacySettings.status,
online: settings.privacySettings.online,
last: settings.privacySettings.last,
groupadd: settings.privacySettings.groupadd,
},
};
} catch (error) {
throw new InternalServerErrorException(
'Error updating privacy settings',