Chat: Fix read chat action (#5774)
Co-authored-by: zubiden <19638254+zubiden@users.noreply.github.com>
This commit is contained in:
parent
9bbad7c202
commit
aef7c39809
@ -14,6 +14,10 @@
|
||||
&.closing {
|
||||
transition: transform 0.2s ease-out, opacity 0.2s ease-out;
|
||||
}
|
||||
|
||||
body.is-macos & {
|
||||
height: 1.375rem;
|
||||
}
|
||||
}
|
||||
|
||||
.ChatBadge-wrapper {
|
||||
|
||||
@ -1178,7 +1178,7 @@ addActionHandler('markChatUnread', (global, actions, payload): ActionReturnType
|
||||
});
|
||||
});
|
||||
|
||||
addActionHandler('markChatRead', async (global, actions, payload): Promise<void> => {
|
||||
addActionHandler('markChatMessagesRead', async (global, actions, payload): Promise<void> => {
|
||||
const { id } = payload;
|
||||
const chat = selectChat(global, id);
|
||||
if (!chat) return;
|
||||
@ -1186,6 +1186,9 @@ addActionHandler('markChatRead', async (global, actions, payload): Promise<void>
|
||||
await callApi('markMessageListRead', { chat, threadId: MAIN_THREAD_ID });
|
||||
actions.readAllMentions({ chatId: id });
|
||||
actions.readAllReactions({ chatId: id });
|
||||
if (chat.hasUnreadMark) {
|
||||
actions.markChatRead({ id });
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1213,6 +1216,17 @@ addActionHandler('markChatRead', async (global, actions, payload): Promise<void>
|
||||
}
|
||||
});
|
||||
|
||||
addActionHandler('markChatRead', (global, actions, payload): ActionReturnType => {
|
||||
const { id } = payload;
|
||||
const chat = selectChat(global, id);
|
||||
if (!chat) return;
|
||||
|
||||
callApi('toggleDialogUnread', {
|
||||
chat,
|
||||
hasUnreadMark: !chat.hasUnreadMark,
|
||||
});
|
||||
});
|
||||
|
||||
addActionHandler('markTopicRead', (global, actions, payload): ActionReturnType => {
|
||||
const { chatId, topicId } = payload;
|
||||
const chat = selectChat(global, chatId);
|
||||
|
||||
@ -368,6 +368,7 @@ export interface ActionPayloads {
|
||||
};
|
||||
markChatUnread: { id: string };
|
||||
markChatRead: { id: string };
|
||||
markChatMessagesRead: { id: string };
|
||||
loadChatFolders: undefined;
|
||||
loadRecommendedChatFolders: undefined;
|
||||
editChatFolder: {
|
||||
|
||||
@ -79,7 +79,7 @@ const useChatContextActions = ({
|
||||
toggleSavedDialogPinned,
|
||||
updateChatMutedState,
|
||||
toggleChatArchived,
|
||||
markChatRead,
|
||||
markChatMessagesRead,
|
||||
markChatUnread,
|
||||
openChatInNewTab,
|
||||
} = getActions();
|
||||
@ -150,7 +150,7 @@ const useChatContextActions = ({
|
||||
}
|
||||
|
||||
const actionMaskAsRead = (chat.unreadCount || chat.hasUnreadMark)
|
||||
? { title: lang('MarkAsRead'), icon: 'readchats', handler: () => markChatRead({ id: chat.id }) }
|
||||
? { title: lang('MarkAsRead'), icon: 'readchats', handler: () => markChatMessagesRead({ id: chat.id }) }
|
||||
: undefined;
|
||||
const actionMarkAsUnread = !(chat.unreadCount || chat.hasUnreadMark) && !chat.isForum
|
||||
? { title: lang('MarkAsUnread'), icon: 'unread', handler: () => markChatUnread({ id: chat.id }) }
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user