Fix types when creating ephemeral messages for DOE and reactions

This commit is contained in:
Evan Hahn 2021-06-29 16:05:56 -05:00 committed by GitHub
parent f87a3a2cb7
commit dc78165043
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -3184,7 +3184,9 @@ export class ConversationModel extends window.Backbone
timestamp timestamp
); );
const attributes = ({ // We are only creating this model so we can use its sync message
// sending functionality. It will not be saved to the database.
const message = new window.Whisper.Message({
id: window.getGuid(), id: window.getGuid(),
type: 'outgoing', type: 'outgoing',
conversationId: this.get('id'), conversationId: this.get('id'),
@ -3193,16 +3195,9 @@ export class ConversationModel extends window.Backbone
received_at_ms: timestamp, received_at_ms: timestamp,
recipients, recipients,
deletedForEveryoneTimestamp: targetTimestamp, deletedForEveryoneTimestamp: targetTimestamp,
// TODO: DESKTOP-722 timestamp,
} as unknown) as typeof window.Whisper.MessageAttributesType; ...(isDirectConversation(this.attributes) ? { destination } : {}),
});
if (isDirectConversation(this.attributes)) {
attributes.destination = destination;
}
// We are only creating this model so we can use its sync message
// sending functionality. It will not be saved to the database.
const message = new window.Whisper.Message(attributes);
// We're offline! // We're offline!
if (!window.textsecure.messaging) { if (!window.textsecure.messaging) {
@ -3318,7 +3313,9 @@ export class ConversationModel extends window.Backbone
const expireTimer = this.get('expireTimer'); const expireTimer = this.get('expireTimer');
const attributes = ({ // We are only creating this model so we can use its sync message
// sending functionality. It will not be saved to the database.
const message = new window.Whisper.Message({
id: window.getGuid(), id: window.getGuid(),
type: 'outgoing', type: 'outgoing',
conversationId: this.get('id'), conversationId: this.get('id'),
@ -3327,16 +3324,9 @@ export class ConversationModel extends window.Backbone
received_at_ms: timestamp, received_at_ms: timestamp,
recipients, recipients,
reaction: outgoingReaction, reaction: outgoingReaction,
// TODO: DESKTOP-722 timestamp,
} as unknown) as typeof window.Whisper.MessageAttributesType; ...(isDirectConversation(this.attributes) ? { destination } : {}),
});
if (isDirectConversation(this.attributes)) {
attributes.destination = destination;
}
// We are only creating this model so we can use its sync message
// sending functionality. It will not be saved to the database.
const message = new window.Whisper.Message(attributes);
// This is to ensure that the functions in send() and sendSyncMessage() don't save // This is to ensure that the functions in send() and sendSyncMessage() don't save
// anything to the database. // anything to the database.