Skip to content

Commit

Permalink
Shows message status timestamps if available
Browse files Browse the repository at this point in the history
  • Loading branch information
josh-signal committed Oct 12, 2021
1 parent c9a49ec commit a5e8226
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
4 changes: 4 additions & 0 deletions stylesheets/components/MessageDetail.scss
Expand Up @@ -198,3 +198,7 @@
color: $color-white;
background-color: $color-accent-red;
}

.module-message-detail__status-timestamp {
margin-left: 6px;
}
9 changes: 9 additions & 0 deletions ts/components/conversation/MessageDetail.tsx
Expand Up @@ -19,6 +19,7 @@ import { groupBy } from '../../util/mapUtil';
import { ContactNameColorType } from '../../types/Colors';
import { SendStatus } from '../../messages/MessageSendState';
import * as log from '../../logging/log';
import { Timestamp } from './Timestamp';

export type Contact = Pick<
ConversationType,
Expand All @@ -35,6 +36,7 @@ export type Contact = Pick<
| 'unblurredAvatarPath'
> & {
status?: SendStatus;
statusTimestamp?: number;

isOutgoingKeyError: boolean;
isUnidentifiedDelivery: boolean;
Expand Down Expand Up @@ -182,6 +184,13 @@ export class MessageDetail extends React.Component<Props> {
</div>
{errorComponent}
{unidentifiedDeliveryComponent}
{contact.statusTimestamp && (
<Timestamp
i18n={i18n}
module="module-message-detail__status-timestamp"
timestamp={contact.statusTimestamp}
/>
)}
</div>
);
}
Expand Down
5 changes: 4 additions & 1 deletion ts/models/messages.ts
Expand Up @@ -351,7 +351,9 @@ export class MessageModel extends window.Backbone.Model<MessageAttributesType> {
window.storage.get('unidentifiedDeliveryIndicators', false) &&
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
// is shown read.
Expand All @@ -362,6 +364,7 @@ export class MessageModel extends window.Backbone.Model<MessageAttributesType> {
return {
...findAndFormatContact(id),
status,
statusTimestamp: sendState?.updatedAt,
errors: errorsForContact,
isOutgoingKeyError,
isUnidentifiedDelivery,
Expand Down

0 comments on commit a5e8226

Please sign in to comment.