Shows message status timestamps if available

This commit is contained in:
Josh Perez 2021-10-12 19:40:42 -04:00 committed by GitHub
parent c9a49ecb4b
commit a5e8226821
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 1 deletions

View file

@ -198,3 +198,7 @@
color: $color-white; color: $color-white;
background-color: $color-accent-red; background-color: $color-accent-red;
} }
.module-message-detail__status-timestamp {
margin-left: 6px;
}

View file

@ -19,6 +19,7 @@ import { groupBy } from '../../util/mapUtil';
import { ContactNameColorType } from '../../types/Colors'; import { ContactNameColorType } from '../../types/Colors';
import { SendStatus } from '../../messages/MessageSendState'; import { SendStatus } from '../../messages/MessageSendState';
import * as log from '../../logging/log'; import * as log from '../../logging/log';
import { Timestamp } from './Timestamp';
export type Contact = Pick< export type Contact = Pick<
ConversationType, ConversationType,
@ -35,6 +36,7 @@ export type Contact = Pick<
| 'unblurredAvatarPath' | 'unblurredAvatarPath'
> & { > & {
status?: SendStatus; status?: SendStatus;
statusTimestamp?: number;
isOutgoingKeyError: boolean; isOutgoingKeyError: boolean;
isUnidentifiedDelivery: boolean; isUnidentifiedDelivery: boolean;
@ -182,6 +184,13 @@ export class MessageDetail extends React.Component<Props> {
</div> </div>
{errorComponent} {errorComponent}
{unidentifiedDeliveryComponent} {unidentifiedDeliveryComponent}
{contact.statusTimestamp && (
<Timestamp
i18n={i18n}
module="module-message-detail__status-timestamp"
timestamp={contact.statusTimestamp}
/>
)}
</div> </div>
); );
} }

View file

@ -351,7 +351,9 @@ export class MessageModel extends window.Backbone.Model<MessageAttributesType> {
window.storage.get('unidentifiedDeliveryIndicators', false) && window.storage.get('unidentifiedDeliveryIndicators', false) &&
this.isUnidentifiedDelivery(id, unidentifiedDeliveriesSet); this.isUnidentifiedDelivery(id, unidentifiedDeliveriesSet);
let status = getOwn(sendStateByConversationId, id)?.status; const sendState = getOwn(sendStateByConversationId, id);
let status = sendState?.status;
// If a message was only sent to yourself (Note to Self or a lonely group), it // If a message was only sent to yourself (Note to Self or a lonely group), it
// is shown read. // is shown read.
@ -362,6 +364,7 @@ export class MessageModel extends window.Backbone.Model<MessageAttributesType> {
return { return {
...findAndFormatContact(id), ...findAndFormatContact(id),
status, status,
statusTimestamp: sendState?.updatedAt,
errors: errorsForContact, errors: errorsForContact,
isOutgoingKeyError, isOutgoingKeyError,
isUnidentifiedDelivery, isUnidentifiedDelivery,