Replace MessageController with MessageCache

This commit is contained in:
Josh Perez
2023-10-03 20:12:57 -04:00
committed by GitHub
parent ba1a8aad09
commit 7d35216fda
73 changed files with 2237 additions and 1229 deletions

View File

@@ -12,7 +12,6 @@ import type {
ConversationRenderInfoType,
} from './model-types.d';
import type { ConversationModel } from './models/conversations';
import type { MessageModel } from './models/messages';
import dataInterface from './sql/Client';
import * as log from './logging/log';
@@ -1127,13 +1126,11 @@ export class ConversationController {
});
}
log.warn(`${logId}: Update cached messages in MessageController`);
window.MessageController.update((message: MessageModel) => {
if (message.get('conversationId') === obsoleteId) {
message.set({ conversationId: currentId });
}
log.warn(`${logId}: Update cached messages in MessageCache`);
window.MessageCache.replaceAllObsoleteConversationIds({
conversationId: currentId,
obsoleteId,
});
log.warn(`${logId}: Update messages table`);
await migrateConversationMessages(obsoleteId, currentId);