@@ -12,7 +12,6 @@ import type {
1212 ApiMessageOutgoingStatus ,
1313 ApiPeer ,
1414 ApiReaction ,
15- ApiSponsoredMessage ,
1615 ApiThreadInfo ,
1716 ApiTopic ,
1817 ApiTypeStory ,
@@ -275,7 +274,7 @@ type StateProps = {
275274 isConnected : boolean ;
276275 isLoadingComments ?: boolean ;
277276 shouldWarnAboutSvg ?: boolean ;
278- sponsoredMessage ?: ApiSponsoredMessage ;
277+ hasSponsoredMessage ?: boolean ;
279278} ;
280279
281280type MetaPosition =
@@ -390,7 +389,7 @@ const Message: FC<OwnProps & StateProps> = ({
390389 getIsMessageListReady,
391390 shouldWarnAboutSvg,
392391 onPinnedIntersectionChange,
393- sponsoredMessage ,
392+ hasSponsoredMessage ,
394393} ) => {
395394 const {
396395 toggleMessageSelection,
@@ -736,21 +735,28 @@ const Message: FC<OwnProps & StateProps> = ({
736735 ) ;
737736
738737 const WITH_BOTTOM_ELEMENT_GAP = 5.625 * REM ;
739- const SPONSORED_MESSAGE_GAP = 10 * REM ;
740- const SELECT_MODE_WITH_SPONSORED_GAP = WITH_BOTTOM_ELEMENT_GAP + 10 * REM ;
738+ const SPONSORED_MESSAGE_GAP = 11 * REM ;
739+ const SELECT_MODE_WITH_SPONSORED_GAP = WITH_BOTTOM_ELEMENT_GAP + SPONSORED_MESSAGE_GAP ;
741740
742- const getFocusMagring = ( ) => {
743- if ( messageListType === 'pinned' || ( isInSelectMode && ! sponsoredMessage ) ) return WITH_BOTTOM_ELEMENT_GAP ;
744- if ( ! isInSelectMode && sponsoredMessage ) return SPONSORED_MESSAGE_GAP ;
745- if ( isInSelectMode && sponsoredMessage ) return SELECT_MODE_WITH_SPONSORED_GAP ;
741+ const getFocusMargin = ( ) => {
742+ if ( messageListType === 'pinned' || ( isInSelectMode && ! hasSponsoredMessage ) ) return WITH_BOTTOM_ELEMENT_GAP ;
743+ if ( ! isInSelectMode && hasSponsoredMessage ) return SPONSORED_MESSAGE_GAP ;
744+ if ( isInSelectMode && hasSponsoredMessage ) return SELECT_MODE_WITH_SPONSORED_GAP ;
746745
747746 return undefined ;
748747 } ;
749748
750- useFocusMessage (
751- // eslint-disable-next-line max-len
752- ref , chatId , isFocused , focusDirection , noFocusHighlight , isResizingContainer , isJustAdded , Boolean ( focusedQuote ) , getFocusMagring ( ) ,
753- ) ;
749+ useFocusMessage ( {
750+ elementRef : ref ,
751+ chatId,
752+ isFocused,
753+ focusDirection,
754+ noFocusHighlight,
755+ isResizingContainer,
756+ isJustAdded,
757+ isQuote : Boolean ( focusedQuote ) ,
758+ focusMargin : getFocusMargin ( ) ,
759+ } ) ;
754760
755761 const signature = ( isChannel && message . postAuthorTitle )
756762 || ( ! asForwarded && forwardInfo ?. postAuthorTitle )
@@ -1569,7 +1575,7 @@ export default memo(withGlobal<OwnProps>(
15691575 const hasActiveReactions = Boolean ( reactionMessage && activeReactions [ getMessageKey ( reactionMessage ) ] ?. length ) ;
15701576
15711577 return {
1572- sponsoredMessage : selectSponsoredMessage ( global , chatId ) ,
1578+ hasSponsoredMessage : Boolean ( selectSponsoredMessage ( global , chatId ) ) ,
15731579 theme : selectTheme ( global ) ,
15741580 forceSenderName,
15751581 sender,
0 commit comments