diff --git a/src/api/gramjs/apiBuilders/messages.ts b/src/api/gramjs/apiBuilders/messages.ts index 161e19feb..7909de94c 100644 --- a/src/api/gramjs/apiBuilders/messages.ts +++ b/src/api/gramjs/apiBuilders/messages.ts @@ -191,6 +191,8 @@ export function buildApiMessageWithChatId( const senderBoosts = mtpMessage.fromBoostsApplied; const factCheck = mtpMessage.factcheck && buildApiFactCheck(mtpMessage.factcheck); + const isInvertedMedia = mtpMessage.invertMedia; + const savedPeerId = mtpMessage.savedPeerId && getApiChatIdFromMtpPeer(mtpMessage.savedPeerId); return omitUndefined({ @@ -233,6 +235,7 @@ export function buildApiMessageWithChatId( senderBoosts, viaBusinessBotId: mtpMessage.viaBusinessBotId?.toString(), factCheck, + isInvertedMedia, }); } diff --git a/src/api/types/messages.ts b/src/api/types/messages.ts index 7687f7a7e..75bc279c7 100644 --- a/src/api/types/messages.ts +++ b/src/api/types/messages.ts @@ -606,6 +606,7 @@ export interface ApiMessage { savedPeerId?: string; senderBoosts?: number; factCheck?: ApiFactCheck; + isInvertedMedia?: true; } export interface ApiReactions { diff --git a/src/components/middle/message/Message.scss b/src/components/middle/message/Message.scss index fb7470c92..b006cecf3 100644 --- a/src/components/middle/message/Message.scss +++ b/src/components/middle/message/Message.scss @@ -644,7 +644,7 @@ .message-content { &.has-replies:not(.custom-shape), - &.text:not(.web-page) { + &.has-footer:not(.web-page) { .media-inner, .Album { --border-bottom-left-radius: 0; @@ -652,6 +652,14 @@ } } + &.text.is-inverted-media { + .Album, + .media-inner { + --border-top-left-radius: 0; + --border-top-right-radius: 0; + } + } + &.has-subheader .EmbeddedMessage { & + .Album, & + .Audio, diff --git a/src/components/middle/message/Message.tsx b/src/components/middle/message/Message.tsx index d1a29d1f3..764cebb5c 100644 --- a/src/components/middle/message/Message.tsx +++ b/src/components/middle/message/Message.tsx @@ -671,6 +671,7 @@ const Message: FC = ({ giveawayResults, } = getMessageContent(message); const text = textMessage && getMessageContent(textMessage).text; + const isInvertedMedia = Boolean(message.isInvertedMedia); const { replyToMsgId, replyToPeerId, isQuote } = messageReplyInfo || {}; const { peerId: storyReplyPeerId, storyId: storyReplyId } = storyReplyInfo || {}; @@ -703,6 +704,9 @@ const Message: FC = ({ const withQuickReactionButton = !isTouchScreen && !phoneCall && !isInSelectMode && defaultReaction && !isInDocumentGroupNotLast && !isStoryMention && !hasTtl; + const hasOutsideReactions = hasReactions + && (isCustomShape || ((photo || video || storyData || (location?.type === 'geo')) && !hasText)); + const contentClassName = buildContentClassName(message, album, { hasSubheader, isCustomShape, @@ -716,6 +720,7 @@ const Message: FC = ({ isGeoLiveActive: location?.type === 'geoLive' && !isGeoLiveExpired(message), withVoiceTranscription, peerColorClass: getPeerColorClass(messageColorPeer, noUserColors), + hasOutsideReactions, }); const withAppendix = contentClassName.includes('has-appendix'); @@ -726,7 +731,9 @@ const Message: FC = ({ metaPosition = 'none'; } else if (isInDocumentGroupNotLast) { metaPosition = 'none'; - } else if (hasText && !webPage && !emojiSize) { + } else if (hasText && !webPage && !emojiSize && !isInvertedMedia) { + metaPosition = 'in-text'; + } else if (isInvertedMedia && !emojiSize && (hasFactCheck || webPage)) { metaPosition = 'in-text'; } else { metaPosition = 'standalone'; @@ -734,7 +741,7 @@ const Message: FC = ({ let reactionsPosition!: ReactionsPosition; if (hasReactions) { - if (isCustomShape || ((photo || video || storyData || (location?.type === 'geo')) && !hasText)) { + if (hasOutsideReactions) { reactionsPosition = 'outside'; } else if (asForwarded) { metaPosition = 'standalone'; @@ -992,7 +999,8 @@ const Message: FC = ({ hasSubheader && 'with-subheader', noMediaCorners && 'no-media-corners', ); - const hasCustomAppendix = isLastInGroup && !hasText && !asForwarded && !withCommentButton; + const hasCustomAppendix = isLastInGroup + && (!hasText || (isInvertedMedia && !hasFactCheck && !hasReactions)) && !asForwarded && !withCommentButton; const textContentClass = buildClassName( 'text-content', 'clearfix', @@ -1081,17 +1089,6 @@ const Message: FC = ({ activeEmojiInteractions={activeEmojiInteractions} /> )} - {isAlbum && ( - - )} {phoneCall && ( = ({ chatId={chatId} /> )} - {!isAlbum && photo && ( - - )} {!isAlbum && video && video.isRound && ( = ({ onReadMedia={shouldReadMedia ? handleReadMedia : undefined} /> )} - {!isAlbum && video && !video.isRound && ( -