Refactor outbound delivery state, take 2

This reverts commit ad217c808d.
This commit is contained in:
Evan Hahn 2021-07-19 17:44:49 -05:00 committed by GitHub
parent aade43bfa3
commit c4a09b7507
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
24 changed files with 2303 additions and 502 deletions

View file

@ -9,6 +9,7 @@ import { storiesOf } from '@storybook/react';
import { PropsData as MessageDataPropsType } from './Message';
import { MessageDetail, Props } from './MessageDetail';
import { SendStatus } from '../../messages/MessageSendState';
import { getDefaultConversation } from '../../test-both/helpers/getDefaultConversation';
import { setup as setupI18n } from '../../../js/modules/i18n';
import enMessages from '../../../_locales/en/messages.json';
@ -48,7 +49,7 @@ const createProps = (overrideProps: Partial<Props> = {}): Props => ({
}),
isOutgoingKeyError: false,
isUnidentifiedDelivery: false,
status: 'delivered',
status: SendStatus.Delivered,
},
],
errors: overrideProps.errors || [],
@ -116,7 +117,7 @@ story.add('Message Statuses', () => {
}),
isOutgoingKeyError: false,
isUnidentifiedDelivery: false,
status: 'sent',
status: SendStatus.Sent,
},
{
...getDefaultConversation({
@ -125,7 +126,7 @@ story.add('Message Statuses', () => {
}),
isOutgoingKeyError: false,
isUnidentifiedDelivery: false,
status: 'sending',
status: SendStatus.Pending,
},
{
...getDefaultConversation({
@ -134,7 +135,7 @@ story.add('Message Statuses', () => {
}),
isOutgoingKeyError: false,
isUnidentifiedDelivery: false,
status: 'partial-sent',
status: SendStatus.Failed,
},
{
...getDefaultConversation({
@ -143,7 +144,7 @@ story.add('Message Statuses', () => {
}),
isOutgoingKeyError: false,
isUnidentifiedDelivery: false,
status: 'delivered',
status: SendStatus.Delivered,
},
{
...getDefaultConversation({
@ -152,7 +153,7 @@ story.add('Message Statuses', () => {
}),
isOutgoingKeyError: false,
isUnidentifiedDelivery: false,
status: 'read',
status: SendStatus.Read,
},
],
message: {
@ -209,7 +210,7 @@ story.add('All Errors', () => {
}),
isOutgoingKeyError: true,
isUnidentifiedDelivery: false,
status: 'error',
status: SendStatus.Failed,
},
{
...getDefaultConversation({
@ -224,7 +225,7 @@ story.add('All Errors', () => {
],
isOutgoingKeyError: false,
isUnidentifiedDelivery: true,
status: 'error',
status: SendStatus.Failed,
},
{
...getDefaultConversation({
@ -233,7 +234,7 @@ story.add('All Errors', () => {
}),
isOutgoingKeyError: true,
isUnidentifiedDelivery: true,
status: 'error',
status: SendStatus.Failed,
},
],
});

View file

@ -10,7 +10,6 @@ import { Avatar } from '../Avatar';
import { ContactName } from './ContactName';
import {
Message,
MessageStatusType,
Props as MessagePropsType,
PropsData as MessagePropsDataType,
} from './Message';
@ -18,6 +17,7 @@ import { LocalizerType } from '../../types/Util';
import { ConversationType } from '../../state/ducks/conversations';
import { assert } from '../../util/assert';
import { ContactNameColorType } from '../../types/Colors';
import { SendStatus } from '../../messages/MessageSendState';
export type Contact = Pick<
ConversationType,
@ -33,7 +33,7 @@ export type Contact = Pick<
| 'title'
| 'unblurredAvatarPath'
> & {
status: MessageStatusType | null;
status: SendStatus | null;
isOutgoingKeyError: boolean;
isUnidentifiedDelivery: boolean;