Message List: Fix broken layout in service notifications chat
This commit is contained in:
parent
4a397ad233
commit
8870d4138d
@ -20,7 +20,12 @@ import type { Signal } from '../../util/signals';
|
|||||||
import type { PinnedIntersectionChangedCallback } from './hooks/usePinnedMessage';
|
import type { PinnedIntersectionChangedCallback } from './hooks/usePinnedMessage';
|
||||||
import { LoadMoreDirection } from '../../types';
|
import { LoadMoreDirection } from '../../types';
|
||||||
|
|
||||||
import { ANIMATION_END_DELAY, LOCAL_MESSAGE_MIN_ID, MESSAGE_LIST_SLICE } from '../../config';
|
import {
|
||||||
|
ANIMATION_END_DELAY,
|
||||||
|
LOCAL_MESSAGE_MIN_ID,
|
||||||
|
MESSAGE_LIST_SLICE,
|
||||||
|
SERVICE_NOTIFICATIONS_USER_ID,
|
||||||
|
} from '../../config';
|
||||||
import {
|
import {
|
||||||
selectChatMessages,
|
selectChatMessages,
|
||||||
selectIsViewportNewest,
|
selectIsViewportNewest,
|
||||||
@ -127,6 +132,7 @@ type StateProps = {
|
|||||||
lastSyncTime?: number;
|
lastSyncTime?: number;
|
||||||
topic?: ApiTopic;
|
topic?: ApiTopic;
|
||||||
noMessageSendingAnimation?: boolean;
|
noMessageSendingAnimation?: boolean;
|
||||||
|
isServiceNotificationsChat?: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
const MESSAGE_REACTIONS_POLLING_INTERVAL = 15 * 1000;
|
const MESSAGE_REACTIONS_POLLING_INTERVAL = 15 * 1000;
|
||||||
@ -179,6 +185,7 @@ const MessageList: FC<OwnProps & StateProps> = ({
|
|||||||
withDefaultBg,
|
withDefaultBg,
|
||||||
topic,
|
topic,
|
||||||
noMessageSendingAnimation,
|
noMessageSendingAnimation,
|
||||||
|
isServiceNotificationsChat,
|
||||||
onPinnedIntersectionChange,
|
onPinnedIntersectionChange,
|
||||||
getForceNextPinnedInHeader,
|
getForceNextPinnedInHeader,
|
||||||
}) => {
|
}) => {
|
||||||
@ -270,11 +277,15 @@ const MessageList: FC<OwnProps & StateProps> = ({
|
|||||||
|
|
||||||
const listedMessages = viewportIds.map((id) => messagesById[id]).filter(Boolean);
|
const listedMessages = viewportIds.map((id) => messagesById[id]).filter(Boolean);
|
||||||
|
|
||||||
const orderRule: (keyof ApiMessage)[] = type === 'scheduled' ? ['date', 'id'] : ['id'];
|
// Service notifications have local IDs which may be not in sync with real message history
|
||||||
|
const orderRule: (keyof ApiMessage)[] = type === 'scheduled' || isServiceNotificationsChat
|
||||||
|
? ['date', 'id']
|
||||||
|
: ['id'];
|
||||||
|
|
||||||
return listedMessages.length
|
return listedMessages.length
|
||||||
? groupMessages(orderBy(listedMessages, orderRule), memoUnreadDividerBeforeIdRef.current)
|
? groupMessages(orderBy(listedMessages, orderRule), memoUnreadDividerBeforeIdRef.current)
|
||||||
: undefined;
|
: undefined;
|
||||||
}, [messageIds, messagesById, threadFirstMessageId, threadTopMessageId, type]);
|
}, [messageIds, messagesById, threadFirstMessageId, threadTopMessageId, type, isServiceNotificationsChat]);
|
||||||
|
|
||||||
useInterval(() => {
|
useInterval(() => {
|
||||||
if (!messageIds || !messagesById) {
|
if (!messageIds || !messagesById) {
|
||||||
@ -736,6 +747,7 @@ export default memo(withGlobal<OwnProps>(
|
|||||||
lastSyncTime: global.lastSyncTime,
|
lastSyncTime: global.lastSyncTime,
|
||||||
topic,
|
topic,
|
||||||
noMessageSendingAnimation: !selectPerformanceSettingsValue(global, 'messageSendingAnimations'),
|
noMessageSendingAnimation: !selectPerformanceSettingsValue(global, 'messageSendingAnimations'),
|
||||||
|
isServiceNotificationsChat: chatId === SERVICE_NOTIFICATIONS_USER_ID,
|
||||||
...(withLastMessageWhenPreloading && { lastMessage }),
|
...(withLastMessageWhenPreloading && { lastMessage }),
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user