Adds ignore_list to instance settings

This commit is contained in:
Pedro Howat 2024-08-27 16:17:09 -03:00
parent 58ef0cb3ac
commit 5055f6a1ff
7 changed files with 8 additions and 1 deletions

View File

@ -401,6 +401,7 @@ export class InstanceController {
read_messages: read_messages || false,
read_status: read_status || false,
sync_full_history: sync_full_history ?? false,
ignore_list: [],
};
this.logger.verbose('settings: ' + JSON.stringify(settings));

View File

@ -6,4 +6,5 @@ export class SettingsDto {
read_messages?: boolean;
read_status?: boolean;
sync_full_history?: boolean;
ignore_list?: string[];
}

View File

@ -79,7 +79,7 @@ export class KwikController {
);
const mm = msgs.map((msg) => {
const [messageType, lastMsg] = Object.entries(msg.message)[0] || ['none', ''];
const [messageType] = Object.entries(msg.message)[0] || ['none', ''];
const chat_data = {
id: msg._id,

View File

@ -11,6 +11,7 @@ export class SettingsRaw {
read_messages?: boolean;
read_status?: boolean;
sync_full_history?: boolean;
ignore_list?: string[];
}
const settingsSchema = new Schema<SettingsRaw>({
@ -22,6 +23,7 @@ const settingsSchema = new Schema<SettingsRaw>({
read_messages: { type: Boolean, required: true },
read_status: { type: Boolean, required: true },
sync_full_history: { type: Boolean, required: true },
ignore_list: { type: [String], required: false },
});
export const SettingsModel = dbserver?.model(SettingsRaw.name, settingsSchema, 'settings');

View File

@ -222,6 +222,7 @@ export class ChannelStartupService {
read_messages: data.read_messages,
read_status: data.read_status,
sync_full_history: data.sync_full_history,
ignore_list: data.ignore_list,
};
}

View File

@ -83,6 +83,7 @@ export declare namespace wa {
read_messages?: boolean;
read_status?: boolean;
sync_full_history?: boolean;
ignore_list?: string[];
};
export type LocalWebsocket = {

View File

@ -1002,6 +1002,7 @@ export const settingsSchema: JSONSchema7 = {
read_messages: { type: 'boolean', enum: [true, false] },
read_status: { type: 'boolean', enum: [true, false] },
sync_full_history: { type: 'boolean', enum: [true, false] },
ignore_list: { type: 'array', items: { type: 'string' } },
},
required: ['reject_call', 'groups_ignore', 'always_online', 'read_messages', 'read_status', 'sync_full_history'],
...isNotEmpty('reject_call', 'groups_ignore', 'always_online', 'read_messages', 'read_status', 'sync_full_history'),