mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2025-12-20 10:19:08 +00:00
Fix initial all chats folder params
This commit is contained in:
@@ -0,0 +1,29 @@
|
|||||||
|
// Copyright 2025 Signal Messenger, LLC
|
||||||
|
// SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
|
import type { LoggerType } from '../../types/Logging.std.js';
|
||||||
|
import type { WritableDB } from '../Interface.std.js';
|
||||||
|
import { sql } from '../util.std.js';
|
||||||
|
|
||||||
|
export default function updateToSchemaVersion1500(
|
||||||
|
db: WritableDB,
|
||||||
|
logger: LoggerType
|
||||||
|
): void {
|
||||||
|
const FOLDER_TYPE_ALL = 1;
|
||||||
|
const [query, params] = sql`
|
||||||
|
UPDATE chatFolders
|
||||||
|
SET
|
||||||
|
includeAllIndividualChats = 1,
|
||||||
|
includeAllGroupChats = 1,
|
||||||
|
storageNeedsSync = 1
|
||||||
|
WHERE
|
||||||
|
folderType = ${FOLDER_TYPE_ALL}
|
||||||
|
AND (
|
||||||
|
includeAllIndividualChats IS 0
|
||||||
|
OR
|
||||||
|
includeAllGroupChats IS 0
|
||||||
|
)
|
||||||
|
`;
|
||||||
|
const result = db.prepare(query).run(params);
|
||||||
|
logger.info(`Updated ${result.changes} all chats chat folders`);
|
||||||
|
}
|
||||||
@@ -5,8 +5,8 @@ import {
|
|||||||
type ChatFolderId,
|
type ChatFolderId,
|
||||||
type ChatFolder,
|
type ChatFolder,
|
||||||
CHAT_FOLDER_DELETED_POSITION,
|
CHAT_FOLDER_DELETED_POSITION,
|
||||||
CHAT_FOLDER_DEFAULTS,
|
|
||||||
ChatFolderType,
|
ChatFolderType,
|
||||||
|
ALL_CHATS_FOLDER_REQUIRED_PARAMS,
|
||||||
} from '../../types/ChatFolder.std.js';
|
} from '../../types/ChatFolder.std.js';
|
||||||
import type { ReadableDB, WritableDB } from '../Interface.std.js';
|
import type { ReadableDB, WritableDB } from '../Interface.std.js';
|
||||||
import { sql } from '../util.std.js';
|
import { sql } from '../util.std.js';
|
||||||
@@ -171,9 +171,8 @@ export function hasAllChatsChatFolder(db: ReadableDB): boolean {
|
|||||||
export function createAllChatsChatFolder(db: WritableDB): ChatFolder {
|
export function createAllChatsChatFolder(db: WritableDB): ChatFolder {
|
||||||
return db.transaction(() => {
|
return db.transaction(() => {
|
||||||
const allChatsChatFolder: ChatFolder = {
|
const allChatsChatFolder: ChatFolder = {
|
||||||
...CHAT_FOLDER_DEFAULTS,
|
|
||||||
id: generateUuid() as ChatFolderId,
|
id: generateUuid() as ChatFolderId,
|
||||||
folderType: ChatFolderType.ALL,
|
...ALL_CHATS_FOLDER_REQUIRED_PARAMS,
|
||||||
position: 0,
|
position: 0,
|
||||||
deletedAtTimestampMs: 0,
|
deletedAtTimestampMs: 0,
|
||||||
storageID: null,
|
storageID: null,
|
||||||
|
|||||||
@@ -87,6 +87,17 @@ export const CHAT_FOLDER_DEFAULTS: ChatFolderParams = {
|
|||||||
excludedConversationIds: [],
|
excludedConversationIds: [],
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const ALL_CHATS_FOLDER_REQUIRED_PARAMS: ChatFolderParams = {
|
||||||
|
folderType: ChatFolderType.ALL,
|
||||||
|
name: '',
|
||||||
|
showOnlyUnread: false,
|
||||||
|
showMutedChats: true,
|
||||||
|
includeAllIndividualChats: true,
|
||||||
|
includeAllGroupChats: true,
|
||||||
|
includedConversationIds: [],
|
||||||
|
excludedConversationIds: [],
|
||||||
|
};
|
||||||
|
|
||||||
export const CHAT_FOLDER_PRESETS = {
|
export const CHAT_FOLDER_PRESETS = {
|
||||||
UNREAD_CHATS: {
|
UNREAD_CHATS: {
|
||||||
...CHAT_FOLDER_DEFAULTS,
|
...CHAT_FOLDER_DEFAULTS,
|
||||||
|
|||||||
Reference in New Issue
Block a user