fix: Update scroll event name to fix auto-scroll (#4251)

Fixes #3622
This commit is contained in:
Pranav Raj S
2022-03-23 13:27:50 +05:30
committed by GitHub
parent f43018e017
commit 771cb5b9fc
2 changed files with 4 additions and 3 deletions

View File

@@ -4,6 +4,7 @@ import getters, { getSelectedChatConversation } from './getters';
import actions from './actions';
import { findPendingMessageIndex } from './helpers';
import wootConstants from '../../../constants';
import { BUS_EVENTS } from '../../../../shared/constants/busEvents';
const state = {
allConversations: [],
@@ -108,7 +109,7 @@ export const mutations = {
chat.messages.push(message);
chat.timestamp = message.created_at;
if (selectedChatId === conversationId) {
window.bus.$emit('scrollToMessage');
window.bus.$emit(BUS_EVENTS.SCROLL_TO_MESSAGE);
}
}
},
@@ -130,7 +131,7 @@ export const mutations = {
};
Vue.set(allConversations, currentConversationIndex, currentConversation);
if (_state.selectedChatId === conversation.id) {
window.bus.$emit('scrollToMessage');
window.bus.$emit(BUS_EVENTS.SCROLL_TO_MESSAGE);
}
} else {
_state.allConversations.push(conversation);

View File

@@ -120,7 +120,7 @@ describe('#mutations', () => {
timestamp: 1602256198,
},
]);
expect(global.bus.$emit).toHaveBeenCalledWith('scrollToMessage');
expect(global.bus.$emit).toHaveBeenCalledWith('SCROLL_TO_MESSAGE');
});
it('update message if it exist in the store', () => {