Chat List: Allow showing chats with no messages
This commit is contained in:
parent
4b4b9281a7
commit
3591aea8d5
@ -29,6 +29,10 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&:last-of-type {
|
||||||
|
padding-bottom: 0.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
@media (max-width: 600px) {
|
@media (max-width: 600px) {
|
||||||
&.selected {
|
&.selected {
|
||||||
--background-color: var(--color-chat-hover) !important;
|
--background-color: var(--color-chat-hover) !important;
|
||||||
|
|||||||
@ -135,7 +135,7 @@ const Chat: FC<OwnProps & StateProps> = ({
|
|||||||
const { lastMessage, typingStatus } = chat || {};
|
const { lastMessage, typingStatus } = chat || {};
|
||||||
const isAction = lastMessage && isActionMessage(lastMessage);
|
const isAction = lastMessage && isActionMessage(lastMessage);
|
||||||
|
|
||||||
useEnsureMessage(chatId, isAction ? lastMessage!.replyToMessageId : undefined, actionTargetMessage);
|
useEnsureMessage(chatId, isAction ? lastMessage.replyToMessageId : undefined, actionTargetMessage);
|
||||||
|
|
||||||
const mediaThumbnail = lastMessage && !getMessageSticker(lastMessage)
|
const mediaThumbnail = lastMessage && !getMessageSticker(lastMessage)
|
||||||
? getMessageMediaThumbDataUri(lastMessage)
|
? getMessageMediaThumbDataUri(lastMessage)
|
||||||
@ -288,7 +288,7 @@ const Chat: FC<OwnProps & StateProps> = ({
|
|||||||
<span className="colon">:</span>
|
<span className="colon">:</span>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
{renderSummary(lang, lastMessage!, observeIntersection, mediaBlobUrl || mediaThumbnail, isRoundVideo)}
|
{renderSummary(lang, lastMessage, observeIntersection, mediaBlobUrl || mediaThumbnail, isRoundVideo)}
|
||||||
</p>
|
</p>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -391,13 +391,13 @@ function renderSummary(
|
|||||||
export default memo(withGlobal<OwnProps>(
|
export default memo(withGlobal<OwnProps>(
|
||||||
(global, { chatId }): StateProps => {
|
(global, { chatId }): StateProps => {
|
||||||
const chat = selectChat(global, chatId);
|
const chat = selectChat(global, chatId);
|
||||||
if (!chat || !chat.lastMessage) {
|
if (!chat) {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
const { senderId, replyToMessageId, isOutgoing } = chat.lastMessage;
|
const { senderId, replyToMessageId, isOutgoing } = chat.lastMessage || {};
|
||||||
const lastMessageSender = senderId ? selectUser(global, senderId) : undefined;
|
const lastMessageSender = senderId ? selectUser(global, senderId) : undefined;
|
||||||
const lastMessageAction = getMessageAction(chat.lastMessage);
|
const lastMessageAction = chat.lastMessage ? getMessageAction(chat.lastMessage) : undefined;
|
||||||
const actionTargetMessage = lastMessageAction && replyToMessageId
|
const actionTargetMessage = lastMessageAction && replyToMessageId
|
||||||
? selectChatMessage(global, chat.id, replyToMessageId)
|
? selectChatMessage(global, chat.id, replyToMessageId)
|
||||||
: undefined;
|
: undefined;
|
||||||
@ -423,7 +423,9 @@ export default memo(withGlobal<OwnProps>(
|
|||||||
canScrollDown: isSelected && messageListType === 'thread',
|
canScrollDown: isSelected && messageListType === 'thread',
|
||||||
canChangeFolder: (global.chatFolders.orderedIds?.length || 0) > 1,
|
canChangeFolder: (global.chatFolders.orderedIds?.length || 0) > 1,
|
||||||
lastSyncTime: global.lastSyncTime,
|
lastSyncTime: global.lastSyncTime,
|
||||||
...(isOutgoing && { lastMessageOutgoingStatus: selectOutgoingStatus(global, chat.lastMessage) }),
|
...(isOutgoing && chat.lastMessage && {
|
||||||
|
lastMessageOutgoingStatus: selectOutgoingStatus(global, chat.lastMessage),
|
||||||
|
}),
|
||||||
...(privateChatUserId && {
|
...(privateChatUserId && {
|
||||||
user: selectUser(global, privateChatUserId),
|
user: selectUser(global, privateChatUserId),
|
||||||
userStatus: selectUserStatus(global, privateChatUserId),
|
userStatus: selectUserStatus(global, privateChatUserId),
|
||||||
|
|||||||
@ -429,7 +429,7 @@ function buildChatSummary(
|
|||||||
return {
|
return {
|
||||||
id,
|
id,
|
||||||
type,
|
type,
|
||||||
isListed: Boolean(lastMessage && !isRestricted && !isNotJoined && !migratedTo),
|
isListed: Boolean(!isRestricted && !isNotJoined && !migratedTo),
|
||||||
isArchived: folderId === ARCHIVED_FOLDER_ID,
|
isArchived: folderId === ARCHIVED_FOLDER_ID,
|
||||||
isMuted: selectIsChatMuted(chat, notifySettings, notifyExceptions),
|
isMuted: selectIsChatMuted(chat, notifySettings, notifyExceptions),
|
||||||
isUnread: Boolean(unreadCount || unreadMentionsCount || hasUnreadMark),
|
isUnread: Boolean(unreadCount || unreadMentionsCount || hasUnreadMark),
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user