From 9b8b809d12d87ce23ad18c8e786b52034c675fc4 Mon Sep 17 00:00:00 2001 From: zubiden <19638254+zubiden@users.noreply.github.com> Date: Fri, 19 Sep 2025 14:34:53 +0200 Subject: [PATCH] Checklist: Use title for chat preview (#6242) --- src/components/common/MessageSummary.tsx | 15 ++++++++++----- src/global/helpers/messageSummary.ts | 6 +++++- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/src/components/common/MessageSummary.tsx b/src/components/common/MessageSummary.tsx index 744bc5878..51e7f5823 100644 --- a/src/components/common/MessageSummary.tsx +++ b/src/components/common/MessageSummary.tsx @@ -3,6 +3,7 @@ import { withGlobal } from '../../global'; import type { ApiFormattedText, ApiMessage, ApiPoll, ApiTypeStory, + ApiWebPage, } from '../../api/types'; import type { ObserveFn } from '../../hooks/useIntersectionObserver'; @@ -18,7 +19,7 @@ import { getMessageSummaryText, TRUNCATED_SUMMARY_LENGTH, } from '../../global/helpers/messageSummary'; -import { selectPeerStory, selectPollFromMessage } from '../../global/selectors'; +import { selectPeerStory, selectPollFromMessage, selectWebPageFromMessage } from '../../global/selectors'; import trimText from '../../util/trimText'; import renderText from './helpers/renderText'; @@ -43,19 +44,21 @@ type OwnProps = { type StateProps = { poll?: ApiPoll; story?: ApiTypeStory; + webPage?: ApiWebPage; }; function MessageSummary({ message, translatedText, - noEmoji = false, + noEmoji, highlight, truncateLength = TRUNCATED_SUMMARY_LENGTH, - withTranslucentThumbs = false, - inChatList = false, + withTranslucentThumbs, + inChatList, emojiSize, poll, story, + webPage, observeIntersectionForLoading, observeIntersectionForPlaying, }: OwnProps & StateProps) { @@ -64,7 +67,7 @@ function MessageSummary({ const hasPoll = Boolean(getMessagePollId(message)); const isAction = isActionMessage(message); - const statefulContent = groupStatefulContent({ poll, story }); + const statefulContent = groupStatefulContent({ poll, story, webPage }); if (!extractedText && !hasPoll && !isAction) { const summaryText = translatedText?.text @@ -118,12 +121,14 @@ function MessageSummary({ export default memo(withGlobal( (global, { message }): StateProps => { const poll = selectPollFromMessage(global, message); + const webPage = selectWebPageFromMessage(global, message); const storyData = message.content.storyData; const story = storyData && selectPeerStory(global, storyData.peerId, storyData.id); return { poll, story, + webPage, }; }, )(MessageSummary)); diff --git a/src/global/helpers/messageSummary.ts b/src/global/helpers/messageSummary.ts index 8eb8562a8..70ac572f4 100644 --- a/src/global/helpers/messageSummary.ts +++ b/src/global/helpers/messageSummary.ts @@ -249,7 +249,11 @@ function getSummaryDescription( } if (todo) { - summary = lang('AttachTodo'); + summary = renderTextWithEntities({ + text: todo.todo.title.text, + entities: todo.todo.title.entities, + asPreview: true, + }); } return summary || lang('MessageUnsupported');