Checklist: Use title for chat preview (#6242)
This commit is contained in:
parent
f97dd09216
commit
9b8b809d12
@ -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<OwnProps>(
|
||||
(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));
|
||||
|
||||
@ -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');
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user