models/messages.initialize: If no ourConversationId, skip migration

This commit is contained in:
Scott Nonnenberg 2022-06-27 10:27:20 -07:00 committed by GitHub
parent 09124446a6
commit c35f901387
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -226,16 +226,20 @@ export class MessageModel extends window.Backbone.Model<MessageAttributesType> {
); );
} }
const ourConversationId =
window.ConversationController.getOurConversationId();
if (ourConversationId) {
const sendStateByConversationId = migrateLegacySendAttributes( const sendStateByConversationId = migrateLegacySendAttributes(
this.attributes, this.attributes,
window.ConversationController.get.bind(window.ConversationController), window.ConversationController.get.bind(window.ConversationController),
window.ConversationController.getOurConversationIdOrThrow() ourConversationId
); );
if (sendStateByConversationId) { if (sendStateByConversationId) {
this.set('sendStateByConversationId', sendStateByConversationId, { this.set('sendStateByConversationId', sendStateByConversationId, {
silent: true, silent: true,
}); });
} }
}
this.CURRENT_PROTOCOL_VERSION = Proto.DataMessage.ProtocolVersion.CURRENT; this.CURRENT_PROTOCOL_VERSION = Proto.DataMessage.ProtocolVersion.CURRENT;
this.INITIAL_PROTOCOL_VERSION = Proto.DataMessage.ProtocolVersion.INITIAL; this.INITIAL_PROTOCOL_VERSION = Proto.DataMessage.ProtocolVersion.INITIAL;