Use minimal replacement class for MessageModel

This commit is contained in:
Scott Nonnenberg
2025-01-10 08:18:32 +10:00
committed by GitHub
parent 6b00cf756e
commit f846678b90
95 changed files with 3919 additions and 4457 deletions

View File

@@ -31,6 +31,8 @@ import { collect } from './iterables';
import { DurationInSeconds } from './durations';
import { sanitizeLinkPreview } from '../services/LinkPreview';
import type { DraftBodyRanges } from '../types/BodyRange';
import { postSaveUpdates } from './cleanup';
import { MessageModel } from '../models/messages';
export async function sendStoryMessage(
listIds: Array<string>,
@@ -308,11 +310,7 @@ export async function sendStoryMessage(
// * Add the message to the conversation
await Promise.all(
distributionListMessages.map(message => {
window.MessageCache.__DEPRECATED$register(
message.id,
new window.Whisper.Message(message),
'sendStoryMessage'
);
window.MessageCache.register(new MessageModel(message));
void ourConversation.addSingleMessage(message, { isJustSent: true });
@@ -320,6 +318,7 @@ export async function sendStoryMessage(
return DataWriter.saveMessage(message, {
forceSave: true,
ourAci: window.textsecure.storage.user.getCheckedAci(),
postSaveUpdates,
});
})
);
@@ -359,11 +358,7 @@ export async function sendStoryMessage(
timestamp: messageAttributes.timestamp,
},
async jobToInsert => {
window.MessageCache.__DEPRECATED$register(
messageAttributes.id,
new window.Whisper.Message(messageAttributes),
'sendStoryMessage'
);
window.MessageCache.register(new MessageModel(messageAttributes));
const conversation =
window.ConversationController.get(conversationId);
void conversation?.addSingleMessage(messageAttributes, {
@@ -377,6 +372,7 @@ export async function sendStoryMessage(
forceSave: true,
jobToInsert,
ourAci: window.textsecure.storage.user.getCheckedAci(),
postSaveUpdates,
});
}
);