Revert "Refactor outbound delivery state"
This reverts commit 9c48a95eb5
.
This commit is contained in:
parent
77668c3247
commit
ad217c808d
29 changed files with 694 additions and 3197 deletions
|
@ -2,7 +2,6 @@
|
|||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
import { assert } from 'chai';
|
||||
import { SendStatus } from '../../messages/MessageSendState';
|
||||
|
||||
describe('Conversations', () => {
|
||||
async function resetConversationController(): Promise<void> {
|
||||
|
@ -20,9 +19,9 @@ describe('Conversations', () => {
|
|||
|
||||
// Creating a fake conversation
|
||||
const conversation = new window.Whisper.Conversation({
|
||||
id: window.getGuid(),
|
||||
id: '8c45efca-67a4-4026-b990-9537d5d1a08f',
|
||||
e164: '+15551234567',
|
||||
uuid: window.getGuid(),
|
||||
uuid: '2f2734aa-f69d-4c1c-98eb-50eb0fc512d7',
|
||||
type: 'private',
|
||||
inbox_position: 0,
|
||||
isPinned: false,
|
||||
|
@ -34,6 +33,7 @@ describe('Conversations', () => {
|
|||
version: 0,
|
||||
});
|
||||
|
||||
const destinationE164 = '+15557654321';
|
||||
window.textsecure.storage.user.setNumberAndDeviceId(
|
||||
ourNumber,
|
||||
2,
|
||||
|
@ -42,29 +42,27 @@ describe('Conversations', () => {
|
|||
window.textsecure.storage.user.setUuidAndDeviceId(ourUuid, 2);
|
||||
await window.ConversationController.loadPromise();
|
||||
|
||||
await window.Signal.Data.saveConversation(conversation.attributes);
|
||||
|
||||
// Creating a fake message
|
||||
const now = Date.now();
|
||||
let message = new window.Whisper.Message({
|
||||
attachments: [],
|
||||
body: 'bananas',
|
||||
conversationId: conversation.id,
|
||||
delivered: 1,
|
||||
delivered_to: [destinationE164],
|
||||
destination: destinationE164,
|
||||
expirationStartTimestamp: now,
|
||||
hasAttachments: false,
|
||||
hasFileAttachments: false,
|
||||
hasVisualMediaAttachments: false,
|
||||
id: window.getGuid(),
|
||||
id: 'd8f2b435-e2ef-46e0-8481-07e68af251c6',
|
||||
received_at: now,
|
||||
recipients: [destinationE164],
|
||||
sent: true,
|
||||
sent_at: now,
|
||||
sent_to: [destinationE164],
|
||||
timestamp: now,
|
||||
type: 'outgoing',
|
||||
sendStateByConversationId: {
|
||||
[conversation.id]: {
|
||||
status: SendStatus.Sent,
|
||||
updatedAt: now,
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
// Saving to db and updating the convo's last message
|
||||
|
@ -73,7 +71,7 @@ describe('Conversations', () => {
|
|||
Message: window.Whisper.Message,
|
||||
});
|
||||
message = window.MessageController.register(message.id, message);
|
||||
await window.Signal.Data.updateConversation(conversation.attributes);
|
||||
await window.Signal.Data.saveConversation(conversation.attributes);
|
||||
await conversation.updateLastMessage();
|
||||
|
||||
// Should be set to bananas because that's the last message sent.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue