diff --git a/src/components/common/EmbeddedMessage.tsx b/src/components/common/EmbeddedMessage.tsx index c2bf5bc01..909d153f9 100644 --- a/src/components/common/EmbeddedMessage.tsx +++ b/src/components/common/EmbeddedMessage.tsx @@ -49,7 +49,6 @@ const EmbeddedMessage: FC = ({ const isIntersecting = useIsIntersecting(ref, observeIntersection); const mediaBlobUrl = useMedia(message && getMessageMediaHash(message, 'pictogram'), !isIntersecting); - const pictogramId = message && `sticker-reply-thumb${message.id}`; const mediaThumbnail = useWebpThumbnail(message); const isRoundVideo = Boolean(message && getMessageRoundVideo(message)); @@ -63,7 +62,7 @@ const EmbeddedMessage: FC = ({ className={buildClassName('EmbeddedMessage', className)} onClick={message ? onClick : undefined} > - {mediaThumbnail && renderPictogram(pictogramId, mediaThumbnail, mediaBlobUrl, isRoundVideo, isProtected)} + {mediaThumbnail && renderPictogram(mediaThumbnail, mediaBlobUrl, isRoundVideo, isProtected)}

{!message ? ( @@ -81,7 +80,6 @@ const EmbeddedMessage: FC = ({ }; function renderPictogram( - id: string | undefined, thumbDataUri: string, blobUrl?: string, isRoundVideo?: boolean, @@ -92,7 +90,6 @@ function renderPictogram( return ( <> = ({ return (

diff --git a/src/components/mediaViewer/helpers/ghostAnimation.ts b/src/components/mediaViewer/helpers/ghostAnimation.ts index d61096ea0..b0ca4ac4d 100644 --- a/src/components/mediaViewer/helpers/ghostAnimation.ts +++ b/src/components/mediaViewer/helpers/ghostAnimation.ts @@ -12,6 +12,7 @@ import { import windowSize from '../../../util/windowSize'; import stopEvent from '../../../util/stopEvent'; import { IS_TOUCH_ENV } from '../../../util/environment'; +import { getMessageHtmlId } from '../../../modules/helpers'; const ANIMATION_DURATION = 200; @@ -306,17 +307,17 @@ function getNodes(origin: MediaViewerOrigin, message?: ApiMessage) { switch (origin) { case MediaViewerOrigin.Album: case MediaViewerOrigin.ScheduledAlbum: - containerSelector = `.Transition__slide--active > .MessageList #album-media-${message!.id}`; + containerSelector = `.Transition__slide--active > .MessageList #album-media-${getMessageHtmlId(message!.id)}`; mediaSelector = '.full-media'; break; case MediaViewerOrigin.SharedMedia: - containerSelector = `#shared-media${message!.id}`; + containerSelector = `#shared-media${getMessageHtmlId(message!.id)}`; mediaSelector = 'img'; break; case MediaViewerOrigin.SearchResult: - containerSelector = `#search-media${message!.id}`; + containerSelector = `#search-media${getMessageHtmlId(message!.id)}`; mediaSelector = 'img'; break; @@ -338,7 +339,7 @@ function getNodes(origin: MediaViewerOrigin, message?: ApiMessage) { case MediaViewerOrigin.ScheduledInline: case MediaViewerOrigin.Inline: default: - containerSelector = `.Transition__slide--active > .MessageList #message${message!.id}`; + containerSelector = `.Transition__slide--active > .MessageList #${getMessageHtmlId(message!.id)}`; mediaSelector = '.message-content .full-media, .message-content .thumbnail'; } diff --git a/src/components/middle/ActionMessage.tsx b/src/components/middle/ActionMessage.tsx index ea4f07695..958ef9d6b 100644 --- a/src/components/middle/ActionMessage.tsx +++ b/src/components/middle/ActionMessage.tsx @@ -12,7 +12,7 @@ import { selectIsMessageFocused, selectChat, } from '../../modules/selectors'; -import { isChatChannel } from '../../modules/helpers'; +import { getMessageHtmlId, isChatChannel } from '../../modules/helpers'; import buildClassName from '../../util/buildClassName'; import { renderActionMessageText } from '../common/helpers/renderActionMessageText'; import useEnsureMessage from '../../hooks/useEnsureMessage'; @@ -127,7 +127,7 @@ const ActionMessage: FC = ({ return (
= ({ const isMessageAlbum = isAlbum(messageOrAlbum); const nextMessage = senderGroup[messageIndex + 1]; - if (message.previousLocalId && anchorIdRef.current === `message${message.previousLocalId}`) { - anchorIdRef.current = `message${message.id}`; + if (message.previousLocalId && anchorIdRef.current === getMessageHtmlId(message.previousLocalId)) { + anchorIdRef.current = getMessageHtmlId(message.id); } const documentGroupId = !isMessageAlbum && message.groupedId ? message.groupedId : undefined; diff --git a/src/components/middle/message/Album.tsx b/src/components/middle/message/Album.tsx index 79db5e43d..b32ea0f05 100644 --- a/src/components/middle/message/Album.tsx +++ b/src/components/middle/message/Album.tsx @@ -5,7 +5,7 @@ import { ApiMessage } from '../../../api/types'; import { IAlbum, ISettings } from '../../../types'; import { AlbumRectPart, IAlbumLayout } from './helpers/calculateAlbumLayout'; -import { getMessageContent } from '../../../modules/helpers'; +import { getMessageContent, getMessageHtmlId } from '../../../modules/helpers'; import { getDispatch, getGlobal, withGlobal } from '../../../lib/teact/teactn'; import withSelectControl from './hocs/withSelectControl'; import { ObserveFn } from '../../../hooks/useIntersectionObserver'; @@ -80,7 +80,7 @@ const Album: FC = ({ return ( = ({ } else if (video) { return ( = ({ return (
= ({
{(!isMediaReady || (isVideo && !canDisplayVideo)) && ( = ({ )} {!isLottie && !isVideo && ( = ({ )} {isVideo && canDisplayVideo && isMediaReady && (