diff options
author | Joas Schilling <coding@schilljs.com> | 2021-08-23 17:12:20 +0300 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2021-08-23 17:30:02 +0300 |
commit | f700cbc36bf8192843126af02bdf5ff38b639c42 (patch) | |
tree | af8c191cbf8753f0ca012859970240ebbb60b906 /src | |
parent | a58d76c3ae7489cd4dec063d2bd36ca0eb69c3cc (diff) |
Fix event names to kebap-case
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'src')
41 files changed, 115 insertions, 110 deletions
diff --git a/src/App.vue b/src/App.vue index 604eadde3..2aab31fc1 100644 --- a/src/App.vue +++ b/src/App.vue @@ -218,17 +218,17 @@ export default { beforeDestroy() { if (!getCurrentUser()) { - EventBus.$off('shouldRefreshConversations', this.debounceRefreshCurrentConversation) + EventBus.$off('should-refresh-conversations', this.debounceRefreshCurrentConversation) } document.removeEventListener('visibilitychange', this.changeWindowVisibility) }, beforeMount() { if (!getCurrentUser()) { - EventBus.$once('joinedConversation', () => { + EventBus.$once('joined-conversation', () => { this.fixmeDelayedSetupOfGuestUsers() }) - EventBus.$on('shouldRefreshConversations', this.debounceRefreshCurrentConversation) + EventBus.$on('should-refresh-conversations', this.debounceRefreshCurrentConversation) } if (this.$route.name === 'conversation') { @@ -255,7 +255,7 @@ export default { } }) - EventBus.$on('conversationsReceived', (params) => { + EventBus.$on('conversations-received', (params) => { if (this.$route.name === 'conversation' && !this.$store.getters.conversation(this.token)) { if (!params.singleConversation) { @@ -274,7 +274,7 @@ export default { * component each time a new batch of conversations is received and processed in * the store. */ - EventBus.$once('conversationsReceived', () => { + EventBus.$once('conversations-received', () => { if (this.$route.name === 'conversation') { // Adjust the page title once the conversation list is loaded this.setPageTitle(this.getConversationName(this.token), false) @@ -313,7 +313,7 @@ export default { * Fires a global event that tells the whole app that the route has changed. The event * carries the from and to objects as payload */ - EventBus.$emit('routeChange', { from, to }) + EventBus.$emit('route-change', { from, to }) next() } @@ -468,7 +468,7 @@ export default { * Emits a global event that is used in App.vue to update the page title once the * ( if the current route is a conversation and once the conversations are received) */ - EventBus.$emit('conversationsReceived', { + EventBus.$emit('conversations-received', { singleConversation: true, }) } catch (exception) { diff --git a/src/FilesSidebarTabApp.vue b/src/FilesSidebarTabApp.vue index 47c958e1f..77ab24996 100644 --- a/src/FilesSidebarTabApp.vue +++ b/src/FilesSidebarTabApp.vue @@ -200,10 +200,10 @@ export default { // "inCall" flag (which is locally updated when joining and leaving // a call) is currently used. if (loadState('spreed', 'signaling_mode') !== 'internal') { - EventBus.$on('shouldRefreshConversations', OCA.Talk.fetchCurrentConversationWrapper) - EventBus.$on('Signaling::participantListChanged', OCA.Talk.fetchCurrentConversationWrapper) + EventBus.$on('should-refresh-conversations', OCA.Talk.fetchCurrentConversationWrapper) + EventBus.$on('signaling-participant-list-changed', OCA.Talk.fetchCurrentConversationWrapper) } else { - // The "shouldRefreshConversations" event is triggered only when + // The "should-refresh-conversations" event is triggered only when // the external signaling server is used; when the internal // signaling server is used periodic polling has to be used // instead. @@ -212,8 +212,8 @@ export default { }, leaveConversation() { - EventBus.$off('shouldRefreshConversations', OCA.Talk.fetchCurrentConversationWrapper) - EventBus.$off('Signaling::participantListChanged', OCA.Talk.fetchCurrentConversationWrapper) + EventBus.$off('should-refresh-conversations', OCA.Talk.fetchCurrentConversationWrapper) + EventBus.$off('signaling-participant-list-changed', OCA.Talk.fetchCurrentConversationWrapper) window.clearInterval(OCA.Talk.fetchCurrentConversationIntervalId) // TODO: move to store under a special action ? diff --git a/src/PublicShareAuthSidebar.vue b/src/PublicShareAuthSidebar.vue index 1db9a79f6..4a06205f3 100644 --- a/src/PublicShareAuthSidebar.vue +++ b/src/PublicShareAuthSidebar.vue @@ -137,10 +137,10 @@ export default { // "inCall" flag (which is locally updated when joining and leaving // a call) is currently used. if (loadState('spreed', 'signaling_mode') !== 'internal') { - EventBus.$on('shouldRefreshConversations', this.fetchCurrentConversation) - EventBus.$on('Signaling::participantListChanged', this.fetchCurrentConversation) + EventBus.$on('should-refresh-conversations', this.fetchCurrentConversation) + EventBus.$on('signaling-participant-list-changed', this.fetchCurrentConversation) } else { - // The "shouldRefreshConversations" event is triggered only when + // The "should-refresh-conversations" event is triggered only when // the external signaling server is used; when the internal // signaling server is used periodic polling has to be used // instead. diff --git a/src/PublicShareSidebar.vue b/src/PublicShareSidebar.vue index 490e9a083..4d0e0e0cc 100644 --- a/src/PublicShareSidebar.vue +++ b/src/PublicShareSidebar.vue @@ -155,10 +155,10 @@ export default { // "inCall" flag (which is locally updated when joining and leaving // a call) is currently used. if (loadState('spreed', 'signaling_mode') !== 'internal') { - EventBus.$on('shouldRefreshConversations', this.fetchCurrentConversation) - EventBus.$on('Signaling::participantListChanged', this.fetchCurrentConversation) + EventBus.$on('should-refresh-conversations', this.fetchCurrentConversation) + EventBus.$on('signaling-participant-list-changed', this.fetchCurrentConversation) } else { - // The "shouldRefreshConversations" event is triggered only when + // The "should-refresh-conversations" event is triggered only when // the external signaling server is used; when the internal // signaling server is used periodic polling has to be used // instead. diff --git a/src/components/AdminSettings/SignalingServer.vue b/src/components/AdminSettings/SignalingServer.vue index 46f5f607b..0e30a303d 100644 --- a/src/components/AdminSettings/SignalingServer.vue +++ b/src/components/AdminSettings/SignalingServer.vue @@ -118,7 +118,7 @@ export default { methods: { removeServer() { - this.$emit('removeServer', this.index) + this.$emit('remove-server', this.index) }, updateServer(event) { this.$emit('update:server', event.target.value) diff --git a/src/components/AdminSettings/SignalingServers.vue b/src/components/AdminSettings/SignalingServers.vue index 6a3d0acd0..0105341ea 100644 --- a/src/components/AdminSettings/SignalingServers.vue +++ b/src/components/AdminSettings/SignalingServers.vue @@ -65,7 +65,7 @@ :verify.sync="servers[index].verify" :index="index" :loading="loading" - @removeServer="removeServer" + @remove-server="removeServer" @update:server="debounceUpdateServers" @update:verify="debounceUpdateServers" /> </transition-group> diff --git a/src/components/AdminSettings/StunServer.vue b/src/components/AdminSettings/StunServer.vue index e302504fc..51867a57f 100644 --- a/src/components/AdminSettings/StunServer.vue +++ b/src/components/AdminSettings/StunServer.vue @@ -88,7 +88,7 @@ export default { methods: { removeServer() { - this.$emit('removeServer', this.index) + this.$emit('remove-server', this.index) }, update(event) { this.$emit('update:server', event.target.value) diff --git a/src/components/AdminSettings/StunServers.vue b/src/components/AdminSettings/StunServers.vue index 186d9f577..31d2106a1 100644 --- a/src/components/AdminSettings/StunServers.vue +++ b/src/components/AdminSettings/StunServers.vue @@ -46,7 +46,7 @@ :server.sync="servers[index]" :index="index" :loading="loading" - @removeServer="removeServer" + @remove-server="removeServer" @update:server="debounceUpdateServers" /> </transition-group> </ul> diff --git a/src/components/AdminSettings/TurnServer.vue b/src/components/AdminSettings/TurnServer.vue index 09ffd99eb..2b7cfb9ef 100644 --- a/src/components/AdminSettings/TurnServer.vue +++ b/src/components/AdminSettings/TurnServer.vue @@ -300,7 +300,7 @@ export default { }, removeServer() { - this.$emit('removeServer', this.index) + this.$emit('remove-server', this.index) }, updateSchemes(event) { this.$emit('update:schemes', event.target.value) diff --git a/src/components/AdminSettings/TurnServers.vue b/src/components/AdminSettings/TurnServers.vue index 4074ad510..2dc9c6c66 100644 --- a/src/components/AdminSettings/TurnServers.vue +++ b/src/components/AdminSettings/TurnServers.vue @@ -47,7 +47,7 @@ :protocols.sync="servers[index].protocols" :index="index" :loading="loading" - @removeServer="removeServer" + @remove-server="removeServer" @update:schemes="debounceUpdateServers" @update:server="debounceUpdateServers" @update:secret="debounceUpdateServers" diff --git a/src/components/CallView/CallView.vue b/src/components/CallView/CallView.vue index 9606f814c..423eb4ec2 100644 --- a/src/components/CallView/CallView.vue +++ b/src/components/CallView/CallView.vue @@ -398,14 +398,14 @@ export default { this.updateDataFromCallParticipantModels(this.callParticipantModels) }, mounted() { - EventBus.$on('refreshPeerList', this.debounceFetchPeers) + EventBus.$on('refresh-peer-list', this.debounceFetchPeers) callParticipantCollection.on('remove', this._lowerHandWhenParticipantLeaves) subscribe('talk:video:toggled', this.handleToggleVideo) }, beforeDestroy() { - EventBus.$off('refreshPeerList', this.debounceFetchPeers) + EventBus.$off('refresh-peer-list', this.debounceFetchPeers) callParticipantCollection.off('remove', this._lowerHandWhenParticipantLeaves) diff --git a/src/components/CallView/shared/Video.vue b/src/components/CallView/shared/Video.vue index 94b8f9710..13ae60444 100644 --- a/src/components/CallView/shared/Video.vue +++ b/src/components/CallView/shared/Video.vue @@ -226,7 +226,7 @@ export default { peerData() { let peerData = this.$store.getters.getPeer(this.$store.getters.getToken(), this.peerId) if (!peerData.actorId) { - EventBus.$emit('refreshPeerList') + EventBus.$emit('refresh-peer-list') peerData = { actorType: '', actorId: '', diff --git a/src/components/ChatView.vue b/src/components/ChatView.vue index 08fc75886..fc5e16610 100644 --- a/src/components/ChatView.vue +++ b/src/components/ChatView.vue @@ -48,7 +48,7 @@ :is-chat-scrolled-to-bottom="isChatScrolledToBottom" :token="token" :is-visible="isVisible" - @setChatScrolledToBottom="setScrollStatus" /> + @set-chat-scrolled-to-bottom="setScrollStatus" /> <NewMessageForm role="region" :is-chat-scrolled-to-bottom="isChatScrolledToBottom" diff --git a/src/components/ConversationSettings/ConversationSettingsDialog.vue b/src/components/ConversationSettings/ConversationSettingsDialog.vue index dc7f785e3..c9829ae7c 100644 --- a/src/components/ConversationSettings/ConversationSettingsDialog.vue +++ b/src/components/ConversationSettings/ConversationSettingsDialog.vue @@ -36,7 +36,7 @@ :editing="isEditingDescription" :loading="isDescriptionLoading" :placeholder="t('spreed', 'Enter a description for this conversation')" - @submit:description="handleUpdateDescription" + @submit-description="handleUpdateDescription" @update:editing="handleEditDescription" /> </AppSettingsSection> diff --git a/src/components/Description/Description.vue b/src/components/Description/Description.vue index 1d709c6b2..3b7021b8a 100644 --- a/src/components/Description/Description.vue +++ b/src/components/Description/Description.vue @@ -219,7 +219,7 @@ export default { // Remove leading/trailing whitespaces. this.descriptionText = this.descriptionText.replace(/\r\n|\n|\r/gm, '\n').trim() // Submit description - this.$emit('submit:description', this.descriptionText) + this.$emit('submit-description', this.descriptionText) /** * Change the richcontenteditable key in order to trigger a re-render * without this all the trimmed new lines and whitespaces would diff --git a/src/components/LeftSidebar/ConversationsList/ConversationsList.vue b/src/components/LeftSidebar/ConversationsList/ConversationsList.vue index 1ad5fb000..1a60148d6 100644 --- a/src/components/LeftSidebar/ConversationsList/ConversationsList.vue +++ b/src/components/LeftSidebar/ConversationsList/ConversationsList.vue @@ -73,14 +73,14 @@ export default { }, mounted() { - EventBus.$on('routeChange', this.onRouteChange) - EventBus.$once('joinedConversation', ({ token }) => { + EventBus.$on('route-change', this.onRouteChange) + EventBus.$once('joined-conversation', ({ token }) => { this.scrollToConversation(token) }) }, beforeDestroy() { - EventBus.$off('routeChange', this.onRouteChange) + EventBus.$off('route-change', this.onRouteChange) }, methods: { diff --git a/src/components/LeftSidebar/LeftSidebar.spec.js b/src/components/LeftSidebar/LeftSidebar.spec.js index 366377715..c9123c72f 100644 --- a/src/components/LeftSidebar/LeftSidebar.spec.js +++ b/src/components/LeftSidebar/LeftSidebar.spec.js @@ -122,7 +122,7 @@ describe('LeftSidebar.vue', () => { test('fetches and renders conversation list initially', async () => { const conversationsReceivedEvent = jest.fn() - EventBus.$once('conversationsReceived', conversationsReceivedEvent) + EventBus.$once('conversations-received', conversationsReceivedEvent) fetchConversationsAction.mockResolvedValueOnce() const wrapper = mountComponent() @@ -190,7 +190,7 @@ describe('LeftSidebar.vue', () => { expect(fetchConversationsAction).not.toHaveBeenCalled() - EventBus.$emit('shouldRefreshConversations') + EventBus.$emit('should-refresh-conversations') // note: debounce was short-circuited so no delay needed expect(fetchConversationsAction).toHaveBeenCalled() @@ -632,7 +632,7 @@ describe('LeftSidebar.vue', () => { }) test('shows group conversation dialog when clicking search result', async () => { const eventHandler = jest.fn() - EventBus.$once('NewGroupConversationDialog', eventHandler) + EventBus.$once('new-group-conversation-dialog', eventHandler) const wrapper = await testSearch('search', [...groupsResults], []) @@ -649,7 +649,7 @@ describe('LeftSidebar.vue', () => { }) test('shows circles conversation dialog when clicking search result', async () => { const eventHandler = jest.fn() - EventBus.$once('NewGroupConversationDialog', eventHandler) + EventBus.$once('new-group-conversation-dialog', eventHandler) const wrapper = await testSearch('search', [...circlesResults], []) diff --git a/src/components/LeftSidebar/LeftSidebar.vue b/src/components/LeftSidebar/LeftSidebar.vue index 00a79d432..fc12b24fc 100644 --- a/src/components/LeftSidebar/LeftSidebar.vue +++ b/src/components/LeftSidebar/LeftSidebar.vue @@ -259,13 +259,13 @@ export default { } }, 30000) - EventBus.$on('shouldRefreshConversations', this.debounceFetchConversations) + EventBus.$on('should-refresh-conversations', this.debounceFetchConversations) this.mountArrowNavigation() }, beforeDestroy() { - EventBus.$off('shouldRefreshConversations', this.debounceFetchConversations) + EventBus.$off('should-refresh-conversations', this.debounceFetchConversations) this.cancelSearchPossibleConversations() this.cancelSearchPossibleConversations = null @@ -368,19 +368,19 @@ export default { // Create one-to-one conversation directly const conversation = await this.$store.dispatch('createOneToOneConversation', item.id) this.abortSearch() - EventBus.$once('joinedConversation', ({ token }) => { + EventBus.$once('joined-conversation', ({ token }) => { this.$refs.conversationsList.scrollToConversation(token) }) this.$router.push({ name: 'conversation', params: { token: conversation.token } }).catch(err => console.debug(`Error while pushing the new conversation's route: ${err}`)) } else { // For other types we start the conversation creation dialog - EventBus.$emit('NewGroupConversationDialog', item) + EventBus.$emit('new-group-conversation-dialog', item) } }, async joinListedConversation(conversation) { this.abortSearch() - EventBus.$once('joinedConversation', ({ token }) => { + EventBus.$once('joined-conversation', ({ token }) => { this.$refs.conversationsList.scrollToConversation(token) }) // add as temporary item that will refresh after the joining process is complete @@ -410,7 +410,7 @@ export default { handleClickSearchResult(selectedConversationToken) { if (this.searchText !== '') { - EventBus.$once('joinedConversation', ({ token }) => { + EventBus.$once('joined-conversation', ({ token }) => { this.$refs.conversationsList.scrollToConversation(token) }) } @@ -446,7 +446,7 @@ export default { * Emits a global event that is used in App.vue to update the page title once the * ( if the current route is a conversation and once the conversations are received) */ - EventBus.$emit('conversationsReceived', { + EventBus.$emit('conversations-received', { singleConversation: false, }) this.isFetchingConversations = false diff --git a/src/components/LeftSidebar/NewGroupConversation/NewGroupConversation.vue b/src/components/LeftSidebar/NewGroupConversation/NewGroupConversation.vue index c8878799f..dea7bd78d 100644 --- a/src/components/LeftSidebar/NewGroupConversation/NewGroupConversation.vue +++ b/src/components/LeftSidebar/NewGroupConversation/NewGroupConversation.vue @@ -48,7 +48,7 @@ v-if="page === 0"> <SetConversationName v-model="conversationNameInput" - @clickEnter="handleEnter" /> + @click-enter="handleEnter" /> <SetConversationType v-model="isPublic" :conversation-name="conversationName" /> @@ -205,11 +205,11 @@ export default { }, mounted() { - EventBus.$on('NewGroupConversationDialog', this.showModalForItem) + EventBus.$on('new-group-conversation-dialog', this.showModalForItem) }, destroyed() { - EventBus.$off('NewGroupConversationDialog', this.showModalForItem) + EventBus.$off('new-group-conversation-dialog', this.showModalForItem) }, methods: { diff --git a/src/components/LeftSidebar/NewGroupConversation/SetContacts/SetContacts.vue b/src/components/LeftSidebar/NewGroupConversation/SetContacts/SetContacts.vue index bbb30898c..9b9e163ef 100644 --- a/src/components/LeftSidebar/NewGroupConversation/SetContacts/SetContacts.vue +++ b/src/components/LeftSidebar/NewGroupConversation/SetContacts/SetContacts.vue @@ -49,7 +49,7 @@ :scrollable="true" :display-search-hint="displaySearchHint" :selectable="true" - @clickSearchHint="focusInput" /> + @click-search-hint="focusInput" /> </div> </template> diff --git a/src/components/LeftSidebar/NewGroupConversation/SetConversationName/SetConversationName.vue b/src/components/LeftSidebar/NewGroupConversation/SetConversationName/SetConversationName.vue index cb2272b5f..e3108b1a2 100644 --- a/src/components/LeftSidebar/NewGroupConversation/SetConversationName/SetConversationName.vue +++ b/src/components/LeftSidebar/NewGroupConversation/SetConversationName/SetConversationName.vue @@ -56,7 +56,7 @@ export default { }, // Forward the keydown event to the parent handleKeydown() { - this.$emit('clickEnter') + this.$emit('click-enter') }, }, diff --git a/src/components/LeftSidebar/SearchBox/SearchBox.vue b/src/components/LeftSidebar/SearchBox/SearchBox.vue index 50c2d10e1..14e2d0aac 100644 --- a/src/components/LeftSidebar/SearchBox/SearchBox.vue +++ b/src/components/LeftSidebar/SearchBox/SearchBox.vue @@ -85,10 +85,10 @@ export default { /** * Listen to routeChange global events and focus on the input */ - EventBus.$on('routeChange', this.focusInputIfRoot) + EventBus.$on('route-change', this.focusInputIfRoot) }, beforeDestroy() { - EventBus.$off('routeChange', this.focusInputIfRoot) + EventBus.$off('route-change', this.focusInputIfRoot) }, methods: { // Focus the input field of the searchbox component. diff --git a/src/components/MessagesList/MessagesGroup/Message/Message.spec.js b/src/components/MessagesList/MessagesGroup/Message/Message.spec.js index 7a656eb2f..39c54f4f2 100644 --- a/src/components/MessagesList/MessagesGroup/Message/Message.spec.js +++ b/src/components/MessagesList/MessagesGroup/Message/Message.spec.js @@ -1011,7 +1011,7 @@ describe('Message.vue', () => { expect(reloadButtonIcon.exists()).toBe(true) const retryEvent = jest.fn() - EventBus.$on('retryMessage', retryEvent) + EventBus.$on('retry-message', retryEvent) await reloadButtonIcon.trigger('click') diff --git a/src/components/MessagesList/MessagesGroup/Message/Message.vue b/src/components/MessagesList/MessagesGroup/Message/Message.vue index dedf9cc6e..e9e6196d8 100644 --- a/src/components/MessagesList/MessagesGroup/Message/Message.vue +++ b/src/components/MessagesList/MessagesGroup/Message/Message.vue @@ -665,7 +665,7 @@ export default { watch: { showJoinCallButton() { - EventBus.$emit('scrollChatToBottom') + EventBus.$emit('scroll-chat-to-bottom') }, }, @@ -705,8 +705,8 @@ export default { }, handleRetry() { if (this.sendingErrorCanRetry) { - EventBus.$emit('retryMessage', this.id) - EventBus.$emit('focusChatInput') + EventBus.$emit('retry-message', this.id) + EventBus.$emit('focus-chat-input') } }, handleReply() { @@ -722,7 +722,7 @@ export default { messageParameters: this.messageParameters, token: this.token, }) - EventBus.$emit('focusChatInput') + EventBus.$emit('focus-chat-input') }, async handleDelete() { this.isDeleting = true diff --git a/src/components/MessagesList/MessagesList.vue b/src/components/MessagesList/MessagesList.vue index 62143728a..229e7719b 100644 --- a/src/components/MessagesList/MessagesList.vue +++ b/src/components/MessagesList/MessagesList.vue @@ -275,10 +275,10 @@ export default { mounted() { this.viewId = uniqueId('messagesList') this.scrollToBottom() - EventBus.$on('scrollChatToBottom', this.handleScrollChatToBottomEvent) - EventBus.$on('smoothScrollChatToBottom', this.smoothScrollToBottom) - EventBus.$on('focusMessage', this.focusMessage) - EventBus.$on('routeChange', this.onRouteChange) + EventBus.$on('scroll-chat-to-bottom', this.handleScrollChatToBottomEvent) + EventBus.$on('smooth-scroll-chat-to-bottom', this.smoothScrollToBottom) + EventBus.$on('focus-message', this.focusMessage) + EventBus.$on('route-change', this.onRouteChange) subscribe('networkOffline', this.handleNetworkOffline) subscribe('networkOnline', this.handleNetworkOnline) window.addEventListener('focus', this.onWindowFocus) @@ -286,10 +286,10 @@ export default { beforeDestroy() { window.removeEventListener('focus', this.onWindowFocus) - EventBus.$off('scrollChatToBottom', this.handleScrollChatToBottomEvent) - EventBus.$off('smoothScrollChatToBottom', this.smoothScrollToBottom) - EventBus.$off('focusMessage', this.focusMessage) - EventBus.$off('routeChange', this.onRouteChange) + EventBus.$off('scroll-chat-to-bottom', this.handleScrollChatToBottomEvent) + EventBus.$off('smooth-scroll-chat-to-bottom', this.smoothScrollToBottom) + EventBus.$off('focus-message', this.focusMessage) + EventBus.$off('route-change', this.onRouteChange) this.$store.dispatch('cancelLookForNewMessages', { requestId: this.chatIdentifier }) this.destroying = true @@ -880,7 +880,7 @@ export default { }, setChatScrolledToBottom(boolean) { - this.$emit('setChatScrolledToBottom', boolean) + this.$emit('set-chat-scrolled-to-bottom', boolean) if (boolean) { // mark as read if marker was seen // we have to do this early because unfocussing the window will remove the stickiness diff --git a/src/components/NewMessageForm/AdvancedInput/AdvancedInput.vue b/src/components/NewMessageForm/AdvancedInput/AdvancedInput.vue index c54995088..b76317a0c 100644 --- a/src/components/NewMessageForm/AdvancedInput/AdvancedInput.vue +++ b/src/components/NewMessageForm/AdvancedInput/AdvancedInput.vue @@ -240,13 +240,13 @@ export default { /** * Listen to routeChange global events and focus on the */ - EventBus.$on('focusChatInput', this.focusInput) + EventBus.$on('focus-chat-input', this.focusInput) this.atWhoPanelExtraClasses = 'talk candidate-mentions' }, beforeDestroy() { - EventBus.$off('focusChatInput', this.focusInput) + EventBus.$off('focus-chat-input', this.focusInput) }, methods: { diff --git a/src/components/NewMessageForm/AudioRecorder/AudioRecorder.vue b/src/components/NewMessageForm/AudioRecorder/AudioRecorder.vue index 9f68592d8..d40d0ed96 100644 --- a/src/components/NewMessageForm/AudioRecorder/AudioRecorder.vue +++ b/src/components/NewMessageForm/AudioRecorder/AudioRecorder.vue @@ -279,7 +279,7 @@ export default { // Convert blob to file const audioFile = new File([this.blob], fileName) audioFile.localURL = window.URL.createObjectURL(this.blob) - this.$emit('audioFile', audioFile) + this.$emit('audio-file', audioFile) this.$emit('recording', false) } this.resetComponentData() diff --git a/src/components/NewMessageForm/NewMessageForm.vue b/src/components/NewMessageForm/NewMessageForm.vue index ea426b765..2a1933d93 100644 --- a/src/components/NewMessageForm/NewMessageForm.vue +++ b/src/components/NewMessageForm/NewMessageForm.vue @@ -108,7 +108,7 @@ v-if="!hasText && canUploadFiles" :disabled="disabled" @recording="handleRecording" - @audioFile="handleAudioFile" /> + @audio-file="handleAudioFile" /> <button v-else @@ -274,15 +274,15 @@ export default { }, mounted() { - EventBus.$on('uploadStart', this.handleUploadStart) - EventBus.$on('retryMessage', this.handleRetryMessage) + EventBus.$on('upload-start', this.handleUploadStart) + EventBus.$on('retry-message', this.handleRetryMessage) this.text = this.$store.getters.currentMessageInput(this.token) || '' // this.startRecording() }, beforeDestroy() { - EventBus.$off('uploadStart', this.handleUploadStart) - EventBus.$off('retryMessage', this.handleRetryMessage) + EventBus.$off('upload-start', this.handleUploadStart) + EventBus.$off('retry-message', this.handleRetryMessage) }, methods: { @@ -360,7 +360,7 @@ export default { this.text = '' this.parsedText = '' // Scrolls the message list to the last added message - EventBus.$emit('smoothScrollChatToBottom') + EventBus.$emit('smooth-scroll-chat-to-bottom') // Also remove the message to be replied for this conversation this.$store.dispatch('removeMessageToBeReplied', this.token) await this.$store.dispatch('postNewMessage', temporaryMessage) diff --git a/src/components/Quote.vue b/src/components/Quote.vue index 64ac90019..ac2a739f7 100644 --- a/src/components/Quote.vue +++ b/src/components/Quote.vue @@ -226,7 +226,7 @@ export default { }, handleQuoteClick() { - EventBus.$emit('focusMessage', this.parentId) + EventBus.$emit('focus-message', this.parentId) }, }, } diff --git a/src/components/RightSidebar/Participants/ParticipantsList/Participant/Participant.spec.js b/src/components/RightSidebar/Participants/ParticipantsList/Participant/Participant.spec.js index 62afba853..8ed0a391b 100644 --- a/src/components/RightSidebar/Participants/ParticipantsList/Participant/Participant.spec.js +++ b/src/components/RightSidebar/Participants/ParticipantsList/Participant/Participant.spec.js @@ -757,7 +757,7 @@ describe('Participant.vue', () => { test('triggers event when clicking', async () => { const eventHandler = jest.fn() const wrapper = mountParticipant(participant) - wrapper.vm.$on('clickParticipant', eventHandler) + wrapper.vm.$on('click-participant', eventHandler) await wrapper.find('li').trigger('click') @@ -769,7 +769,7 @@ describe('Participant.vue', () => { delete participant.label delete participant.source const wrapper = mountParticipant(participant) - wrapper.vm.$on('clickParticipant', eventHandler) + wrapper.vm.$on('click-participant', eventHandler) await wrapper.find('li').trigger('click') diff --git a/src/components/RightSidebar/Participants/ParticipantsList/Participant/Participant.vue b/src/components/RightSidebar/Participants/ParticipantsList/Participant/Participant.vue index cb3b5a5ce..a11d0a9b7 100644 --- a/src/components/RightSidebar/Participants/ParticipantsList/Participant/Participant.vue +++ b/src/components/RightSidebar/Participants/ParticipantsList/Participant/Participant.vue @@ -462,7 +462,7 @@ export default { // Used to allow selecting participants in a search. handleClick() { if (this.isSearched) { - this.$emit('clickParticipant', this.participant) + this.$emit('click-participant', this.participant) } }, participantTypeIsModerator(participantType) { diff --git a/src/components/RightSidebar/Participants/ParticipantsList/ParticipantsList.vue b/src/components/RightSidebar/Participants/ParticipantsList/ParticipantsList.vue index 00332b34a..4f2762373 100644 --- a/src/components/RightSidebar/Participants/ParticipantsList/ParticipantsList.vue +++ b/src/components/RightSidebar/Participants/ParticipantsList/ParticipantsList.vue @@ -28,7 +28,7 @@ :participant="item" :is-selectable="participantsSelectable" :show-user-status="showUserStatus" - @clickParticipant="handleClickParticipant" /> + @click-participant="handleClickParticipant" /> </ul> <template v-if="loading"> <LoadingParticipant diff --git a/src/components/RightSidebar/Participants/ParticipantsSearchResults/ParticipantsSearchResults.vue b/src/components/RightSidebar/Participants/ParticipantsSearchResults/ParticipantsSearchResults.vue index d2dd08cad..9b5712291 100644 --- a/src/components/RightSidebar/Participants/ParticipantsSearchResults/ParticipantsSearchResults.vue +++ b/src/components/RightSidebar/Participants/ParticipantsSearchResults/ParticipantsSearchResults.vue @@ -233,7 +233,7 @@ export default { }, handleClickHint() { - this.$emit('clickSearchHint') + this.$emit('click-search-hint') }, }, } diff --git a/src/components/RightSidebar/Participants/ParticipantsTab.vue b/src/components/RightSidebar/Participants/ParticipantsTab.vue index 18a7f2727..ba9b59da3 100644 --- a/src/components/RightSidebar/Participants/ParticipantsTab.vue +++ b/src/components/RightSidebar/Participants/ParticipantsTab.vue @@ -135,19 +135,19 @@ export default { }, beforeMount() { - EventBus.$on('routeChange', this.onRouteChange) - EventBus.$on('joinedConversation', this.onJoinedConversation) + EventBus.$on('route-change', this.onRouteChange) + EventBus.$on('joined-conversation', this.onJoinedConversation) // FIXME this works only temporary until signaling is fixed to be only on the calls // Then we have to search for another solution. Maybe the room list which we update // periodically gets a hash of all online sessions? - EventBus.$on('Signaling::participantListChanged', this.debounceUpdateParticipants) + EventBus.$on('signaling-participant-list-changed', this.debounceUpdateParticipants) }, beforeDestroy() { - EventBus.$off('routeChange', this.onRouteChange) - EventBus.$off('joinedConversation', this.onJoinedConversation) - EventBus.$off('Signaling::participantListChanged', this.debounceUpdateParticipants) + EventBus.$off('route-change', this.onRouteChange) + EventBus.$off('joined-conversation', this.onJoinedConversation) + EventBus.$off('signaling-participant-list-changed', this.debounceUpdateParticipants) this.cancelSearchPossibleConversations() this.cancelSearchPossibleConversations = null diff --git a/src/init.js b/src/init.js index 708d7eb9d..3f0f959c5 100644 --- a/src/init.js +++ b/src/init.js @@ -49,7 +49,7 @@ window.OCA.Talk.registerMessageAction = ({ label, callback, icon }) => { store.dispatch('addMessageAction', messageAction) } -EventBus.$on('Signaling::joinRoom', (payload) => { +EventBus.$on('signaling-join-room', (payload) => { const token = payload[0] store.dispatch('updateLastJoinedConversationToken', token) }) diff --git a/src/mixins/isInCall.js b/src/mixins/isInCall.js index 2ca7b8b0e..1a69676c3 100644 --- a/src/mixins/isInCall.js +++ b/src/mixins/isInCall.js @@ -41,11 +41,11 @@ export default { }, beforeDestroy() { - EventBus.$off('joinedConversation', this.readSessionStorageJoinedConversation) + EventBus.$off('joined-conversation', this.readSessionStorageJoinedConversation) }, beforeMount() { - EventBus.$on('joinedConversation', this.readSessionStorageJoinedConversation) + EventBus.$on('joined-conversation', this.readSessionStorageJoinedConversation) this.sessionStorageJoinedConversation = SessionStorage.getItem('joined_conversation') }, diff --git a/src/mixins/sessionIssueHandler.js b/src/mixins/sessionIssueHandler.js index 7e723b719..b19ebc43d 100644 --- a/src/mixins/sessionIssueHandler.js +++ b/src/mixins/sessionIssueHandler.js @@ -32,13 +32,13 @@ const sessionIssueHandler = { }, beforeDestroy() { - EventBus.$off('duplicateSessionDetected', this.duplicateSessionTriggered) - EventBus.$off('deletedSessionDetected', this.deletedSessionTriggered) + EventBus.$off('duplicate-session-detected', this.duplicateSessionTriggered) + EventBus.$off('deleted-session-detected', this.deletedSessionTriggered) }, beforeMount() { - EventBus.$on('duplicateSessionDetected', this.duplicateSessionTriggered) - EventBus.$on('deletedSessionDetected', this.deletedSessionTriggered) + EventBus.$on('duplicate-session-detected', this.duplicateSessionTriggered) + EventBus.$on('deleted-session-detected', this.deletedSessionTriggered) }, methods: { diff --git a/src/store/fileUploadStore.js b/src/store/fileUploadStore.js index b7fd08214..a935b9d6b 100644 --- a/src/store/fileUploadStore.js +++ b/src/store/fileUploadStore.js @@ -262,7 +262,7 @@ const actions = { commit('setCurrentUploadId', undefined) } - EventBus.$emit('uploadStart') + EventBus.$emit('upload-start') // Tag the previously indexed files and add the temporary messages to the // messages list @@ -274,7 +274,7 @@ const actions = { // Add temporary messages (files) to the messages list dispatch('addTemporaryMessage', temporaryMessage) // Scroll the message list - EventBus.$emit('scrollChatToBottom') + EventBus.$emit('scroll-chat-to-bottom') } // Iterate again and perform the uploads for (const index in state.uploads[uploadId].files) { @@ -350,7 +350,7 @@ const actions = { } } } - EventBus.$emit('uploadFinished') + EventBus.$emit('upload-finished') }, /** * Set the folder to store new attachments in diff --git a/src/store/participantsStore.js b/src/store/participantsStore.js index fe6822522..dbf4164dd 100644 --- a/src/store/participantsStore.js +++ b/src/store/participantsStore.js @@ -328,7 +328,7 @@ const actions = { } commit('updateParticipant', { token, index, updatedData }) - EventBus.$once('Signaling::usersInRoom', () => { + EventBus.$once('signaling-users-in-room', () => { commit('finishedConnecting', { token, sessionId: participantIdentifier.sessionId }) }) @@ -398,7 +398,7 @@ const actions = { }) SessionStorage.setItem('joined_conversation', token) - EventBus.$emit('joinedConversation', { token }) + EventBus.$emit('joined-conversation', { token }) return response } catch (error) { if (error?.response?.status === 409 && error?.response?.data?.ocs?.data) { @@ -431,7 +431,7 @@ const actions = { // eslint-disable-next-line no-undef if ($('.oc-dialog-dim').length === 0) { clearInterval(interval) - EventBus.$emit('duplicateSessionDetected') + EventBus.$emit('duplicate-session-detected') window.location = generateUrl('/apps/spreed') } }, 3000) @@ -449,7 +449,7 @@ const actions = { clearInterval(interval) if (!decision) { // Cancel - EventBus.$emit('duplicateSessionDetected') + EventBus.$emit('duplicate-session-detected') window.location = generateUrl('/apps/spreed') } else { // Confirm diff --git a/src/store/participantsStore.spec.js b/src/store/participantsStore.spec.js index 4ba6c39e6..67463ed34 100644 --- a/src/store/participantsStore.spec.js +++ b/src/store/participantsStore.spec.js @@ -374,7 +374,7 @@ describe('participantsStore', () => { expect(store.getters.isConnecting(TOKEN)).toBe(true) - EventBus.$emit('Signaling::usersInRoom') + EventBus.$emit('signaling-users-in-room') expect(store.getters.isInCall(TOKEN)).toBe(true) expect(store.getters.isConnecting(TOKEN)).toBe(false) @@ -423,7 +423,7 @@ describe('participantsStore', () => { expect(store.getters.isConnecting(TOKEN)).toBe(true) - EventBus.$emit('Signaling::usersInRoom') + EventBus.$emit('signaling-users-in-room') expect(store.getters.isInCall(TOKEN)).toBe(true) expect(store.getters.isConnecting(TOKEN)).toBe(false) @@ -469,7 +469,7 @@ describe('participantsStore', () => { beforeEach(() => { joinedConversationEventMock = jest.fn() - EventBus.$once('joinedConversation', joinedConversationEventMock) + EventBus.$once('joined-conversation', joinedConversationEventMock) getParticipantIdentifierMock = jest.fn().mockReturnValue({ attendeeId: 1, diff --git a/src/utils/signaling.js b/src/utils/signaling.js index d44b0722d..7eba45581 100644 --- a/src/utils/signaling.js +++ b/src/utils/signaling.js @@ -132,7 +132,12 @@ Signaling.Base.prototype._trigger = function(ev, args) { } } - EventBus.$emit('Signaling::' + ev, args) + // Convert webrtc event names to kebab-case for "vue/custom-event-name-casing" + const kebabCase = string => string + .replace(/([a-z])([A-Z])/g, '$1-$2') + .replace(/[\s_]+/g, '-') + .toLowerCase() + EventBus.$emit('signaling-' + kebabCase(ev), args) } Signaling.Base.prototype.isNoMcuWarningEnabled = function() { @@ -487,11 +492,11 @@ Signaling.Internal.prototype._startPullingMessages = function() { console.error('Session was killed but the conversation still exists') this._trigger('pullMessagesStoppedOnFail') - EventBus.$emit('duplicateSessionDetected') + EventBus.$emit('duplicate-session-detected') } else if (error?.response?.status === 404 || error?.response?.status === 403) { // Conversation was deleted or the user was removed console.error('Conversation was not found anymore') - EventBus.$emit('deletedSessionDetected') + EventBus.$emit('deleted-session-detected') } else if (token) { if (this.pullMessagesFails === 1) { this.pullMessageErrorToast = showError(t('spreed', 'Lost connection to signaling server. Trying to reconnect.'), { @@ -699,7 +704,7 @@ Signaling.Standalone.prototype.connect = function() { this.nextcloudSessionId = null } else { // TODO(fancycode): Only fetch properties of room that was modified. - EventBus.$emit('shouldRefreshConversations') + EventBus.$emit('should-refresh-conversations') } break case 'event': @@ -1180,7 +1185,7 @@ Signaling.Standalone.prototype.processRoomMessageEvent = function(data) { switch (data.type) { case 'chat': // FIXME this is not listened to - EventBus.$emit('shouldRefreshChatMessages') + EventBus.$emit('should-refresh-chat-messages') break default: console.error('Unknown room message event', data) @@ -1196,13 +1201,13 @@ Signaling.Standalone.prototype.processRoomListEvent = function(data) { return } console.error('User or session was removed from the conversation, redirecting') - EventBus.$emit('deletedSessionDetected') + EventBus.$emit('deleted-session-detected') break } // eslint-disable-next-line no-fallthrough default: console.debug('Room list event', data) - EventBus.$emit('shouldRefreshConversations') + EventBus.$emit('should-refresh-conversations') break } } |