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 {
|
&.closing {
|
||||||
transition: transform 0.2s ease-out, opacity 0.2s ease-out;
|
transition: transform 0.2s ease-out, opacity 0.2s ease-out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
body.is-macos & {
|
||||||
|
height: 1.375rem;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.ChatBadge-wrapper {
|
.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 { id } = payload;
|
||||||
const chat = selectChat(global, id);
|
const chat = selectChat(global, id);
|
||||||
if (!chat) return;
|
if (!chat) return;
|
||||||
@ -1186,6 +1186,9 @@ addActionHandler('markChatRead', async (global, actions, payload): Promise<void>
|
|||||||
await callApi('markMessageListRead', { chat, threadId: MAIN_THREAD_ID });
|
await callApi('markMessageListRead', { chat, threadId: MAIN_THREAD_ID });
|
||||||
actions.readAllMentions({ chatId: id });
|
actions.readAllMentions({ chatId: id });
|
||||||
actions.readAllReactions({ chatId: id });
|
actions.readAllReactions({ chatId: id });
|
||||||
|
if (chat.hasUnreadMark) {
|
||||||
|
actions.markChatRead({ id });
|
||||||
|
}
|
||||||
return;
|
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 => {
|
addActionHandler('markTopicRead', (global, actions, payload): ActionReturnType => {
|
||||||
const { chatId, topicId } = payload;
|
const { chatId, topicId } = payload;
|
||||||
const chat = selectChat(global, chatId);
|
const chat = selectChat(global, chatId);
|
||||||
|
|||||||
@ -368,6 +368,7 @@ export interface ActionPayloads {
|
|||||||
};
|
};
|
||||||
markChatUnread: { id: string };
|
markChatUnread: { id: string };
|
||||||
markChatRead: { id: string };
|
markChatRead: { id: string };
|
||||||
|
markChatMessagesRead: { id: string };
|
||||||
loadChatFolders: undefined;
|
loadChatFolders: undefined;
|
||||||
loadRecommendedChatFolders: undefined;
|
loadRecommendedChatFolders: undefined;
|
||||||
editChatFolder: {
|
editChatFolder: {
|
||||||
|
|||||||
@ -79,7 +79,7 @@ const useChatContextActions = ({
|
|||||||
toggleSavedDialogPinned,
|
toggleSavedDialogPinned,
|
||||||
updateChatMutedState,
|
updateChatMutedState,
|
||||||
toggleChatArchived,
|
toggleChatArchived,
|
||||||
markChatRead,
|
markChatMessagesRead,
|
||||||
markChatUnread,
|
markChatUnread,
|
||||||
openChatInNewTab,
|
openChatInNewTab,
|
||||||
} = getActions();
|
} = getActions();
|
||||||
@ -150,7 +150,7 @@ const useChatContextActions = ({
|
|||||||
}
|
}
|
||||||
|
|
||||||
const actionMaskAsRead = (chat.unreadCount || chat.hasUnreadMark)
|
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;
|
: undefined;
|
||||||
const actionMarkAsUnread = !(chat.unreadCount || chat.hasUnreadMark) && !chat.isForum
|
const actionMarkAsUnread = !(chat.unreadCount || chat.hasUnreadMark) && !chat.isForum
|
||||||
? { title: lang('MarkAsUnread'), icon: 'unread', handler: () => markChatUnread({ id: chat.id }) }
|
? { title: lang('MarkAsUnread'), icon: 'unread', handler: () => markChatUnread({ id: chat.id }) }
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user