From 72348d198ea7b41d36d4d60cb80412492b4c765b Mon Sep 17 00:00:00 2001 From: Audric Ackermann Date: Fri, 30 Sep 2022 11:48:38 +1000 Subject: [PATCH] fix: read receipt on scrolling --- .../message/message-content/MessageAuthorText.tsx | 7 +++++-- .../conversation/message/message-item/ReadableMessage.tsx | 8 ++++---- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/ts/components/conversation/message/message-content/MessageAuthorText.tsx b/ts/components/conversation/message/message-content/MessageAuthorText.tsx index 4f3c6f3b1..89d4a21c2 100644 --- a/ts/components/conversation/message/message-content/MessageAuthorText.tsx +++ b/ts/components/conversation/message/message-content/MessageAuthorText.tsx @@ -1,5 +1,6 @@ import React from 'react'; import { useSelector } from 'react-redux'; +import styled from 'styled-components'; import { MessageRenderingProps } from '../../../../models/messageType'; import { PubKey } from '../../../../session/types'; import { @@ -19,6 +20,8 @@ type Props = { messageId: string; }; +const StyledAuthorContainer = styled(Flex)`color: var(--color-text)`; + export const MessageAuthorText = (props: Props) => { const selected = useSelector(state => getMessageAuthorProps(state as any, props.messageId)); @@ -38,7 +41,7 @@ export const MessageAuthorText = (props: Props) => { const displayedPubkey = authorProfileName ? PubKey.shorten(sender) : sender; return ( - + { boldProfileName={true} shouldShowPubkey={Boolean(isPublic)} /> - + ); }; diff --git a/ts/components/conversation/message/message-item/ReadableMessage.tsx b/ts/components/conversation/message/message-item/ReadableMessage.tsx index bcaaeb966..a57cead51 100644 --- a/ts/components/conversation/message/message-item/ReadableMessage.tsx +++ b/ts/components/conversation/message/message-item/ReadableMessage.tsx @@ -144,17 +144,17 @@ export const ReadableMessage = (props: ReadableMessageProps) => { const found = await Data.getMessageById(messageId); if (found && Boolean(found.get('unread'))) { - const foundReceivedAt = found.get('received_at'); + const foundSentAt = found.get('sent_at'); // mark the message as read. // this will trigger the expire timer. await found.markRead(Date.now()); // we should stack those and send them in a single message once every 5secs or something. // this would be part of an redesign of the sending pipeline - if (foundReceivedAt) { + if (foundSentAt && selectedConversationKey) { void getConversationController() - .get(found.id) - ?.sendReadReceiptsIfNeeded([foundReceivedAt]); + .get(selectedConversationKey) + ?.sendReadReceiptsIfNeeded([foundSentAt]); } } }