Merge pull request #4015 from overleaf/msm-fix-chat-button-reset

Fixed `resetUnreadMessageCount` used instead of `markMessagesAsRead`

GitOrigin-RevId: 8337afd73d8dff570a289e159847a1f6b4fd2fb2
This commit is contained in:
Miguel Serrano 2021-05-13 12:20:41 +02:00 committed by Copybot
parent 62f3eb493e
commit 1c552cba92

View file

@ -26,7 +26,7 @@ const layoutContextPropTypes = {
}
const chatContextPropTypes = {
resetUnreadMessageCount: PropTypes.func.isRequired,
markMessagesAsRead: PropTypes.func.isRequired,
unreadMessageCount: PropTypes.number.isRequired,
}
@ -55,16 +55,16 @@ function EditorNavigationToolbarRoot({
pdfLayout,
} = useLayoutContext(layoutContextPropTypes)
const { resetUnreadMessageCount, unreadMessageCount } = useChatContext(
const { markMessagesAsRead, unreadMessageCount } = useChatContext(
chatContextPropTypes
)
const toggleChatOpen = useCallback(() => {
if (!chatIsOpen) {
resetUnreadMessageCount()
markMessagesAsRead()
}
setChatIsOpen(value => !value)
}, [chatIsOpen, setChatIsOpen, resetUnreadMessageCount])
}, [chatIsOpen, setChatIsOpen, markMessagesAsRead])
const toggleReviewPanelOpen = useCallback(
() => setReviewPanelOpen(value => !value),