From 228aeb4dd17c89b6698b6d28aea91873147df55c Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Mon, 23 Aug 2021 15:47:50 +0200 Subject: Autofixes Signed-off-by: Joas Schilling --- src/App.vue | 20 ++-- src/FilesSidebarCallViewApp.vue | 4 +- src/components/CallView/shared/VideoBackground.vue | 7 ++ .../ConversationSettings/NotificationsSettings.vue | 1 + .../ConversationsList/Conversation.spec.js | 49 +++++--- .../LeftSidebar/ConversationsList/Conversation.vue | 6 +- src/components/LeftSidebar/LeftSidebar.spec.js | 58 +++++---- src/components/LeftSidebar/LeftSidebar.vue | 2 +- .../NewGroupConversation/NewGroupConversation.vue | 24 ++-- .../SetContacts/SetContacts.vue | 5 +- .../SetConversationType/SetConversationType.vue | 4 +- .../MessagesGroup/Message/Message.spec.js | 51 +++++--- .../Message/MessagePart/FilePreview.spec.js | 50 ++++---- .../Message/MessagePart/Forwarder.vue | 3 +- .../MessagesList/MessagesGroup/MessagesGroup.vue | 15 ++- src/components/MessagesList/MessagesList.spec.js | 3 + src/components/MessagesList/MessagesList.vue | 36 +++--- .../NewMessageForm/AdvancedInput/AdvancedInput.vue | 7 +- src/components/NewMessageForm/NewMessageForm.vue | 9 +- src/components/Quote.vue | 6 +- .../CurrentParticipants/CurrentParticipants.vue | 4 +- .../Participant/Participant.spec.js | 130 +++++++++++++-------- .../ParticipantsList/Participant/Participant.vue | 6 +- .../ParticipantsSearchResults.vue | 3 +- .../RightSidebar/Participants/ParticipantsTab.vue | 3 +- src/components/RightSidebar/RightSidebar.vue | 4 +- src/components/SettingsDialog/SettingsDialog.vue | 2 +- src/deck.js | 7 ++ src/init.js | 5 +- src/main.js | 2 + src/mainFilesSidebar.js | 2 + src/mainPublicShareAuthSidebar.js | 6 + src/mainPublicShareSidebar.js | 9 ++ src/mixins/arrowNavigation.js | 6 + src/mixins/readableNumber.js | 5 +- src/mixins/vueAtReparenter.js | 8 +- src/services/callsService.js | 3 +- src/services/conversationsService.js | 20 ++++ src/services/conversationsService.spec.js | 5 + src/services/filesIntegrationServices.js | 11 +- src/services/filesSharingServices.js | 5 +- src/services/matterbridgeService.js | 3 + src/services/messagesService.js | 7 +- src/services/participantsService.js | 15 +-- src/services/publicShareAuthService.js | 4 +- src/services/settingsService.js | 6 +- src/services/signalingService.js | 7 +- src/store/actorStore.js | 1 + src/store/callViewStore.spec.js | 4 + src/store/conversationsStore.js | 10 +- src/store/conversationsStore.spec.js | 40 +++---- src/store/fileUploadStore.js | 21 ++++ src/store/fileUploadStore.spec.js | 16 +-- src/store/guestNameStore.js | 4 +- src/store/messagesStore.js | 45 +++++-- src/store/messagesStore.spec.js | 100 +++++++++------- src/store/newGroupConversationStore.js | 8 +- src/store/participantsStore.js | 20 +++- src/store/participantsStore.spec.js | 44 ++++--- src/store/sidebarStore.js | 2 + src/store/tokenStore.js | 2 +- src/utils/cancelableRequest.js | 7 +- src/utils/clipboard.js | 6 +- src/utils/fileUpload.js | 19 +-- src/utils/signaling.js | 28 ++++- src/utils/webrtc/MediaDevicesManager.js | 4 +- src/utils/webrtc/index.js | 21 +++- .../webrtc/models/CallParticipantCollection.js | 3 + src/utils/webrtc/models/CallParticipantModel.js | 3 + .../webrtc/models/LocalCallParticipantModel.js | 3 + src/utils/webrtc/models/LocalMediaModel.js | 3 + src/utils/webrtc/simplewebrtc/localmedia.js | 17 ++- src/utils/webrtc/simplewebrtc/peer.js | 16 ++- src/utils/webrtc/simplewebrtc/simplewebrtc.js | 3 + src/utils/webrtc/simplewebrtc/webrtc.js | 3 + src/utils/webrtc/webrtc.js | 83 +++++++++++++ src/views/Dashboard.vue | 3 +- src/views/RoomSelector.spec.js | 8 +- 78 files changed, 833 insertions(+), 362 deletions(-) diff --git a/src/App.vue b/src/App.vue index db7554d2a..604eadde3 100644 --- a/src/App.vue +++ b/src/App.vue @@ -120,7 +120,8 @@ export default { /** * Keeps a list for all last message ids - * @returns {object} Map with token => lastMessageId + * + * @return {object} Map with token => lastMessageId */ lastMessageMap() { const conversationList = this.$store.getters.conversationsList @@ -151,7 +152,7 @@ export default { }, /** - * @returns {boolean} Returns true, if + * @return {boolean} Returns true, if * - a conversation is newly added to lastMessageMap * - a conversation has a different last message id then previously */ @@ -170,7 +171,8 @@ export default { /** * The current conversation token - * @returns {string} The token. + * + * @return {string} The token. */ token() { return this.$store.getters.getToken() @@ -178,7 +180,8 @@ export default { /** * The current conversation - * @returns {object} The conversation object. + * + * @return {object} The conversation object. */ currentConversation() { return this.$store.getters.conversation(this.token) @@ -186,7 +189,8 @@ export default { /** * Computes whether the current conversation is one to one - * @returns {boolean} The result + * + * @return {boolean} The result */ isOneToOne() { return this.currentConversation?.type === CONVERSATION.TYPE.ONE_TO_ONE @@ -316,7 +320,7 @@ export default { /** * Global before guard, this is called whenever a navigation is triggered. - */ + */ Router.beforeEach((to, from, next) => { if (this.warnLeaving && !to.params?.skipLeaveWarning) { OC.dialogs.confirmDestructive( @@ -403,6 +407,7 @@ export default { /** * Set the page title to the conversation name + * * @param {string} title Prefix for the page title e.g. conversation name * @param {boolean} showAsterix Prefix for the page title e.g. conversation name */ @@ -438,8 +443,9 @@ export default { /** * Get a conversation's name. + * * @param {string} token The conversation's token - * @returns {string} The conversation's name + * @return {string} The conversation's name */ getConversationName(token) { if (!this.$store.getters.conversation(token)) { diff --git a/src/FilesSidebarCallViewApp.vue b/src/FilesSidebarCallViewApp.vue index a2972cb5d..7cae59b7e 100644 --- a/src/FilesSidebarCallViewApp.vue +++ b/src/FilesSidebarCallViewApp.vue @@ -90,7 +90,7 @@ export default { * Note that false is returned too when the sidebar is closed, even if * the conversation is active in the current file. * - * @returns {Boolean} true if the sidebar is opened in the file, false + * @return {boolean} true if the sidebar is opened in the file, false * otherwise. */ isInFile() { @@ -130,7 +130,7 @@ export default { * when the FileInfo has been set and it does not match the current * conversation. * - * @param {Object} fileInfo the watched FileInfo + * @param {object} fileInfo the watched FileInfo */ fileInfo(fileInfo) { if (!fileInfo) { diff --git a/src/components/CallView/shared/VideoBackground.vue b/src/components/CallView/shared/VideoBackground.vue index 4be58f58d..9667e35a7 100644 --- a/src/components/CallView/shared/VideoBackground.vue +++ b/src/components/CallView/shared/VideoBackground.vue @@ -40,6 +40,9 @@ import { getBuilder } from '@nextcloud/browser-storage' const browserStorage = getBuilder('nextcloud').persist().build() // note: this info is shared with the Avatar component +/** + * @param userId + */ function getUserHasAvatar(userId) { const flag = browserStorage.getItem('user-has-avatar.' + userId) if (typeof flag === 'string') { @@ -48,6 +51,10 @@ function getUserHasAvatar(userId) { return null } +/** + * @param userId + * @param flag + */ function setUserHasAvatar(userId, flag) { browserStorage.setItem('user-has-avatar.' + userId, flag) } diff --git a/src/components/ConversationSettings/NotificationsSettings.vue b/src/components/ConversationSettings/NotificationsSettings.vue index 52cd07278..2accbbeff 100644 --- a/src/components/ConversationSettings/NotificationsSettings.vue +++ b/src/components/ConversationSettings/NotificationsSettings.vue @@ -133,6 +133,7 @@ export default { methods: { /** * Set the notification level for the conversation + * * @param {int} notificationLevel The notification level to set. */ async setNotificationLevel(notificationLevel) { diff --git a/src/components/LeftSidebar/ConversationsList/Conversation.spec.js b/src/components/LeftSidebar/ConversationsList/Conversation.spec.js index 9a6b41090..7c52ed820 100644 --- a/src/components/LeftSidebar/ConversationsList/Conversation.spec.js +++ b/src/components/LeftSidebar/ConversationsList/Conversation.spec.js @@ -96,6 +96,11 @@ describe('Conversation.vue', () => { }) describe('displayed subtitle', () => { + /** + * @param item + * @param expectedText + * @param isSearchResult + */ function testConversationLabel(item, expectedText, isSearchResult = false) { const wrapper = mount(Conversation, { localVue, @@ -268,6 +273,11 @@ describe('Conversation.vue', () => { }) describe('unread messages counter', () => { + /** + * @param item + * @param expectedCounterText + * @param expectedHighlighted + */ function testCounter(item, expectedCounterText, expectedHighlighted) { const wrapper = mount(Conversation, { localVue, @@ -331,6 +341,10 @@ describe('Conversation.vue', () => { $router = { push: jest.fn() } }) + /** + * @param wrapper + * @param text + */ function findActionButton(wrapper, text) { const actionButtons = wrapper.findAllComponents(ActionButton) const items = actionButtons.filter(actionButton => { @@ -342,6 +356,9 @@ describe('Conversation.vue', () => { return items.at(0) } + /** + * @param actionName + */ function shallowMountAndGetAction(actionName) { const wrapper = shallowMount(Conversation, { localVue, @@ -364,7 +381,7 @@ describe('Conversation.vue', () => { return findActionButton(el, actionName) } - test('forwards click event on list item', async() => { + test('forwards click event on list item', async () => { const wrapper = mount(Conversation, { localVue, store, @@ -386,6 +403,10 @@ describe('Conversation.vue', () => { }) describe('notification level', () => { + /** + * @param actionName + * @param level + */ async function testSetNotificationLevel(actionName, level) { const setNotificationLevelAction = jest.fn().mockResolvedValueOnce() testStoreConfig.modules.conversationsStore.actions.setNotificationLevel = setNotificationLevelAction @@ -398,21 +419,21 @@ describe('Conversation.vue', () => { expect(setNotificationLevelAction).toHaveBeenCalledWith(expect.anything(), { token: TOKEN, notificationLevel: level }) } - test('sets notification to all messages', async() => { + test('sets notification to all messages', async () => { await testSetNotificationLevel('All messages', 1) }) - test('sets notification to at-mentions only', async() => { + test('sets notification to at-mentions only', async () => { await testSetNotificationLevel('@-mentions only', 2) }) - test('sets notification to off', async() => { + test('sets notification to off', async () => { await testSetNotificationLevel('Off', 3) }) }) describe('leaving conversation', () => { - test('leaves conversation', async() => { + test('leaves conversation', async () => { const actionHandler = jest.fn() testStoreConfig.modules.participantsStore.actions.removeCurrentUserFromConversation = actionHandler @@ -424,14 +445,14 @@ describe('Conversation.vue', () => { expect(actionHandler).toHaveBeenCalledWith(expect.anything(), { token: TOKEN }) }) - test('hides "leave conversation" action when not allowed', async() => { + test('hides "leave conversation" action when not allowed', async () => { item.canLeaveConversation = false const action = shallowMountAndGetAction('Leave conversation') expect(action.exists()).toBe(false) }) - test('errors with notification when a new moderator is required before leaving', async() => { + test('errors with notification when a new moderator is required before leaving', async () => { const actionHandler = jest.fn().mockRejectedValueOnce({ response: { status: 400, @@ -450,7 +471,7 @@ describe('Conversation.vue', () => { }) describe('deleting conversation', () => { - test('deletes conversation when confirmed', async() => { + test('deletes conversation when confirmed', async () => { const actionHandler = jest.fn().mockResolvedValueOnce() const updateTokenAction = jest.fn() testStoreConfig.modules.conversationsStore.actions.deleteConversationFromServer = actionHandler @@ -474,7 +495,7 @@ describe('Conversation.vue', () => { expect(updateTokenAction).not.toHaveBeenCalled() }) - test('does not delete conversation when not confirmed', async() => { + test('does not delete conversation when not confirmed', async () => { const actionHandler = jest.fn().mockResolvedValueOnce() const updateTokenAction = jest.fn() testStoreConfig.modules.conversationsStore.actions.deleteConversationFromServer = actionHandler @@ -498,7 +519,7 @@ describe('Conversation.vue', () => { expect(updateTokenAction).not.toHaveBeenCalled() }) - test('hides "delete conversation" action when not allowed', async() => { + test('hides "delete conversation" action when not allowed', async () => { item.canDeleteConversation = false const action = shallowMountAndGetAction('Delete conversation') @@ -506,7 +527,7 @@ describe('Conversation.vue', () => { }) }) - test('copies link conversation', async() => { + test('copies link conversation', async () => { const copyTextMock = jest.fn().mockResolvedValueOnce() const wrapper = shallowMount(Conversation, { localVue, @@ -536,7 +557,7 @@ describe('Conversation.vue', () => { expect(copyTextMock).toHaveBeenCalledWith('http://localhost/nc-webroot/call/XXTOKENXX') expect(showSuccess).toHaveBeenCalled() }) - test('sets favorite', async() => { + test('sets favorite', async () => { const toggleFavoriteAction = jest.fn().mockResolvedValueOnce() testStoreConfig.modules.conversationsStore.actions.toggleFavorite = toggleFavoriteAction @@ -565,7 +586,7 @@ describe('Conversation.vue', () => { expect(toggleFavoriteAction).toHaveBeenCalledWith(expect.anything(), item) }) - test('unsets favorite', async() => { + test('unsets favorite', async () => { const toggleFavoriteAction = jest.fn().mockResolvedValueOnce() testStoreConfig.modules.conversationsStore.actions.toggleFavorite = toggleFavoriteAction @@ -595,7 +616,7 @@ describe('Conversation.vue', () => { expect(toggleFavoriteAction).toHaveBeenCalledWith(expect.anything(), item) }) - test('marks conversation as read', async() => { + test('marks conversation as read', async () => { const clearLastReadMessageAction = jest.fn().mockResolvedValueOnce() testStoreConfig.modules.conversationsStore.actions.clearLastReadMessage = clearLastReadMessageAction diff --git a/src/components/LeftSidebar/ConversationsList/Conversation.vue b/src/components/LeftSidebar/ConversationsList/Conversation.vue index 4f4e79276..a26177fb1 100644 --- a/src/components/LeftSidebar/ConversationsList/Conversation.vue +++ b/src/components/LeftSidebar/ConversationsList/Conversation.vue @@ -281,7 +281,8 @@ export default { * This is a simplified version of the last chat message. * Parameters are parsed without markup (just replaced with the name), * e.g. no avatars on mentions. - * @returns {string} A simple message to show below the conversation name + * + * @return {string} A simple message to show below the conversation name */ simpleLastChatMessage() { if (!Object.keys(this.lastChatMessage).length) { @@ -300,7 +301,7 @@ export default { }, /** - * @returns {string} Part of the name until the first space + * @return {string} Part of the name until the first space */ shortLastChatMessageAuthor() { if (!Object.keys(this.lastChatMessage).length @@ -390,6 +391,7 @@ export default { /** * Set the notification level for the conversation + * * @param {int} level The notification level to set. */ async setNotificationLevel(level) { diff --git a/src/components/LeftSidebar/LeftSidebar.spec.js b/src/components/LeftSidebar/LeftSidebar.spec.js index 99ff95127..366377715 100644 --- a/src/components/LeftSidebar/LeftSidebar.spec.js +++ b/src/components/LeftSidebar/LeftSidebar.spec.js @@ -35,6 +35,9 @@ describe('LeftSidebar.vue', () => { let addConversationAction let createOneToOneConversationAction + /** + * + */ function mountComponent() { return mount(LeftSidebar, { localVue, @@ -117,7 +120,7 @@ describe('LeftSidebar.vue', () => { conversationsListMock.mockImplementation(() => cloneDeep(conversationsList)) }) - test('fetches and renders conversation list initially', async() => { + test('fetches and renders conversation list initially', async () => { const conversationsReceivedEvent = jest.fn() EventBus.$once('conversationsReceived', conversationsReceivedEvent) fetchConversationsAction.mockResolvedValueOnce() @@ -152,7 +155,7 @@ describe('LeftSidebar.vue', () => { }) }) - test('re-fetches conversations every 30 seconds', async() => { + test('re-fetches conversations every 30 seconds', async () => { const wrapper = mountComponent() expect(fetchConversationsAction).toHaveBeenCalled() @@ -174,7 +177,7 @@ describe('LeftSidebar.vue', () => { expect(fetchConversationsAction).toHaveBeenCalled() }) - test('re-fetches conversations when receiving bus event', async() => { + test('re-fetches conversations when receiving bus event', async () => { const wrapper = mountComponent() expect(fetchConversationsAction).toHaveBeenCalled() @@ -275,6 +278,12 @@ describe('LeftSidebar.vue', () => { fetchConversationsAction.mockResolvedValue() }) + /** + * @param searchTerm + * @param possibleResults + * @param listedResults + * @param loadStateSettingsOverride + */ async function testSearch(searchTerm, possibleResults, listedResults, loadStateSettingsOverride) { searchPossibleConversations.mockResolvedValueOnce({ data: { @@ -318,7 +327,7 @@ describe('LeftSidebar.vue', () => { } describe('displaying search results', () => { - test('displays search results when search is active', async() => { + test('displays search results when search is active', async () => { const wrapper = await testSearch( 'search', [...usersResults, ...groupsResults, ...circlesResults], @@ -364,7 +373,7 @@ describe('LeftSidebar.vue', () => { expect(optionsEls.at(1).props('items')).toStrictEqual([groupsResults[0], groupsResults[1]]) expect(optionsEls.at(2).props('items')).toStrictEqual([circlesResults[0], circlesResults[1]]) }) - test('only shows user search results when cannot create conversations', async() => { + test('only shows user search results when cannot create conversations', async () => { const wrapper = await testSearch( 'search', [...usersResults, ...groupsResults, ...circlesResults], @@ -406,7 +415,7 @@ describe('LeftSidebar.vue', () => { expect(optionsEls.at(0).props('items')).toStrictEqual([usersResults[1], usersResults[2]]) expect(optionsEls.length).toBe(1) }) - test('does not show circles results when circles are disabled', async() => { + test('does not show circles results when circles are disabled', async () => { const wrapper = await testSearch( 'search', [...usersResults, ...groupsResults], @@ -453,6 +462,13 @@ describe('LeftSidebar.vue', () => { }) describe('not found caption', () => { + /** + * @param searchTerm + * @param possibleResults + * @param listedResults + * @param loadStateSettingsOverride + * @param expectedCaption + */ async function testSearchNotFound(searchTerm, possibleResults, listedResults, loadStateSettingsOverride, expectedCaption) { const wrapper = await testSearch(searchTerm, possibleResults, listedResults, loadStateSettingsOverride) @@ -482,7 +498,7 @@ describe('LeftSidebar.vue', () => { return wrapper } - test('displays all types in caption when nothing was found', async() => { + test('displays all types in caption when nothing was found', async () => { await testSearchNotFound( 'search', [], @@ -495,7 +511,7 @@ describe('LeftSidebar.vue', () => { ) }) - test('displays all types in caption when only listed conversations were found', async() => { + test('displays all types in caption when only listed conversations were found', async () => { await testSearchNotFound( 'search', [], @@ -508,7 +524,7 @@ describe('LeftSidebar.vue', () => { ) }) - test('displays all types minus circles when nothing was found but circles is disabled', async() => { + test('displays all types minus circles when nothing was found but circles is disabled', async () => { await testSearchNotFound( 'search', [], @@ -521,7 +537,7 @@ describe('LeftSidebar.vue', () => { ) }) - test('displays caption for users and groups not found', async() => { + test('displays caption for users and groups not found', async () => { await testSearchNotFound( 'search', [...circlesResults], @@ -533,7 +549,7 @@ describe('LeftSidebar.vue', () => { 'Users and groups' ) }) - test('displays caption for users not found', async() => { + test('displays caption for users not found', async () => { await testSearchNotFound( 'search', [...circlesResults, ...groupsResults], @@ -545,7 +561,7 @@ describe('LeftSidebar.vue', () => { 'Users' ) }) - test('displays caption for groups not found', async() => { + test('displays caption for groups not found', async () => { await testSearchNotFound( 'search', [...usersResults, ...circlesResults], @@ -557,7 +573,7 @@ describe('LeftSidebar.vue', () => { 'Groups' ) }) - test('displays caption for groups and circles not found', async() => { + test('displays caption for groups and circles not found', async () => { await testSearchNotFound( 'search', [...usersResults], @@ -569,7 +585,7 @@ describe('LeftSidebar.vue', () => { 'Groups and circles' ) }) - test('displays caption for users and circles not found', async() => { + test('displays caption for users and circles not found', async () => { await testSearchNotFound( 'search', [...groupsResults], @@ -584,7 +600,7 @@ describe('LeftSidebar.vue', () => { }) describe('clicking search results', () => { - test('joins listed conversation from search result', async() => { + test('joins listed conversation from search result', async () => { const wrapper = await testSearch('search', [], listedResults) const appNavEl = wrapper.findComponent({ name: 'AppNavigation' }) @@ -597,7 +613,7 @@ describe('LeftSidebar.vue', () => { expect(wrapper.vm.$route.name).toBe('conversation') expect(wrapper.vm.$route.params).toStrictEqual({ token: 'listed-token-2' }) }) - test('creates one to one conversation from user search result', async() => { + test('creates one to one conversation from user search result', async () => { createOneToOneConversationAction.mockResolvedValue({ id: 9999, token: 'new-conversation', @@ -614,7 +630,7 @@ describe('LeftSidebar.vue', () => { expect(wrapper.vm.$route.name).toBe('conversation') expect(wrapper.vm.$route.params).toStrictEqual({ token: 'new-conversation' }) }) - test('shows group conversation dialog when clicking search result', async() => { + test('shows group conversation dialog when clicking search result', async () => { const eventHandler = jest.fn() EventBus.$once('NewGroupConversationDialog', eventHandler) @@ -631,7 +647,7 @@ describe('LeftSidebar.vue', () => { expect(createOneToOneConversationAction).not.toHaveBeenCalled() expect(addConversationAction).not.toHaveBeenCalled() }) - test('shows circles conversation dialog when clicking search result', async() => { + test('shows circles conversation dialog when clicking search result', async () => { const eventHandler = jest.fn() EventBus.$once('NewGroupConversationDialog', eventHandler) @@ -647,7 +663,7 @@ describe('LeftSidebar.vue', () => { // nothing created yet expect(createOneToOneConversationAction).not.toHaveBeenCalled() }) - test('clears search results when joining user chat', async() => { + test('clears search results when joining user chat', async () => { createOneToOneConversationAction.mockResolvedValue({ id: 9999, token: 'new-conversation', @@ -669,7 +685,7 @@ describe('LeftSidebar.vue', () => { expect(searchBoxEl.exists()).toBe(true) expect(input.element.value).toBe('') }) - test('does not clear search results when clicking group chat', async() => { + test('does not clear search results when clicking group chat', async () => { const wrapper = await testSearch('search', [...groupsResults], []) const appNavEl = wrapper.findComponent({ name: 'AppNavigation' }) @@ -710,7 +726,7 @@ describe('LeftSidebar.vue', () => { }) }) - test('shows settings when clicking the settings button', async() => { + test('shows settings when clicking the settings button', async () => { conversationsListMock.mockImplementation(() => []) const eventHandler = jest.fn() subscribe('show-settings', eventHandler) diff --git a/src/components/LeftSidebar/LeftSidebar.vue b/src/components/LeftSidebar/LeftSidebar.vue index 69131e761..00a79d432 100644 --- a/src/components/LeftSidebar/LeftSidebar.vue +++ b/src/components/LeftSidebar/LeftSidebar.vue @@ -358,7 +358,7 @@ export default { * Create a new conversation with the selected user * or bring up the dialog to create a new group/circle conversation * - * @param {Object} item The autocomplete suggestion to start a conversation with + * @param {object} item The autocomplete suggestion to start a conversation with * @param {string} item.id The ID of the target * @param {string} item.label The displayname of the target * @param {string} item.source The source of the target (e.g. users, groups, circle) diff --git a/src/components/LeftSidebar/NewGroupConversation/NewGroupConversation.vue b/src/components/LeftSidebar/NewGroupConversation/NewGroupConversation.vue index df32e225c..c8878799f 100644 --- a/src/components/LeftSidebar/NewGroupConversation/NewGroupConversation.vue +++ b/src/components/LeftSidebar/NewGroupConversation/NewGroupConversation.vue @@ -226,9 +226,11 @@ export default { this.showModal() }, - /** Reinitialise the component to it's initial state. This is necessary + /** + * Reinitialise the component to it's initial state. This is necessary * because once the component is mounted it's data would persist even if - * the modal closes */ + * the modal closes + */ closeModal() { this.modal = false this.page = 0 @@ -251,8 +253,10 @@ export default { handleClickBack() { this.page = 0 }, - /** Handles the creation of the group conversation, adds the seleced - * participants to it and routes to it */ + /** + * Handles the creation of the group conversation, adds the seleced + * participants to it and routes to it + */ async handleCreateConversation() { this.page = 2 @@ -320,16 +324,20 @@ export default { this.closeModal() } }, - /** Creates a new private conversation, adds it to the store and sets - * the local token value to the newly created conversation's token */ + /** + * Creates a new private conversation, adds it to the store and sets + * the local token value to the newly created conversation's token + */ async createPrivateConversation() { const response = await createPrivateConversation(this.conversationName) const conversation = response.data.ocs.data this.$store.dispatch('addConversation', conversation) this.token = conversation.token }, - /** Creates a new public conversation, adds it to the store and sets - * the local token value to the newly created conversation's token */ + /** + * Creates a new public conversation, adds it to the store and sets + * the local token value to the newly created conversation's token + */ async createPublicConversation() { const response = await createPublicConversation(this.conversationName) const conversation = response.data.ocs.data diff --git a/src/components/LeftSidebar/NewGroupConversation/SetContacts/SetContacts.vue b/src/components/LeftSidebar/NewGroupConversation/SetContacts/SetContacts.vue index dfd8f38be..bbb30898c 100644 --- a/src/components/LeftSidebar/NewGroupConversation/SetContacts/SetContacts.vue +++ b/src/components/LeftSidebar/NewGroupConversation/SetContacts/SetContacts.vue @@ -97,8 +97,9 @@ export default { /** * Search hint at the bottom of the participants list, displayed only if * the user is not searching - * @returns {boolean} - **/ + * + * @return {boolean} + */ displaySearchHint() { return !this.contactsLoading && this.searchText === '' }, diff --git a/src/components/LeftSidebar/NewGroupConversation/SetConversationType/SetConversationType.vue b/src/components/LeftSidebar/NewGroupConversation/SetConversationType/SetConversationType.vue index 953151383..efc8fcd86 100644 --- a/src/components/LeftSidebar/NewGroupConversation/SetConversationType/SetConversationType.vue +++ b/src/components/LeftSidebar/NewGroupConversation/SetConversationType/SetConversationType.vue @@ -43,7 +43,9 @@ export default { }, }, methods: { - /** Emits the input event with the checked bulean as a value + /** + * Emits the input event with the checked bulean as a value + * * @param {object} event The checkbox click event object. */ handleInput(event) { diff --git a/src/components/MessagesList/MessagesGroup/Message/Message.spec.js b/src/components/MessagesList/MessagesGroup/Message/Message.spec.js index 0d8547759..7a656eb2f 100644 --- a/src/components/MessagesList/MessagesGroup/Message/Message.spec.js +++ b/src/components/MessagesList/MessagesGroup/Message/Message.spec.js @@ -86,7 +86,7 @@ describe('Message.vue', () => { store = new Vuex.Store(testStoreConfig) }) - test('renders rich text message', async() => { + test('renders rich text message', async () => { const wrapper = shallowMount(Message, { localVue, store, @@ -97,7 +97,7 @@ describe('Message.vue', () => { expect(message.attributes('text')).toBe('test message') }) - test('renders emoji as single plain text', async() => { + test('renders emoji as single plain text', async () => { messageProps.isSingleEmoji = true messageProps.message = '🌧️' const wrapper = shallowMount(Message, { @@ -268,6 +268,11 @@ describe('Message.vue', () => { }) describe('rich objects', () => { + /** + * @param message + * @param messageParameters + * @param expectedRichParameters + */ function renderRichObject(message, messageParameters, expectedRichParameters) { messageProps.message = message messageProps.messageParameters = messageParameters @@ -480,7 +485,7 @@ describe('Message.vue', () => { store = new Vuex.Store(testStoreConfig) }) - test('renders author if first message', async() => { + test('renders author if first message', async () => { messageProps.isFirstMessage = true const wrapper = shallowMount(Message, { localVue, @@ -492,7 +497,7 @@ describe('Message.vue', () => { expect(displayName.text()).toBe('user-display-name-1') }) - test('does not render author if not first message', async() => { + test('does not render author if not first message', async () => { messageProps.isFirstMessage = false const wrapper = shallowMount(Message, { localVue, @@ -512,7 +517,7 @@ describe('Message.vue', () => { store = new Vuex.Store(testStoreConfig) }) - test('does not render actions for system messages are available', async() => { + test('does not render actions for system messages are available', async () => { messageProps.systemMessage = 'this is a system message' const wrapper = shallowMount(Message, { @@ -527,7 +532,7 @@ describe('Message.vue', () => { expect(actionsEl.exists()).toBe(false) }) - test('does not render actions for temporary messages', async() => { + test('does not render actions for temporary messages', async () => { messageProps.isTemporary = true const wrapper = shallowMount(Message, { @@ -542,7 +547,7 @@ describe('Message.vue', () => { expect(actionsEl.exists()).toBe(false) }) - test('actions become visible on mouse over', async() => { + test('actions become visible on mouse over', async () => { messageProps.sendingFailure = 'timeout' const wrapper = shallowMount(Message, { localVue, @@ -573,7 +578,7 @@ describe('Message.vue', () => { }) describe('reply action', () => { - test('replies to message', async() => { + test('replies to message', async () => { const replyAction = jest.fn() testStoreConfig.modules.quoteReplyStore.actions.addMessageToBeReplied = replyAction store = new Vuex.Store(testStoreConfig) @@ -607,7 +612,7 @@ describe('Message.vue', () => { }) }) - test('hides reply button when not replyable', async() => { + test('hides reply button when not replyable', async () => { messageProps.isReplyable = false store = new Vuex.Store(testStoreConfig) @@ -626,7 +631,7 @@ describe('Message.vue', () => { }) describe('private reply action', () => { - test('creates a new conversation when replying to message privately', async() => { + test('creates a new conversation when replying to message privately', async () => { const routerPushMock = jest.fn().mockResolvedValue() const createOneToOneConversation = jest.fn() testStoreConfig.modules.conversationsStore.actions.createOneToOneConversation = createOneToOneConversation @@ -667,6 +672,9 @@ describe('Message.vue', () => { }) }) + /** + * @param visible + */ function testPrivateReplyActionVisible(visible) { store = new Vuex.Store(testStoreConfig) @@ -683,25 +691,25 @@ describe('Message.vue', () => { expect(actionButton.exists()).toBe(visible) } - test('hides private reply action for own messages', async() => { + test('hides private reply action for own messages', async () => { // using default message props which have the // actor id set to the current user testPrivateReplyActionVisible(false) }) - test('hides private reply action for one to one conversation type', async() => { + test('hides private reply action for one to one conversation type', async () => { messageProps.actorId = 'another-user' conversationProps.type = CONVERSATION.TYPE.ONE_TO_ONE testPrivateReplyActionVisible(false) }) - test('hides private reply action for guest messages', async() => { + test('hides private reply action for guest messages', async () => { messageProps.actorId = 'guest-user' messageProps.actorType = ATTENDEE.ACTOR_TYPE.GUESTS testPrivateReplyActionVisible(false) }) - test('hides private reply action when current user is a guest', async() => { + test('hides private reply action when current user is a guest', async () => { messageProps.actorId = 'another-user' getActorTypeMock.mockClear().mockReturnValue(() => ATTENDEE.ACTOR_TYPE.GUESTS) testPrivateReplyActionVisible(false) @@ -709,7 +717,7 @@ describe('Message.vue', () => { }) describe('delete action', () => { - test('deletes message', async() => { + test('deletes message', async () => { let resolveDeleteMessage const deleteMessage = jest.fn().mockReturnValue(new Promise((resolve, reject) => { resolveDeleteMessage = resolve })) testStoreConfig.modules.messagesStore.actions.deleteMessage = deleteMessage @@ -755,6 +763,11 @@ describe('Message.vue', () => { expect(wrapper.find('.icon-loading-small').exists()).toBe(false) }) + /** + * @param visible + * @param mockDate + * @param participantType + */ function testDeleteMessageVisible(visible, mockDate, participantType = PARTICIPANT.TYPE.USER) { store = new Vuex.Store(testStoreConfig) @@ -836,7 +849,7 @@ describe('Message.vue', () => { }) }) - test('marks message as unread', async() => { + test('marks message as unread', async () => { const updateLastReadMessageAction = jest.fn().mockResolvedValueOnce() const fetchConversationAction = jest.fn().mockResolvedValueOnce() testStoreConfig.modules.conversationsStore.actions.updateLastReadMessage = updateLastReadMessageAction @@ -888,7 +901,7 @@ describe('Message.vue', () => { }) }) - test('copies message link', async() => { + test('copies message link', async () => { const copyTextMock = jest.fn() // appears even with more restrictive conditions @@ -926,7 +939,7 @@ describe('Message.vue', () => { expect(copyTextMock).toHaveBeenCalledWith('http://localhost/nc-webroot/call/XXTOKENXX#message_123') }) - test('renders clickable custom actions', async() => { + test('renders clickable custom actions', async () => { const handler = jest.fn() const handler2 = jest.fn() const actionsGetterMock = jest.fn().mockReturnValue([{ @@ -977,7 +990,7 @@ describe('Message.vue', () => { store = new Vuex.Store(testStoreConfig) }) - test('lets user retry sending a timed out message', async() => { + test('lets user retry sending a timed out message', async () => { messageProps.sendingFailure = 'timeout' const wrapper = shallowMount(Message, { localVue, diff --git a/src/components/MessagesList/MessagesGroup/Message/MessagePart/FilePreview.spec.js b/src/components/MessagesList/MessagesGroup/Message/MessagePart/FilePreview.spec.js index b0bf9ba99..cee2cb2ca 100644 --- a/src/components/MessagesList/MessagesGroup/Message/MessagePart/FilePreview.spec.js +++ b/src/components/MessagesList/MessagesGroup/Message/MessagePart/FilePreview.spec.js @@ -57,12 +57,15 @@ describe('FilePreview.vue', () => { window.devicePixelRatio = oldPixelRatio }) + /** + * @param url + */ function parseRelativeUrl(url) { return new URL('https://localhost' + url) } describe('file preview rendering', () => { - test('renders file preview', async() => { + test('renders file preview', async () => { const wrapper = shallowMount(FilePreview, { localVue, store, @@ -82,7 +85,7 @@ describe('FilePreview.vue', () => { expect(wrapper.find('.loading').exists()).toBe(false) }) - test('renders file preview for guests', async() => { + test('renders file preview for guests', async () => { propsData.link = 'https://localhost/nc-webroot/s/xtokenx' getUserIdMock.mockClear().mockReturnValue(null) @@ -105,7 +108,7 @@ describe('FilePreview.vue', () => { expect(wrapper.find('.loading').exists()).toBe(false) }) - test('calculates preview size based on window pixel ratio', async() => { + test('calculates preview size based on window pixel ratio', async () => { window.devicePixelRatio = 1.5 const wrapper = shallowMount(FilePreview, { @@ -121,7 +124,7 @@ describe('FilePreview.vue', () => { expect(imageUrl.searchParams.get('y')).toBe('576') }) - test('renders small previews when requested', async() => { + test('renders small previews when requested', async () => { propsData.smallPreview = true const wrapper = shallowMount(FilePreview, { @@ -146,7 +149,7 @@ describe('FilePreview.vue', () => { store = new Vuex.Store(testStoreConfig) }) - test('renders progress bar while uploading', async() => { + test('renders progress bar while uploading', async () => { propsData.id = 'temp-123' propsData.index = 'index-1' propsData.uploadId = 1000 @@ -185,7 +188,7 @@ describe('FilePreview.vue', () => { expect(wrapper.find('.loading').exists()).toBe(true) }) - test('renders default mime icon on load error', async() => { + test('renders default mime icon on load error', async () => { const wrapper = shallowMount(FilePreview, { localVue, store, @@ -199,7 +202,7 @@ describe('FilePreview.vue', () => { expect(imageUrl).toBe(imagePath('core', 'filetypes/file')) }) - test('renders generic mime type icon for unknown mime types', async() => { + test('renders generic mime type icon for unknown mime types', async () => { propsData.previewAvailable = 'no' OC.MimeType.getIconUrl.mockReturnValueOnce(imagePath('core', 'image/jpeg')) @@ -239,7 +242,7 @@ describe('FilePreview.vue', () => { return null }) }) - test('directly renders small GIF files', async() => { + test('directly renders small GIF files', async () => { propsData.size = 128 const wrapper = shallowMount(FilePreview, { @@ -255,7 +258,7 @@ describe('FilePreview.vue', () => { .toBe(generateRemoteUrl('dav/files/current-user-id') + '/path/to/test%20%2520.gif') }) - test('directly renders small GIF files (absolute path)', async() => { + test('directly renders small GIF files (absolute path)', async () => { propsData.size = 128 propsData.path = '/path/to/test %20.gif' @@ -272,7 +275,7 @@ describe('FilePreview.vue', () => { .toBe(generateRemoteUrl('dav/files/current-user-id') + '/path/to/test%20%2520.gif') }) - test('directly renders small GIF files for guests', async() => { + test('directly renders small GIF files for guests', async () => { propsData.size = 128 propsData.link = 'https://localhost/nc-webroot/s/xtokenx' getUserIdMock.mockClear().mockReturnValue(null) @@ -290,7 +293,7 @@ describe('FilePreview.vue', () => { .toBe(propsData.link + '/download/test%20%2520.gif') }) - test('renders static preview for big GIF files', async() => { + test('renders static preview for big GIF files', async () => { // bigger than max from capability propsData.size = 2048 @@ -345,7 +348,7 @@ describe('FilePreview.vue', () => { } }) - test('opens viewer when clicking if viewer available', async() => { + test('opens viewer when clicking if viewer available', async () => { OCA.Viewer = { open: jest.fn(), availableHandlers: [{ @@ -377,7 +380,7 @@ describe('FilePreview.vue', () => { expect(OCA.Files.Sidebar.state.file).toBe('/path/to/test.jpg') }) - test('does not open viewer when clicking if no mime handler available', async() => { + test('does not open viewer when clicking if no mime handler available', async () => { OCA.Viewer = { open: jest.fn(), availableHandlers: [{ @@ -398,7 +401,7 @@ describe('FilePreview.vue', () => { expect(OCA.Viewer.open).not.toHaveBeenCalled() }) - test('does not open viewer when clicking if viewer is not available', async() => { + test('does not open viewer when clicking if viewer is not available', async () => { delete OCA.Viewer const wrapper = shallowMount(FilePreview, { localVue, @@ -427,6 +430,9 @@ describe('FilePreview.vue', () => { } }) + /** + * @param visible + */ async function testPlayButtonVisible(visible) { const wrapper = shallowMount(FilePreview, { localVue, @@ -440,11 +446,11 @@ describe('FilePreview.vue', () => { expect(buttonEl.exists()).toBe(visible) } - test('renders play icon for video previews', async() => { + test('renders play icon for video previews', async () => { await testPlayButtonVisible(true) }) - test('does not render play icon for direct renders', async() => { + test('does not render play icon for direct renders', async () => { // gif is directly rendered propsData.mimetype = 'image/gif' propsData.name = 'test.gif' @@ -453,7 +459,7 @@ describe('FilePreview.vue', () => { await testPlayButtonVisible(false) }) - test('render play icon gif previews with big size', async() => { + test('render play icon gif previews with big size', async () => { // gif is directly rendered propsData.mimetype = 'image/gif' propsData.name = 'test.gif' @@ -463,12 +469,12 @@ describe('FilePreview.vue', () => { await testPlayButtonVisible(true) }) - test('does not render play icon for small previews', async() => { + test('does not render play icon for small previews', async () => { propsData.smallPreview = true await testPlayButtonVisible(false) }) - test('does not render play icon for failed videos', async() => { + test('does not render play icon for failed videos', async () => { const wrapper = shallowMount(FilePreview, { localVue, store, @@ -481,12 +487,12 @@ describe('FilePreview.vue', () => { expect(buttonEl.exists()).toBe(false) }) - test('does not render play icon if viewer not available', async() => { + test('does not render play icon if viewer not available', async () => { delete OCA.Viewer await testPlayButtonVisible(false) }) - test('does not render play icon for non-videos', async() => { + test('does not render play icon for non-videos', async () => { // viewer supported, but not a video propsData.mimetype = 'image/png' propsData.name = 'test.png' @@ -501,7 +507,7 @@ describe('FilePreview.vue', () => { beforeEach(() => { propsData.isUploadEditor = true }) - test('emits event when clicking remove button when inside upload editor', async() => { + test('emits event when clicking remove button when inside upload editor', async () => { const wrapper = shallowMount(FilePreview, { localVue, store, diff --git a/src/components/MessagesList/MessagesGroup/Message/MessagePart/Forwarder.vue b/src/components/MessagesList/MessagesGroup/Message/MessagePart/Forwarder.vue index ffd8daea6..e62a1539c 100644 --- a/src/components/MessagesList/MessagesGroup/Message/MessagePart/Forwarder.vue +++ b/src/components/MessagesList/MessagesGroup/Message/MessagePart/Forwarder.vue @@ -103,7 +103,8 @@ export default { /** * Object containing all the mentions in the message that will be forwarded - * @returns {Object} mentions. + * + * @return {object} mentions. */ mentions() { const mentions = {} diff --git a/src/components/MessagesList/MessagesGroup/MessagesGroup.vue b/src/components/MessagesList/MessagesGroup/MessagesGroup.vue index 9c77b34e8..64492cdc8 100644 --- a/src/components/MessagesList/MessagesGroup/MessagesGroup.vue +++ b/src/components/MessagesList/MessagesGroup/MessagesGroup.vue @@ -112,28 +112,32 @@ export default { computed: { /** * The message actor type. - * @returns {string} + * + * @return {string} */ actorType() { return this.messages[0].actorType }, /** * The message actor id. - * @returns {string} + * + * @return {string} */ actorId() { return this.messages[0].actorId }, /** * The message date. - * @returns {string} + * + * @return {string} */ dateSeparator() { return this.messages[0].dateSeparator || '' }, /** * The message actor display name. - * @returns {string} + * + * @return {string} */ actorDisplayName() { const displayName = this.messages[0].actorDisplayName.trim() @@ -150,7 +154,8 @@ export default { }, /** * Whether the given message is a system message - * @returns {bool} + * + * @return {bool} */ isSystemMessage() { return this.messages[0].systemMessage.length !== 0 diff --git a/src/components/MessagesList/MessagesList.spec.js b/src/components/MessagesList/MessagesList.spec.js index d9f0f2fa5..22d6a3e53 100644 --- a/src/components/MessagesList/MessagesList.spec.js +++ b/src/components/MessagesList/MessagesList.spec.js @@ -286,6 +286,9 @@ describe('MessagesList.vue', () => { expect(messagesListMock).toHaveBeenCalledWith(TOKEN) }) + /** + * @param messages + */ function testNotGrouped(messages) { messagesListMock.mockReturnValue(messages) diff --git a/src/components/MessagesList/MessagesList.vue b/src/components/MessagesList/MessagesList.vue index cfafc4a07..62143728a 100644 --- a/src/components/MessagesList/MessagesList.vue +++ b/src/components/MessagesList/MessagesList.vue @@ -147,7 +147,7 @@ export default { /** * Finds the first visual unread message element * - * @returns {object} DOM element of the first unread message + * @return {object} DOM element of the first unread message */ unreadMessageElement() { let el = document.getElementById('message_' + this.visualLastReadMessageId) @@ -162,7 +162,7 @@ export default { * Gets the messages array. We need this because the DynamicScroller needs an array to * loop through. * - * @returns {array} + * @return {Array} */ messagesList() { return this.$store.getters.messagesList(this.token) @@ -172,7 +172,7 @@ export default { * corresponds to the id of the message, and makes it easy and efficient to access the * individual message object. * - * @returns {object} + * @return {object} */ messages() { // FIXME: remove if unused ? @@ -180,7 +180,8 @@ export default { }, /** * Creates an array of messages grouped in nested arrays by same autor. - * @returns {array} + * + * @return {Array} */ messagesGroupedByAuthor() { const groups = [] @@ -211,7 +212,8 @@ export default { * When isSticky is true, as new messages are appended to the list, the div .scroller * automatically scrolls down to the last message, if it's false, new messages are * appended but the scrolling position is not altered. - * @returns {boolean} + * + * @return {boolean} */ isSticky() { return this.isChatScrolledToBottom @@ -221,7 +223,7 @@ export default { * Returns whether the current participant is a participant of the * current conversation or not. * - * @returns {Boolean} true if it is already a participant, false + * @return {boolean} true if it is already a participant, false * otherwise. */ isParticipant() { @@ -314,7 +316,7 @@ export default { * @param {string} message2.actorDisplayName Actor display name of previous message * @param {string} message2.systemMessage System message content of the previous message * @param {int} message2.timestamp Timestamp of the second message - * @returns {boolean} Boolean if the messages should be grouped or not + * @return {boolean} Boolean if the messages should be grouped or not */ messagesShouldBeGrouped(message1, message2) { if (!message2) { @@ -354,7 +356,7 @@ export default { * @param {null|object} message2 The previous message * @param {string} message2.id The ID of the second message * @param {int} message2.timestamp Timestamp of the second message - * @returns {boolean} Boolean if the messages have the same date + * @return {boolean} Boolean if the messages have the same date */ messagesHaveDifferentDate(message1, message2) { return !message2 // There is no previous message @@ -367,7 +369,7 @@ export default { * @param {object} message The message object * @param {string} message.id The ID of the message * @param {int} message.timestamp Timestamp of the message - * @returns {string} Translated string of ", ", "<3 days ago>, " + * @return {string} Translated string of ", ", "<3 days ago>, " */ generateDateSeparator(message) { const date = this.getDateOfMessage(message) @@ -402,7 +404,7 @@ export default { * @param {object} message The message object * @param {string} message.id The ID of the message * @param {int} message.timestamp Timestamp of the message - * @returns {object} MomentJS object + * @return {object} MomentJS object */ getDateOfMessage(message) { if (message.id.toString().startsWith('temp-')) { @@ -512,6 +514,7 @@ export default { /** * Get messages history. + * * @param {boolean} includeLastKnown Include or exclude the last known message in the response */ async getOldMessages(includeLastKnown) { @@ -535,6 +538,7 @@ export default { /** * Creates a long polling request for a new message. + * * @param {boolean} scrollToBottom Whether we should try to automatically scroll to the bottom */ async getNewMessages(scrollToBottom = true) { @@ -634,7 +638,7 @@ export default { * the bottom of the viewport. * * @param {object} messageEl message element after which to start searching - * @returns {object} DOM element for the last visible message + * @return {object} DOM element for the last visible message */ findFirstVisibleMessage(messageEl) { let el = messageEl @@ -789,7 +793,7 @@ export default { * @param {string} messageId message id * @param {boolean} smooth true to smooth scroll, false to jump directly * @param {boolean} highlightAnimation true to highlight and set focus to the message - * @returns {bool} true if element was found, false otherwise + * @return {bool} true if element was found, false otherwise */ focusMessage(messageId, smooth = true, highlightAnimation = true) { const element = document.getElementById(`message_${messageId}`) @@ -799,7 +803,7 @@ export default { return false } - this.$nextTick(async() => { + this.$nextTick(async () => { // FIXME: this doesn't wait for the smooth scroll to end await element.scrollIntoView({ behavior: smooth ? 'smooth' : 'auto', @@ -821,7 +825,8 @@ export default { /** * gets the last known message id. - * @returns {string} The last known message id. + * + * @return {string} The last known message id. */ getLastKnownMessageId() { let i = this.messagesList.length - 1 @@ -836,7 +841,8 @@ export default { }, /** * gets the first message's id. - * @returns {string} + * + * @return {string} */ getFirstKnownMessageId() { return this.messagesList[0].id.toString() diff --git a/src/components/NewMessageForm/AdvancedInput/AdvancedInput.vue b/src/components/NewMessageForm/AdvancedInput/AdvancedInput.vue index eae9624c5..c54995088 100644 --- a/src/components/NewMessageForm/AdvancedInput/AdvancedInput.vue +++ b/src/components/NewMessageForm/AdvancedInput/AdvancedInput.vue @@ -107,7 +107,7 @@ import debounce from 'debounce' * vue-at component or not. * * @param {CSSStyleSheet} sheet the style sheet to check. - * @returns {Boolean} True if it is the style sheet from vue-at, false + * @return {boolean} True if it is the style sheet from vue-at, false * otherwise. */ function isDefaultAtWhoStyleSheet(sheet) { @@ -281,7 +281,8 @@ export default { * The vue-at library only searches in the display name by default. * But luckily our server responds already only with matching items, * so we just filter none and show them all. - * @returns {boolean} True as we never filter anything out + * + * @return {boolean} True as we never filter anything out */ atFilter() { return true @@ -347,7 +348,7 @@ export default { * Sets the autocomplete mention candidates based on the matched text * after the "@". * - * @param {String} chunk the matched text to look candidate mentions for. + * @param {string} chunk the matched text to look candidate mentions for. */ handleAtEvent: debounce(function(chunk) { this.queryPossibleMentions(chunk) diff --git a/src/components/NewMessageForm/NewMessageForm.vue b/src/components/NewMessageForm/NewMessageForm.vue index d506e6c60..ea426b765 100644 --- a/src/components/NewMessageForm/NewMessageForm.vue +++ b/src/components/NewMessageForm/NewMessageForm.vue @@ -185,7 +185,7 @@ export default { /** * The current conversation token * - * @returns {String} + * @return {string} */ token() { return this.$store.getters.getToken() @@ -314,8 +314,8 @@ export default { * * The parsed text is also trimmed. * - * @param {String} text the raw text - * @returns {String} the parsed text + * @param {string} text the raw text + * @return {string} the parsed text */ rawToParsed(text) { text = text.replace(/
/g, '\n') @@ -397,7 +397,7 @@ export default { async handleFileShare() { picker.pick() - .then(async(path) => { + .then(async (path) => { console.debug(`path ${path} selected for sharing`) if (!path.startsWith('/')) { throw new Error(t('files', 'Invalid path selected')) @@ -440,7 +440,6 @@ export default { * @param {File[] | FileList} files pasted files list * @param {bool} rename whether to rename the files * @param {bool} isVoiceMessage indicates whether the file is a vooicemessage - */ async handleFiles(files, rename = false, isVoiceMessage) { // Create a unique id for the upload operation diff --git a/src/components/Quote.vue b/src/components/Quote.vue index 220181401..64ac90019 100644 --- a/src/components/Quote.vue +++ b/src/components/Quote.vue @@ -134,7 +134,8 @@ export default { computed: { /** * The message actor display name. - * @returns {string} + * + * @return {string} */ getDisplayName() { const displayName = this.actorDisplayName.trim() @@ -186,7 +187,8 @@ export default { * This is a simplified version of the last chat message. * Parameters are parsed without markup (just replaced with the name), * e.g. no avatars on mentions. - * @returns {string} A simple message to show below the conversation name + * + * @return {string} A simple message to show below the conversation name */ simpleQuotedMessage() { if (!Object.keys(this.messageParameters).length) { diff --git a/src/components/RightSidebar/Participants/CurrentParticipants/CurrentParticipants.vue b/src/components/RightSidebar/Participants/CurrentParticipants/CurrentParticipants.vue index 6e4c3d1bc..015c0295f 100644 --- a/src/components/RightSidebar/Participants/CurrentParticipants/CurrentParticipants.vue +++ b/src/components/RightSidebar/Participants/CurrentParticipants/CurrentParticipants.vue @@ -68,7 +68,7 @@ export default { /** * Gets the participants array. * - * @returns {array} + * @return {Array} */ participantsList() { let participants = this.$store.getters.participantsList(this.token) @@ -134,7 +134,7 @@ export default { * @param {string} participant2.actorType Second participant actor type * @param {string} participant2.status Second participant user status * @param {int} participant2.inCall Second participant in call flag - * @returns {number} + * @return {number} */ sortParticipants(participant1, participant2) { const p1IsGroup = participant1.actorType === ATTENDEE.ACTOR_TYPE.GROUPS diff --git a/src/components/RightSidebar/Participants/ParticipantsList/Participant/Participant.spec.js b/src/components/RightSidebar/Participants/ParticipantsList/Participant/Participant.spec.js index 4e72252ab..62afba853 100644 --- a/src/components/RightSidebar/Participants/ParticipantsList/Participant/Participant.spec.js +++ b/src/components/RightSidebar/Participants/ParticipantsList/Participant/Participant.spec.js @@ -22,6 +22,10 @@ describe('Participant.vue', () => { let testStoreConfig let tooltipMock + /** + * @param wrapper + * @param htmlEl + */ async function getLastTooltipValue(wrapper, htmlEl) { tooltipMock.mockClear() await wrapper.vm.forceEnableTooltips() @@ -76,6 +80,10 @@ describe('Participant.vue', () => { jest.clearAllMocks() }) + /** + * @param participant + * @param showUserStatus + */ function mountParticipant(participant, showUserStatus = false) { return shallowMount(Participant, { localVue, @@ -173,6 +181,9 @@ describe('Participant.vue', () => { }) describe('user name', () => { + /** + * @param wrapper + */ async function getUserTooltip(wrapper) { const tooltipEl = wrapper.find('.participant-row__user-name').element return getLastTooltipValue(wrapper, tooltipEl) @@ -183,34 +194,34 @@ describe('Participant.vue', () => { participant.statusMessage = '' }) - test('renders plain user name for regular user', async() => { + test('renders plain user name for regular user', async () => { const wrapper = mountParticipant(participant) expect(wrapper.text()).toBe('Alice') expect(await getUserTooltip(wrapper)).toBe('Alice') }) - test('renders guest suffix for guests', async() => { + test('renders guest suffix for guests', async () => { participant.participantType = PARTICIPANT.TYPE.GUEST const wrapper = mountParticipant(participant) expect(wrapper.text()).toStrictEqual(expect.stringMatching(/^Alice\s+\(guest\)$/)) expect(await getUserTooltip(wrapper)).toBe('Alice (guest)') }) - test('renders moderator suffix for moderators', async() => { + test('renders moderator suffix for moderators', async () => { participant.participantType = PARTICIPANT.TYPE.MODERATOR const wrapper = mountParticipant(participant) expect(wrapper.text()).toStrictEqual(expect.stringMatching(/^Alice\s+\(moderator\)$/)) expect(await getUserTooltip(wrapper)).toBe('Alice (moderator)') }) - test('renders guest moderator suffix for guest moderators', async() => { + test('renders guest moderator suffix for guest moderators', async () => { participant.participantType = PARTICIPANT.TYPE.GUEST_MODERATOR const wrapper = mountParticipant(participant) expect(wrapper.text()).toStrictEqual(expect.stringMatching(/^Alice\s+\(moderator\)\s+\(guest\)$/)) expect(await getUserTooltip(wrapper)).toBe('Alice (moderator) (guest)') }) - test('renders bot suffix for bots', async() => { + test('renders bot suffix for bots', async () => { participant.actorType = ATTENDEE.ACTOR_TYPE.USERS participant.actorId = ATTENDEE.BRIDGE_BOT_ID const wrapper = mountParticipant(participant) @@ -220,12 +231,15 @@ describe('Participant.vue', () => { }) describe('user status', () => { + /** + * @param wrapper + */ async function getStatusTooltip(wrapper) { const tooltipEl = wrapper.find('.participant-row__status>span').element return getLastTooltipValue(wrapper, tooltipEl) } - test('renders user status', async() => { + test('renders user status', async () => { const wrapper = mountParticipant(participant) expect(wrapper.find('.participant-row__status').text()).toBe('🌧️ rainy') expect(await getStatusTooltip(wrapper)).toBe('🌧️ rainy') @@ -238,7 +252,7 @@ describe('Participant.vue', () => { expect(wrapper.find('.participant-row__status').exists()).toBe(false) }) - test('renders dnd status', async() => { + test('renders dnd status', async () => { participant.statusMessage = '' participant.status = 'dnd' const wrapper = mountParticipant(participant) @@ -246,7 +260,7 @@ describe('Participant.vue', () => { expect(await getStatusTooltip(wrapper)).toBe('🌧️ Do not disturb') }) - test('renders away status', async() => { + test('renders away status', async () => { participant.statusMessage = '' participant.status = 'away' const wrapper = mountParticipant(participant) @@ -258,6 +272,9 @@ describe('Participant.vue', () => { describe('call icons', () => { let getParticipantRaisedHandMock + /** + * @param wrapper + */ async function getCallIconTooltip(wrapper) { const tooltipEl = wrapper.find('.participant-row__callstate-icon').element return getLastTooltipValue(wrapper, tooltipEl) @@ -278,7 +295,7 @@ describe('Participant.vue', () => { expect(wrapper.findComponent(Microphone).exists()).toBe(false) expect(wrapper.findComponent(Hand).exists()).toBe(false) }) - test('renders video call icon', async() => { + test('renders video call icon', async () => { participant.inCall = PARTICIPANT.CALL_FLAG.WITH_VIDEO const wrapper = mountParticipant(participant) expect(wrapper.findComponent(Video).exists()).toBe(true) @@ -288,7 +305,7 @@ describe('Participant.vue', () => { expect(await getCallIconTooltip(wrapper)).toBe('Joined with video') }) - test('renders audio call icon', async() => { + test('renders audio call icon', async () => { participant.inCall = PARTICIPANT.CALL_FLAG.WITH_AUDIO const wrapper = mountParticipant(participant) expect(wrapper.findComponent(Video).exists()).toBe(false) @@ -298,7 +315,7 @@ describe('Participant.vue', () => { expect(await getCallIconTooltip(wrapper)).toBe('Joined with audio') }) - test('renders phone call icon', async() => { + test('renders phone call icon', async () => { participant.inCall = PARTICIPANT.CALL_FLAG.WITH_PHONE const wrapper = mountParticipant(participant) expect(wrapper.findComponent(Video).exists()).toBe(false) @@ -308,7 +325,7 @@ describe('Participant.vue', () => { expect(await getCallIconTooltip(wrapper)).toBe('Joined via phone') }) - test('renders hand raised icon', async() => { + test('renders hand raised icon', async () => { participant.inCall = PARTICIPANT.CALL_FLAG.WITH_VIDEO getParticipantRaisedHandMock = jest.fn().mockReturnValue({ state: true }) @@ -322,7 +339,7 @@ describe('Participant.vue', () => { expect(await getCallIconTooltip(wrapper)).toBe('Raised their hand') }) - test('renders video call icon when joined with multiple', async() => { + test('renders video call icon when joined with multiple', async () => { participant.inCall = PARTICIPANT.CALL_FLAG.WITH_VIDEO | PARTICIPANT.CALL_FLAG.WITH_PHONE const wrapper = mountParticipant(participant) expect(wrapper.findComponent(Video).exists()).toBe(true) @@ -365,6 +382,9 @@ describe('Participant.vue', () => { store = new Vuex.Store(testStoreConfig) }) + /** + * + */ async function testCanDemote() { const wrapper = mountParticipant(participant) const actionButton = findActionButton(wrapper, 'Demote from moderator') @@ -378,49 +398,52 @@ describe('Participant.vue', () => { }) } + /** + * + */ async function testCannotDemote() { const wrapper = mountParticipant(participant) const actionButton = findActionButton(wrapper, 'Demote to moderator') expect(actionButton.exists()).toBe(false) } - test('allows a moderator to demote a moderator', async() => { + test('allows a moderator to demote a moderator', async () => { conversation.participantType = PARTICIPANT.TYPE.MODERATOR participant.participantType = PARTICIPANT.TYPE.MODERATOR await testCanDemote() }) - test('allows a moderator to demote a guest moderator', async() => { + test('allows a moderator to demote a guest moderator', async () => { conversation.participantType = PARTICIPANT.TYPE.MODERATOR participant.participantType = PARTICIPANT.TYPE.GUEST_MODERATOR await testCanDemote() }) - test('allows a guest moderator to demote a moderator', async() => { + test('allows a guest moderator to demote a moderator', async () => { conversation.participantType = PARTICIPANT.TYPE.GUEST_MODERATOR participant.participantType = PARTICIPANT.TYPE.MODERATOR await testCanDemote() }) - test('allows a guest moderator to demote a guest moderator', async() => { + test('allows a guest moderator to demote a guest moderator', async () => { conversation.participantType = PARTICIPANT.TYPE.GUEST_MODERATOR participant.participantType = PARTICIPANT.TYPE.GUEST_MODERATOR await testCanDemote() }) - test('does not allow to demote an owner', async() => { + test('does not allow to demote an owner', async () => { conversation.participantType = PARTICIPANT.TYPE.MODERATOR participant.participantType = PARTICIPANT.TYPE.OWNER await testCannotDemote() }) - test('does not allow demoting groups', async() => { + test('does not allow demoting groups', async () => { conversation.participantType = PARTICIPANT.TYPE.MODERATOR participant.actorType = ATTENDEE.ACTOR_TYPE.GROUPS await testCannotDemote() }) - test('does not allow demoting self', async() => { + test('does not allow demoting self', async () => { conversation.participantType = PARTICIPANT.TYPE.MODERATOR conversation.sessionId = 'current-session-id' participant.participantType = PARTICIPANT.TYPE.MODERATOR @@ -428,7 +451,7 @@ describe('Participant.vue', () => { await testCannotDemote() }) - test('does not allow demoting self as guest', async() => { + test('does not allow demoting self as guest', async () => { conversation.participantType = PARTICIPANT.TYPE.GUEST_MODERATOR conversation.sessionId = 'current-session-id' participant.participantType = PARTICIPANT.TYPE.GUEST_MODERATOR @@ -436,7 +459,7 @@ describe('Participant.vue', () => { await testCannotDemote() }) - test('does not allow a non-moderator to demote', async() => { + test('does not allow a non-moderator to demote', async () => { conversation.participantType = PARTICIPANT.TYPE.USER await testCannotDemote() }) @@ -451,6 +474,9 @@ describe('Participant.vue', () => { store = new Vuex.Store(testStoreConfig) }) + /** + * + */ async function testCanPromote() { const wrapper = mountParticipant(participant) const actionButton = findActionButton(wrapper, 'Promote to moderator') @@ -464,66 +490,69 @@ describe('Participant.vue', () => { }) } + /** + * + */ async function testCannotPromote() { const wrapper = mountParticipant(participant) const actionButton = findActionButton(wrapper, 'Promote to moderator') expect(actionButton.exists()).toBe(false) } - test('allows a moderator to promote a user to moderator', async() => { + test('allows a moderator to promote a user to moderator', async () => { conversation.participantType = PARTICIPANT.TYPE.MODERATOR await testCanPromote() }) - test('allows a moderator to promote a self-joined user to moderator', async() => { + test('allows a moderator to promote a self-joined user to moderator', async () => { conversation.participantType = PARTICIPANT.TYPE.MODERATOR participant.participantType = PARTICIPANT.TYPE.USER_SELF_JOINED await testCanPromote() }) - test('allows a moderator to promote a guest to moderator', async() => { + test('allows a moderator to promote a guest to moderator', async () => { conversation.participantType = PARTICIPANT.TYPE.MODERATOR participant.participantType = PARTICIPANT.TYPE.GUEST await testCanPromote() }) - test('allows a guest moderator to promote a user to moderator', async() => { + test('allows a guest moderator to promote a user to moderator', async () => { conversation.participantType = PARTICIPANT.TYPE.GUEST_MODERATOR await testCanPromote() }) - test('allows a guest moderator to promote a guest to moderator', async() => { + test('allows a guest moderator to promote a guest to moderator', async () => { conversation.participantType = PARTICIPANT.TYPE.GUEST_MODERATOR participant.participantType = PARTICIPANT.TYPE.GUEST await testCanPromote() }) - test('does not allow to promote a moderator', async() => { + test('does not allow to promote a moderator', async () => { conversation.participantType = PARTICIPANT.TYPE.MODERATOR participant.participantType = PARTICIPANT.TYPE.MODERATOR await testCannotPromote() }) - test('does not allow to promote a guest moderator', async() => { + test('does not allow to promote a guest moderator', async () => { conversation.participantType = PARTICIPANT.TYPE.MODERATOR participant.participantType = PARTICIPANT.TYPE.GUEST_MODERATOR await testCannotPromote() }) - test('does not allow promoting groups', async() => { + test('does not allow promoting groups', async () => { conversation.participantType = PARTICIPANT.TYPE.MODERATOR participant.actorType = ATTENDEE.ACTOR_TYPE.GROUPS await testCannotPromote() }) - test('does not allow promoting the bridge bot', async() => { + test('does not allow promoting the bridge bot', async () => { conversation.participantType = PARTICIPANT.TYPE.MODERATOR participant.actorType = ATTENDEE.ACTOR_TYPE.USERS participant.actorId = ATTENDEE.BRIDGE_BOT_ID await testCannotPromote() }) - test('does not allow a non-moderator to promote', async() => { + test('does not allow a non-moderator to promote', async () => { conversation.participantType = PARTICIPANT.TYPE.USER await testCannotPromote() }) @@ -538,7 +567,7 @@ describe('Participant.vue', () => { store = new Vuex.Store(testStoreConfig) }) - test('allows moderators to resend invitations for email participants', async() => { + test('allows moderators to resend invitations for email participants', async () => { conversation.participantType = PARTICIPANT.TYPE.MODERATOR participant.actorType = ATTENDEE.ACTOR_TYPE.EMAILS const wrapper = mountParticipant(participant) @@ -553,14 +582,14 @@ describe('Participant.vue', () => { }) }) - test('does not allow non-moderators to resend invitations', async() => { + test('does not allow non-moderators to resend invitations', async () => { participant.actorType = ATTENDEE.ACTOR_TYPE.EMAILS const wrapper = mountParticipant(participant) const actionButton = findActionButton(wrapper, 'Resend invitation') expect(actionButton.exists()).toBe(false) }) - test('does not display resend invitations action when not an email actor', async() => { + test('does not display resend invitations action when not an email actor', async () => { participant.actorType = ATTENDEE.ACTOR_TYPE.USERS const wrapper = mountParticipant(participant) const actionButton = findActionButton(wrapper, 'Resend invitation') @@ -577,6 +606,9 @@ describe('Participant.vue', () => { store = new Vuex.Store(testStoreConfig) }) + /** + * @param buttonText + */ async function testCanRemove(buttonText = 'Remove participant') { const wrapper = mountParticipant(participant) const actionButton = findActionButton(wrapper, buttonText) @@ -590,49 +622,52 @@ describe('Participant.vue', () => { }) } + /** + * + */ async function testCannotRemove() { const wrapper = mountParticipant(participant) const actionButton = findActionButton(wrapper, 'Remove participant') expect(actionButton.exists()).toBe(false) } - test('allows a moderator to remove a moderator', async() => { + test('allows a moderator to remove a moderator', async () => { conversation.participantType = PARTICIPANT.TYPE.MODERATOR participant.participantType = PARTICIPANT.TYPE.MODERATOR await testCanRemove() }) - test('allows a moderator to remove a guest moderator', async() => { + test('allows a moderator to remove a guest moderator', async () => { conversation.participantType = PARTICIPANT.TYPE.MODERATOR participant.participantType = PARTICIPANT.TYPE.GUEST_MODERATOR await testCanRemove() }) - test('allows a guest moderator to remove a moderator', async() => { + test('allows a guest moderator to remove a moderator', async () => { conversation.participantType = PARTICIPANT.TYPE.GUEST_MODERATOR participant.participantType = PARTICIPANT.TYPE.MODERATOR await testCanRemove() }) - test('allows a guest moderator to remove a guest moderator', async() => { + test('allows a guest moderator to remove a guest moderator', async () => { conversation.participantType = PARTICIPANT.TYPE.GUEST_MODERATOR participant.participantType = PARTICIPANT.TYPE.GUEST_MODERATOR await testCanRemove() }) - test('allows a moderator to remove groups', async() => { + test('allows a moderator to remove groups', async () => { conversation.participantType = PARTICIPANT.TYPE.MODERATOR participant.actorType = ATTENDEE.ACTOR_TYPE.GROUPS await testCanRemove('Remove group and members') }) - test('does not allow to remove an owner', async() => { + test('does not allow to remove an owner', async () => { conversation.participantType = PARTICIPANT.TYPE.MODERATOR participant.participantType = PARTICIPANT.TYPE.OWNER await testCannotRemove() }) - test('does not allow removing self', async() => { + test('does not allow removing self', async () => { conversation.participantType = PARTICIPANT.TYPE.MODERATOR conversation.sessionId = 'current-session-id' participant.participantType = PARTICIPANT.TYPE.MODERATOR @@ -640,7 +675,7 @@ describe('Participant.vue', () => { await testCannotRemove() }) - test('does not allow removing self as guest', async() => { + test('does not allow removing self as guest', async () => { conversation.participantType = PARTICIPANT.TYPE.GUEST_MODERATOR conversation.sessionId = 'current-session-id' participant.participantType = PARTICIPANT.TYPE.GUEST_MODERATOR @@ -648,12 +683,15 @@ describe('Participant.vue', () => { await testCannotRemove() }) - test('does not allow a non-moderator to remove', async() => { + test('does not allow a non-moderator to remove', async () => { conversation.participantType = PARTICIPANT.TYPE.USER await testCannotRemove() }) }) describe('dial-in PIN', () => { + /** + * + */ function testPinVisible() { const wrapper = mountParticipant(participant) let actionTexts = wrapper.findAllComponents(ActionText) @@ -716,7 +754,7 @@ describe('Participant.vue', () => { expect(wrapper.findAllComponents(ActionButton).exists()).toBe(false) }) - test('triggers event when clicking', async() => { + test('triggers event when clicking', async () => { const eventHandler = jest.fn() const wrapper = mountParticipant(participant) wrapper.vm.$on('clickParticipant', eventHandler) @@ -726,7 +764,7 @@ describe('Participant.vue', () => { expect(eventHandler).toHaveBeenCalledWith(participant) }) - test('does not trigger click event when not a search result', async() => { + test('does not trigger click event when not a search result', async () => { const eventHandler = jest.fn() delete participant.label delete participant.source diff --git a/src/components/RightSidebar/Participants/ParticipantsList/Participant/Participant.vue b/src/components/RightSidebar/Participants/ParticipantsList/Participant/Participant.vue index 17c5ba7e4..cb3b5a5ce 100644 --- a/src/components/RightSidebar/Participants/ParticipantsList/Participant/Participant.vue +++ b/src/components/RightSidebar/Participants/ParticipantsList/Participant/Participant.vue @@ -256,7 +256,8 @@ export default { /** * Check if the current participant belongs to the selected participants array * in the store - * @returns {boolean} + * + * @return {boolean} */ isSelected() { if (this.isSelectable) { @@ -274,7 +275,8 @@ export default { * If the Participant component is used as to display a search result, it will * return true. We use this not to display actions on the searched contacts and * groups. - * @returns {boolean} + * + * @return {boolean} */ isSearched() { return this.participant.label !== undefined diff --git a/src/components/RightSidebar/Participants/ParticipantsSearchResults/ParticipantsSearchResults.vue b/src/components/RightSidebar/Participants/ParticipantsSearchResults/ParticipantsSearchResults.vue index be50fff23..d2dd08cad 100644 --- a/src/components/RightSidebar/Participants/ParticipantsSearchResults/ParticipantsSearchResults.vue +++ b/src/components/RightSidebar/Participants/ParticipantsSearchResults/ParticipantsSearchResults.vue @@ -131,7 +131,8 @@ export default { type: Boolean, default: false, }, - /** If so, this component will add clicked participant to the selected + /** + * If so, this component will add clicked participant to the selected * participants store; */ selectable: { diff --git a/src/components/RightSidebar/Participants/ParticipantsTab.vue b/src/components/RightSidebar/Participants/ParticipantsTab.vue index c7008820d..18a7f2727 100644 --- a/src/components/RightSidebar/Participants/ParticipantsTab.vue +++ b/src/components/RightSidebar/Participants/ParticipantsTab.vue @@ -234,7 +234,8 @@ export default { /** * Add the selected group/user/circle to the conversation - * @param {Object} item The autocomplete suggestion to start a conversation with + * + * @param {object} item The autocomplete suggestion to start a conversation with * @param {string} item.id The ID of the target * @param {string} item.source The source of the target */ diff --git a/src/components/RightSidebar/RightSidebar.vue b/src/components/RightSidebar/RightSidebar.vue index 0749560e8..40578d833 100644 --- a/src/components/RightSidebar/RightSidebar.vue +++ b/src/components/RightSidebar/RightSidebar.vue @@ -184,7 +184,8 @@ export default { /** * The conversation title value passed into the AppSidebar component. - * @returns {string} The conversation's title. + * + * @return {string} The conversation's title. */ title() { if (this.isRenamingConversation) { @@ -244,6 +245,7 @@ export default { /** * Updates the conversationName value while editing the conversation's title. + * * @param {string} title the conversation title emitted by the AppSidevar vue * component. */ diff --git a/src/components/SettingsDialog/SettingsDialog.vue b/src/components/SettingsDialog/SettingsDialog.vue index 73936f0fd..38ef02535 100644 --- a/src/components/SettingsDialog/SettingsDialog.vue +++ b/src/components/SettingsDialog/SettingsDialog.vue @@ -196,7 +196,7 @@ export default { .startAt(this.attachmentFolder) .build() picker.pick() - .then(async(path) => { + .then(async (path) => { console.debug(`Path '${path}' selected for talk attachments`) if (path !== '' && !path.startsWith('/')) { throw new Error(t('spreed', 'Invalid path selected')) diff --git a/src/deck.js b/src/deck.js index d0f63f047..d8d094689 100644 --- a/src/deck.js +++ b/src/deck.js @@ -29,6 +29,10 @@ import { postRichObjectToConversation } from './services/messagesService' import RoomSelector from './views/RoomSelector' (function(OC, OCA, t, n) { + /** + * @param card + * @param token + */ async function postCardToRoom(card, token) { try { const response = await postRichObjectToConversation(token, { @@ -53,6 +57,9 @@ import RoomSelector from './views/RoomSelector' } } + /** + * + */ function init() { if (!OCA.Deck) { return diff --git a/src/init.js b/src/init.js index c92b366f7..532008c54 100644 --- a/src/init.js +++ b/src/init.js @@ -32,12 +32,13 @@ if (!window.OCA.Talk) { /** * Frontend message API for adding actions to talk messages. + * * @param {*} Object the wrapping object. - * @param {String} label the action label. + * @param {string} label the action label. * @param {Function} callback the callback function. This function will receive * the messageAPIData object as a parameter and be triggered by a click on the * action. - * @param {String} icon the action label. E.g. "icon-reply" + * @param {string} icon the action label. E.g. "icon-reply" */ window.OCA.Talk.registerMessageAction = ({ label, callback, icon }) => { const messageAction = { diff --git a/src/main.js b/src/main.js index 218d9ab79..4aed820a3 100644 --- a/src/main.js +++ b/src/main.js @@ -2,7 +2,9 @@ * @copyright Copyright (c) 2019 John Molakvoæ * * @author John Molakvoæ + * * @author Joas Schilling + * * @author Marco Ambrosini * * @license GNU AGPL version 3 or any later version diff --git a/src/mainFilesSidebar.js b/src/mainFilesSidebar.js index 469616847..4e4dff746 100644 --- a/src/mainFilesSidebar.js +++ b/src/mainFilesSidebar.js @@ -2,7 +2,9 @@ * @copyright Copyright (c) 2019 John Molakvoæ * * @author John Molakvoæ + * * @author Joas Schilling + * * @author Marco Ambrosini * * @license GNU AGPL version 3 or any later version diff --git a/src/mainPublicShareAuthSidebar.js b/src/mainPublicShareAuthSidebar.js index 9d72012a3..4031a771e 100644 --- a/src/mainPublicShareAuthSidebar.js +++ b/src/mainPublicShareAuthSidebar.js @@ -93,6 +93,9 @@ function wrapBody() { bodyElement.appendChild(bodyWrapperElement) } +/** + * + */ function adjustLayout() { const contentElement = document.createElement('div') contentElement.setAttribute('id', 'content') @@ -116,6 +119,9 @@ function adjustLayout() { adjustLayout() +/** + * + */ function getShareToken() { const shareTokenElement = document.getElementById('sharingToken') return shareTokenElement.value diff --git a/src/mainPublicShareSidebar.js b/src/mainPublicShareSidebar.js index 40d1f90ee..3fd6f40a3 100644 --- a/src/mainPublicShareSidebar.js +++ b/src/mainPublicShareSidebar.js @@ -66,6 +66,9 @@ Vue.use(VueShortKey, { prevent: ['input', 'textarea', 'div'] }) Vue.use(vOutsideEvents) Vue.use(VueObserveVisibility) +/** + * + */ function adjustLayout() { document.querySelector('#app-content').appendChild(document.querySelector('footer')) @@ -89,6 +92,9 @@ if (window.innerWidth > 1111) { sidebarState.isOpen = true } +/** + * + */ function addTalkSidebarTrigger() { const talkSidebarTriggerElement = document.createElement('button') talkSidebarTriggerElement.setAttribute('id', 'talk-sidebar-trigger') @@ -110,6 +116,9 @@ function addTalkSidebarTrigger() { addTalkSidebarTrigger() +/** + * + */ function getShareToken() { const shareTokenElement = document.getElementById('sharingToken') return shareTokenElement.value diff --git a/src/mixins/arrowNavigation.js b/src/mixins/arrowNavigation.js index 2fe79c4e0..b0fc4c5f0 100644 --- a/src/mixins/arrowNavigation.js +++ b/src/mixins/arrowNavigation.js @@ -74,6 +74,7 @@ const arrowNavigation = { /** * If none already focused, focus the first rendered result + * * @param {Event} event the keydown event */ focusInitialise(event) { @@ -84,6 +85,7 @@ const arrowNavigation = { /** * Focus the first item if any + * * @param {Event} event the keydown event */ focusFirst(event) { @@ -99,6 +101,7 @@ const arrowNavigation = { /** * Focus the next item if any + * * @param {Event} event the keydown event */ focusNext(event) { @@ -124,6 +127,7 @@ const arrowNavigation = { /** * Focus the previous item if any + * * @param {Event} event the keydown event */ focusPrev(event) { @@ -149,6 +153,7 @@ const arrowNavigation = { /** * Focus the specified item index if it exists + * * @param {number} index the item index */ focusIndex(index) { @@ -160,6 +165,7 @@ const arrowNavigation = { /** * Set the current focused element based on the target + * * @param {Event} event the focus event */ setFocusedIndex(event) { diff --git a/src/mixins/readableNumber.js b/src/mixins/readableNumber.js index 944f703cf..78057cecf 100644 --- a/src/mixins/readableNumber.js +++ b/src/mixins/readableNumber.js @@ -29,7 +29,7 @@ const readableNumber = { * 9432670284 => 943 267 0284 * * @param {string} number The number to make readable - * @returns {string} + * @return {string} */ readableNumber(number) { const chunks = this.stringChop(number, 3) @@ -42,9 +42,10 @@ const readableNumber = { /** * Copied from https://www.w3resource.com/javascript-exercises/javascript-string-exercise-17.php + * * @param {string} str The string to chop * @param {number} size Size of the chunks - * @returns {string[]} + * @return {string[]} */ stringChop(str, size) { str = String(str) diff --git a/src/mixins/vueAtReparenter.js b/src/mixins/vueAtReparenter.js index 89e2b0bf6..fab4cce35 100644 --- a/src/mixins/vueAtReparenter.js +++ b/src/mixins/vueAtReparenter.js @@ -59,7 +59,7 @@ export default { * The "atwho" property is an object when the panel is open and null * when the panel is closed. * - * @returns {Object} the "atwho" property of the vue-at component. + * @return {object} the "atwho" property of the vue-at component. */ atwho() { if (!this.at) { @@ -73,7 +73,7 @@ export default { * Returns a list of CSS clases from the space separated string * "atWhoPanelExtraClasses". * - * @returns {Array} the list of CSS classes + * @return {Array} the list of CSS classes */ atWhoPanelExtraClassesList() { return this.atWhoPanelExtraClasses.split(' ').filter(cssClass => cssClass !== '') @@ -91,8 +91,8 @@ export default { * for anything else, so it can be modified while the panel is open to * point to the new parent. * - * @param {Object} atwho current value of atwho - * @param {Object} atwhoOld previous value of atwho + * @param {object} atwho current value of atwho + * @param {object} atwhoOld previous value of atwho */ atwho(atwho, atwhoOld) { // Only check whether the object existed or not; its properties are diff --git a/src/services/callsService.js b/src/services/callsService.js index f7f4cf67f..565c9bfbb 100644 --- a/src/services/callsService.js +++ b/src/services/callsService.js @@ -40,7 +40,7 @@ import { * * @param {string} token The token of the call to be joined. * @param {int} flags The available PARTICIPANT.CALL_FLAG for this participants - * @returns {int} The actual flags based on the available media + * @return {int} The actual flags based on the available media */ const joinCall = async function(token, flags) { try { @@ -52,6 +52,7 @@ const joinCall = async function(token, flags) { /** * Leave a call as participant + * * @param {string} token The token of the call to be left */ const leaveCall = async function(token) { diff --git a/src/services/conversationsService.js b/src/services/conversationsService.js index 604b56dcf..0427479dc 100644 --- a/src/services/conversationsService.js +++ b/src/services/conversationsService.js @@ -26,6 +26,7 @@ import { CONVERSATION, SHARE } from '../constants' /** * Fetches the conversations from the server. + * * @param {object} options options */ const fetchConversations = async function(options) { @@ -37,6 +38,7 @@ const fetchConversations = async function(options) { /** * Fetches a conversation from the server. + * * @param {string} token The token of the conversation to be fetched. */ const fetchConversation = async function(token) { @@ -45,6 +47,7 @@ const fetchConversation = async function(token) { /** * Fetch listed conversations + * * @param {string} searchText The string that will be used in the search query. * @param {object} options options */ @@ -91,6 +94,7 @@ const searchPossibleConversations = async function({ searchText, token, onlyUser /** * Create a new one to one conversation with the specified user. + * * @param {string} userId The ID of the user with wich the new conversation will be opened. */ const createOneToOneConversation = async function(userId) { @@ -104,6 +108,7 @@ const createOneToOneConversation = async function(userId) { /** * Create a new group conversation. + * * @param {string} invite The group/circle ID * @param {string} source The source of the invite ID (defaults to groups) */ @@ -118,6 +123,7 @@ const createGroupConversation = async function(invite, source) { /** * Create a new private conversation. + * * @param {string} conversationName The name for the new conversation */ const createPrivateConversation = async function(conversationName) { @@ -131,6 +137,7 @@ const createPrivateConversation = async function(conversationName) { /** * Create a new private conversation. + * * @param {string} conversationName The name for the new conversation */ const createPublicConversation = async function(conversationName) { @@ -144,6 +151,7 @@ const createPublicConversation = async function(conversationName) { /** * Set a conversation's password + * * @param {string} token the conversation's token * @param {string} password the password to be set */ @@ -156,6 +164,7 @@ const setConversationPassword = async function(token, password) { /** * Set a conversation's name + * * @param {string} token the conversation's token * @param {string} name the name to be set */ @@ -168,6 +177,7 @@ const setConversationName = async function(token, name) { /** * Delete a conversation. + * * @param {string} token The token of the conversation to be deleted. */ const deleteConversation = async function(token) { @@ -181,6 +191,7 @@ const deleteConversation = async function(token) { /** * Clears the conversation history + * * @param {string} token The token of the conversation to be deleted. */ const clearConversationHistory = async function(token) { @@ -190,6 +201,7 @@ const clearConversationHistory = async function(token) { /** * Add a conversation to the favorites + * * @param {string} token The token of the conversation to be favorites */ const addToFavorites = async function(token) { @@ -203,6 +215,7 @@ const addToFavorites = async function(token) { /** * Remove a conversation from the favorites + * * @param {string} token The token of the conversation to be removed from favorites */ const removeFromFavorites = async function(token) { @@ -216,6 +229,7 @@ const removeFromFavorites = async function(token) { /** * Remove a conversation from the favorites + * * @param {string} token The token of the conversation to be removed from favorites * @param {int} level The notification level to set. */ @@ -230,6 +244,7 @@ const setNotificationLevel = async function(token, level) { /** * Make the conversation public + * * @param {string} token The token of the conversation to be removed from favorites */ const makePublic = async function(token) { @@ -243,6 +258,7 @@ const makePublic = async function(token) { /** * Make the conversation private + * * @param {string} token The token of the conversation to be removed from favorites */ const makePrivate = async function(token) { @@ -256,6 +272,7 @@ const makePrivate = async function(token) { /** * Change the SIP enabled + * * @param {string} token The token of the conversation to be modified * @param {int} newState The new SIP state to set */ @@ -267,6 +284,7 @@ const setSIPEnabled = async function(token, newState) { /** * Change the lobby state + * * @param {string} token The token of the conversation to be modified * @param {int} newState The new lobby state to set * @param {int} timestamp The UNIX timestamp (in seconds) to set, if any @@ -285,6 +303,7 @@ const changeLobbyState = async function(token, newState, timestamp) { /** * Change the read-only state + * * @param {string} token The token of the conversation to be modified * @param {int} readOnly The new read-only state to set */ @@ -301,6 +320,7 @@ const changeReadOnlyState = async function(token, readOnly) { /** * Change the listable scope + * * @param {string} token The token of the conversation to be modified * @param {int} listable The new listable scope to set */ diff --git a/src/services/conversationsService.spec.js b/src/services/conversationsService.spec.js index ba38063e7..ffea8cccb 100644 --- a/src/services/conversationsService.spec.js +++ b/src/services/conversationsService.spec.js @@ -9,6 +9,11 @@ describe('conversationsService', () => { mockAxios.reset() }) + /** + * @param token + * @param onlyUsers + * @param expectedShareTypes + */ function testSearchPossibleConversations(token, onlyUsers, expectedShareTypes) { searchPossibleConversations( { diff --git a/src/services/filesIntegrationServices.js b/src/services/filesIntegrationServices.js index 578e2f69b..49eb32dad 100644 --- a/src/services/filesIntegrationServices.js +++ b/src/services/filesIntegrationServices.js @@ -26,9 +26,10 @@ import { generateOcsUrl } from '@nextcloud/router' /** * Gets the conversation token for a given file id * - * @param {Object} .fileId the id of the file - * @param {Object} options unused - * @returns {String} the conversation token + * @param {object} .fileId the id of the file + * @param options.fileId + * @param {object} options unused + * @return {string} the conversation token */ const getFileConversation = async function({ fileId }, options) { const response = await axios.get(generateOcsUrl('apps/spreed/api/v1/file/{fileId}', { fileId })) @@ -38,8 +39,8 @@ const getFileConversation = async function({ fileId }, options) { /** * Gets the public share conversation token for a given share token. * - * @param {String} shareToken the token of the share - * @returns {String} the conversation token + * @param {string} shareToken the token of the share + * @return {string} the conversation token * @throws {Exception} if the conversation token could not be got */ const getPublicShareConversationData = async function(shareToken) { diff --git a/src/services/filesSharingServices.js b/src/services/filesSharingServices.js index cc84cd8f7..c6d74b27a 100644 --- a/src/services/filesSharingServices.js +++ b/src/services/filesSharingServices.js @@ -25,12 +25,13 @@ import { showError } from '@nextcloud/dialogs' /** * Appends a file as a message to the messagelist. + * * @param {string} path The file path from the user's root directory * @param {string} token The conversation's token * e.g. `/myfile.txt` * @param {string} referenceId An optional reference id to recognize the message later - * @param {array} metadata the metadata json encoded array -*/ + * @param {Array} metadata the metadata json encoded array + */ const shareFile = async function(path, token, referenceId, metadata) { try { return axios.post( diff --git a/src/services/matterbridgeService.js b/src/services/matterbridgeService.js index c84f444e9..4bdf11d99 100644 --- a/src/services/matterbridgeService.js +++ b/src/services/matterbridgeService.js @@ -28,6 +28,7 @@ import { /** * Edit the bridge of a room + * * @param {token} token the conversation token. * @param {string} enabled state of the bridge * @param {string} parts parts of the bridge, where it has to connect @@ -43,6 +44,7 @@ const editBridge = async function(token, enabled, parts) { /** * Get the bridge of a room + * * @param {token} token the conversation token. */ const getBridge = async function(token) { @@ -52,6 +54,7 @@ const getBridge = async function(token) { /** * Get the bridge binary state for a room + * * @param {token} token the conversation token. */ const getBridgeProcessState = async function(token) { diff --git a/src/services/messagesService.js b/src/services/messagesService.js index 630445f23..05e7a4a25 100644 --- a/src/services/messagesService.js +++ b/src/services/messagesService.js @@ -53,7 +53,7 @@ const fetchMessages = async function({ token, lastKnownMessageId, includeLastKno * @param {object} options options * @param {int} lastKnownMessageId The id of the last message in the store. */ -const lookForNewMessages = async({ token, lastKnownMessageId }, options) => { +const lookForNewMessages = async ({ token, lastKnownMessageId }, options) => { return axios.get(generateOcsUrl('apps/spreed/api/v1/chat/{token}', { token }), Object.assign(options, { params: { setReadMarker: 0, @@ -71,8 +71,9 @@ const lookForNewMessages = async({ token, lastKnownMessageId }, options) => { * @param {string} param0.token The conversation token * @param {string} param0.message The message object * @param {string} param0.referenceId A reference id to identify the message later again - * @param {Number} param0.parent The id of the message to be replied to + * @param {number} param0.parent The id of the message to be replied to * @param {object} options request options + * @param param0.actorDisplayName */ const postNewMessage = async function({ token, message, actorDisplayName, referenceId, parent }, options) { return axios.post(generateOcsUrl('apps/spreed/api/v1/chat/{token}', { token }), { @@ -87,8 +88,10 @@ const postNewMessage = async function({ token, message, actorDisplayName, refere * Deletes a message from the server. * * @param {object} param0 The message object that is destructured + * @param param0.token * @param {string} token The conversation token * @param {string} id The id of the message to be deleted + * @param param0.id */ const deleteMessage = async function({ token, id }) { return axios.delete(generateOcsUrl('apps/spreed/api/v1/chat/{token}/{id}', { token, id })) diff --git a/src/services/participantsService.js b/src/services/participantsService.js index 111bad917..35cdf4956 100644 --- a/src/services/participantsService.js +++ b/src/services/participantsService.js @@ -37,7 +37,7 @@ import { * @param {options} options request options; * @param {bool} forceJoin whether to force join; */ -const joinConversation = async({ token, forceJoin = false }, options) => { +const joinConversation = async ({ token, forceJoin = false }, options) => { const response = await axios.post(generateOcsUrl('apps/spreed/api/v4/room/{token}/participants/active', { token }), { force: forceJoin, }, options) @@ -54,7 +54,7 @@ const joinConversation = async({ token, forceJoin = false }, options) => { * * @param {string} token The conversation token; */ -const rejoinConversation = async(token) => { +const rejoinConversation = async (token) => { return axios.post(generateOcsUrl('apps/spreed/api/v4/room/{token}/participants/active', { token })) } @@ -87,6 +87,7 @@ const leaveConversationSync = function(token) { /** * Add a participant to a conversation. + * * @param {token} token the conversation token. * @param {string} newParticipant the id of the new participant * @param {string} source the source Source of the participant as returned by the autocomplete suggestion endpoint (default is users) @@ -118,19 +119,19 @@ const removeAttendeeFromConversation = async function(token, attendeeId) { return response } -const promoteToModerator = async(token, options) => { +const promoteToModerator = async (token, options) => { const response = await axios.post(generateOcsUrl('apps/spreed/api/v4/room/{token}/moderators', { token }), options) return response } -const demoteFromModerator = async(token, options) => { +const demoteFromModerator = async (token, options) => { const response = await axios.delete(generateOcsUrl('apps/spreed/api/v4/room/{token}/moderators', { token }), { params: options, }) return response } -const fetchParticipants = async(token, options) => { +const fetchParticipants = async (token, options) => { options = options || {} options.params = options.params || {} options.params.includeStatus = true @@ -138,7 +139,7 @@ const fetchParticipants = async(token, options) => { return response } -const setGuestUserName = async(token, userName) => { +const setGuestUserName = async (token, userName) => { const response = await axios.post(generateOcsUrl('apps/spreed/api/v1/guest/{token}/name', { token }), { displayName: userName, }) @@ -152,7 +153,7 @@ const setGuestUserName = async(token, userName) => { * @param {string} token conversation token * @param {int} attendeeId attendee id to target, or null for all */ -const resendInvitations = async(token, { attendeeId = null }) => { +const resendInvitations = async (token, { attendeeId = null }) => { await axios.post(generateOcsUrl('apps/spreed/api/v4/room/{token}/participants/resend-invitations', { token }), { attendeeId, }) diff --git a/src/services/publicShareAuthService.js b/src/services/publicShareAuthService.js index 0d044ee1d..98b7276c8 100644 --- a/src/services/publicShareAuthService.js +++ b/src/services/publicShareAuthService.js @@ -25,8 +25,8 @@ import { generateOcsUrl } from '@nextcloud/router' /** * Gets the public share auth conversation token for a given share token. * - * @param {String} shareToken the token of the share - * @returns {String} the conversation token + * @param {string} shareToken the token of the share + * @return {string} the conversation token * @throws {Exception} if the conversation token could not be got */ const getPublicShareAuthConversationToken = async function(shareToken) { diff --git a/src/services/settingsService.js b/src/services/settingsService.js index 68adef35e..2c4503c59 100644 --- a/src/services/settingsService.js +++ b/src/services/settingsService.js @@ -28,7 +28,7 @@ import BrowserStorage from './BrowserStorage' * Sets the attachment folder setting for the user * * @param {string} path The name of the folder - * @returns {Object} The axios response + * @return {object} The axios response */ const setAttachmentFolder = async function(path) { return axios.post(generateOcsUrl('apps/spreed/api/v1/settings/user'), { @@ -41,7 +41,7 @@ const setAttachmentFolder = async function(path) { * Sets the read status privacy setting for the user * * @param {int} privacy The selected value, either 0 or 1 - * @returns {Object} The axios response + * @return {object} The axios response */ const setReadStatusPrivacy = async function(privacy) { return axios.post(generateOcsUrl('apps/spreed/api/v1/settings/user'), { @@ -56,7 +56,7 @@ const setReadStatusPrivacy = async function(privacy) { * @param {Array} sipGroups The groups allowed to enable SIP on a conversation * @param {string} sharedSecret The shared secret which is used by the SIP server to authenticate * @param {string} dialInInfo The dial-in Information displayed in the email and sidebar - * @returns {Object} The axios response + * @return {object} The axios response */ const setSIPSettings = async function(sipGroups, sharedSecret, dialInInfo) { return axios.post(generateOcsUrl('apps/spreed/api/v1/settings/sip'), { diff --git a/src/services/signalingService.js b/src/services/signalingService.js index bf0c6dd01..4c3ae8017 100644 --- a/src/services/signalingService.js +++ b/src/services/signalingService.js @@ -23,10 +23,11 @@ import { generateOcsUrl } from '@nextcloud/router' /** * Fetches the signaling settings for a conversation + * * @param {string} token The token of the conversation to be signaled. * @param {object} options options */ -const fetchSignalingSettings = async({ token }, options) => { +const fetchSignalingSettings = async ({ token }, options) => { return axios.get(generateOcsUrl('apps/spreed/api/v3/signaling/settings'), Object.assign(options, { params: { token, @@ -34,11 +35,11 @@ const fetchSignalingSettings = async({ token }, options) => { })) } -const pullSignalingMessages = async(token, options) => { +const pullSignalingMessages = async (token, options) => { return axios.get(generateOcsUrl('apps/spreed/api/v3/signaling/{token}', { token }), options) } -const getWelcomeMessage = async(serverId) => { +const getWelcomeMessage = async (serverId) => { return axios.get(generateOcsUrl('apps/spreed/api/v3/signaling/welcome/{serverId}', { serverId })) } diff --git a/src/store/actorStore.js b/src/store/actorStore.js index 4caace794..a4e72f72f 100644 --- a/src/store/actorStore.js +++ b/src/store/actorStore.js @@ -150,6 +150,7 @@ const actions = { }, /** * Sets displayName only, we currently use this for guests user names. + * * @param {object} context default store context; * @param {string} displayName the display name to be set; */ diff --git a/src/store/callViewStore.spec.js b/src/store/callViewStore.spec.js index 02f333447..c787e865d 100644 --- a/src/store/callViewStore.spec.js +++ b/src/store/callViewStore.spec.js @@ -114,6 +114,10 @@ describe('callViewStore', () => { expect(store.getters.isStripeOpen).toBe(true) }) + /** + * @param conversationType + * @param state + */ function testDefaultGridState(conversationType, state) { localStorage.getItem.mockReturnValueOnce(null) diff --git a/src/store/conversationsStore.js b/src/store/conversationsStore.js index a4c9f0457..ae59dcc20 100644 --- a/src/store/conversationsStore.js +++ b/src/store/conversationsStore.js @@ -76,9 +76,10 @@ const getters = { conversationsList: state => Object.values(state.conversations), /** * Get a conversation providing it's token + * * @param {object} state state object - * @returns {function} The callback function - * @returns {object} The conversation object + * @return {Function} The callback function + * @return {object} The conversation object */ conversation: state => token => state.conversations[token], dummyConversation: state => Object.assign({}, DUMMY_CONVERSATION), @@ -96,6 +97,7 @@ const mutations = { }, /** * Deletes a conversation from the store. + * * @param {object} state current store state; * @param {object} token the token of the conversation to delete; */ @@ -104,6 +106,7 @@ const mutations = { }, /** * Resets the store to it's original state + * * @param {object} state current store state; */ purgeConversationsStore(state) { @@ -189,6 +192,7 @@ const actions = { * Delete a conversation from the server. * * @param {object} context default store context; + * @param token.token * @param {object} token the token of the conversation to be deleted; */ async deleteConversationFromServer(context, { token }) { @@ -201,6 +205,7 @@ const actions = { * Delete all the messages from a conversation. * * @param {object} context default store context; + * @param token.token * @param {object} token the token of the conversation whose history is * to be cleared; */ @@ -218,6 +223,7 @@ const actions = { /** * Resets the store to it's original state. + * * @param {object} context default store context; */ purgeConversationsStore(context) { diff --git a/src/store/conversationsStore.spec.js b/src/store/conversationsStore.spec.js index a193c1b8d..770026dae 100644 --- a/src/store/conversationsStore.spec.js +++ b/src/store/conversationsStore.spec.js @@ -187,7 +187,7 @@ describe('conversationsStore', () => { expect(store.getters.conversationsList).toStrictEqual([]) }) - test('deletes conversation from server', async() => { + test('deletes conversation from server', async () => { store.dispatch('addConversation', testConversation) await store.dispatch('deleteConversationFromServer', { token: testToken }) @@ -197,7 +197,7 @@ describe('conversationsStore', () => { expect(store.getters.conversation(testToken)).toBeUndefined() }) - test('fetches a single conversation', async() => { + test('fetches a single conversation', async () => { const response = { data: { ocs: { @@ -219,7 +219,7 @@ describe('conversationsStore', () => { expect(updateTalkVersionHashAction).toHaveBeenCalledWith(expect.anything(), response) }) - test('fetches all conversations and adds them after purging', async() => { + test('fetches all conversations and adds them after purging', async () => { const testConversations = [ { token: 'one_token', @@ -253,7 +253,7 @@ describe('conversationsStore', () => { expect(updateTalkVersionHashAction).toHaveBeenCalledWith(expect.anything(), response) }) - test('fetch conversation failure checks for maintenance mode', async() => { + test('fetch conversation failure checks for maintenance mode', async () => { const response = { status: 503 } fetchConversation.mockRejectedValue({ response }) @@ -262,7 +262,7 @@ describe('conversationsStore', () => { expect(checkMaintenanceModeAction).toHaveBeenCalledWith(expect.anything(), response) }) - test('fetch conversations failure checks for maintenance mode', async() => { + test('fetch conversations failure checks for maintenance mode', async () => { const response = { status: 503 } fetchConversations.mockRejectedValue({ response }) @@ -278,7 +278,7 @@ describe('conversationsStore', () => { store = new Vuex.Store(testStoreConfig) }) - test('make public', async() => { + test('make public', async () => { testConversation.type = CONVERSATION.TYPE.GROUP store.dispatch('addConversation', testConversation) @@ -296,7 +296,7 @@ describe('conversationsStore', () => { expect(changedConversation.type).toEqual(CONVERSATION.TYPE.PUBLIC) }) - test('make non-public', async() => { + test('make non-public', async () => { testConversation.type = CONVERSATION.TYPE.PUBLIC store.dispatch('addConversation', testConversation) @@ -314,7 +314,7 @@ describe('conversationsStore', () => { expect(changedConversation.type).toEqual(CONVERSATION.TYPE.GROUP) }) - test('set favorite', async() => { + test('set favorite', async () => { testConversation.isFavorite = false store.dispatch('addConversation', testConversation) @@ -332,7 +332,7 @@ describe('conversationsStore', () => { expect(changedConversation.isFavorite).toBe(true) }) - test('unset favorite', async() => { + test('unset favorite', async () => { testConversation.isFavorite = true store.dispatch('addConversation', testConversation) @@ -350,7 +350,7 @@ describe('conversationsStore', () => { expect(changedConversation.isFavorite).toBe(false) }) - test('enable lobby', async() => { + test('enable lobby', async () => { testConversation.lobbyState = WEBINAR.LOBBY.NONE store.dispatch('addConversation', testConversation) @@ -368,7 +368,7 @@ describe('conversationsStore', () => { expect(changedConversation.lobbyState).toBe(WEBINAR.LOBBY.NON_MODERATORS) }) - test('disable lobby', async() => { + test('disable lobby', async () => { testConversation.lobbyState = WEBINAR.LOBBY.NON_MODERATORS store.dispatch('addConversation', testConversation) @@ -386,7 +386,7 @@ describe('conversationsStore', () => { expect(changedConversation.lobbyState).toBe(WEBINAR.LOBBY.NONE) }) - test('set conversation name', async() => { + test('set conversation name', async () => { testConversation.displayName = 'initial name' store.dispatch('addConversation', testConversation) @@ -404,7 +404,7 @@ describe('conversationsStore', () => { expect(changedConversation.displayName).toBe('new name') }) - test('set conversation description', async() => { + test('set conversation description', async () => { testConversation.description = 'initial description' store.dispatch('addConversation', testConversation) @@ -422,7 +422,7 @@ describe('conversationsStore', () => { expect(changedConversation.description).toBe('new description') }) - test('enable read-only', async() => { + test('enable read-only', async () => { testConversation.readOnly = CONVERSATION.STATE.READ_WRITE store.dispatch('addConversation', testConversation) @@ -440,7 +440,7 @@ describe('conversationsStore', () => { expect(changedConversation.readOnly).toBe(CONVERSATION.STATE.READ_ONLY) }) - test('disable read-only', async() => { + test('disable read-only', async () => { testConversation.readOnly = CONVERSATION.STATE.READ_ONLY store.dispatch('addConversation', testConversation) @@ -458,7 +458,7 @@ describe('conversationsStore', () => { expect(changedConversation.readOnly).toBe(CONVERSATION.STATE.READ_WRITE) }) - test('set listable flag', async() => { + test('set listable flag', async () => { testConversation.readOnly = CONVERSATION.LISTABLE.NONE store.dispatch('addConversation', testConversation) @@ -476,7 +476,7 @@ describe('conversationsStore', () => { expect(changedConversation.listable).toBe(CONVERSATION.LISTABLE.ALL) }) - test('set lobby timer', async() => { + test('set lobby timer', async () => { testConversation.lobbyState = WEBINAR.LOBBY.NON_MODERATORS testConversation.lobbyTimer = 1200300 @@ -495,7 +495,7 @@ describe('conversationsStore', () => { expect(changedConversation.lobbyTimer).toBe(2300400) }) - test('set SIP enabled', async() => { + test('set SIP enabled', async () => { testConversation.sipEnabled = false store.dispatch('addConversation', testConversation) @@ -513,7 +513,7 @@ describe('conversationsStore', () => { expect(changedConversation.sipEnabled).toBe(true) }) - test('set notification level', async() => { + test('set notification level', async () => { testConversation.notificationLevel = 1 store.dispatch('addConversation', testConversation) @@ -586,7 +586,7 @@ describe('conversationsStore', () => { }) describe('creating conversations', () => { - test('creates one to one conversation', async() => { + test('creates one to one conversation', async () => { const newConversation = { id: 999, token: 'new-token', diff --git a/src/store/fileUploadStore.js b/src/store/fileUploadStore.js index 41583d19b..ca11d271e 100644 --- a/src/store/fileUploadStore.js +++ b/src/store/fileUploadStore.js @@ -189,6 +189,8 @@ const actions = { /** * Initialises uploads and shares files to a conversation * + * @param files.commit + * @param files.dispatch * @param {object} files the files to be processed * @param {string} token the conversation's token where to share the files * @param {number} uploadId a unique id for the upload operation indexing @@ -230,8 +232,12 @@ const actions = { /** * Discards an upload + * * @param {object} param0 Commit and state + * @param param0.commit + * @param param0.state * @param {object} uploadId The unique uploadId + * @param param0.getters */ discardUpload({ commit, state, getters }, uploadId) { if (state.currentUploadId === uploadId) { @@ -243,8 +249,13 @@ const actions = { /** * Uploads the files to the root directory of the user + * * @param {object} param0 Commit, state and getters + * @param param0.commit + * @param param0.dispatch * @param {object} uploadId The unique uploadId + * @param param0.state + * @param param0.getters */ async uploadFiles({ commit, dispatch, state, getters }, uploadId) { if (state.currentUploadId === uploadId) { @@ -354,8 +365,13 @@ const actions = { /** * Mark a file as shared + * * @param {object} context default store context; * @param {object} param1 The unique upload id original file index + * @param context.commit + * @param context.state + * @param param1.uploadId + * @param param1.index * @throws {Error} when the item is already being shared by another async call */ markFileAsSharing({ commit, state }, { uploadId, index }) { @@ -367,8 +383,11 @@ const actions = { /** * Mark a file as shared + * * @param {object} context default store context; * @param {object} param1 The unique upload id original file index + * @param param1.uploadId + * @param param1.index */ markFileAsShared(context, { uploadId, index }) { context.commit('markFileAsShared', { uploadId, index }) @@ -376,7 +395,9 @@ const actions = { /** * Mark a file as shared + * * @param {object} context default store context; + * @param context.commit * @param {string} temporaryMessageId message id of the temporary message associated to the file to remove */ removeFileFromSelection({ commit }, temporaryMessageId) { diff --git a/src/store/fileUploadStore.spec.js b/src/store/fileUploadStore.spec.js index ebcdeaecd..fe065366e 100644 --- a/src/store/fileUploadStore.spec.js +++ b/src/store/fileUploadStore.spec.js @@ -89,7 +89,7 @@ describe('fileUploadStore', () => { restoreConsole() }) - test('initialises upload for given files', async() => { + test('initialises upload for given files', async () => { const files = [ { name: 'pngimage.png', @@ -132,7 +132,7 @@ describe('fileUploadStore', () => { expect(mockedActions.createTemporaryMessage.mock.calls[2][1].localUrl).toBe('icon-url:text/plain') }) - test('performs upload by uploading then sharing', async() => { + test('performs upload by uploading then sharing', async () => { const files = [ { name: 'pngimage.png', @@ -181,7 +181,7 @@ describe('fileUploadStore', () => { expect(store.getters.currentUploadId).not.toBeDefined() }) - test('marks temporary message as failed in case of upload error', async() => { + test('marks temporary message as failed in case of upload error', async () => { const files = [ { name: 'pngimage.png', @@ -218,7 +218,7 @@ describe('fileUploadStore', () => { expect(console.error).toHaveBeenCalled() }) - test('marks temporary message as failed in case of sharing error', async() => { + test('marks temporary message as failed in case of sharing error', async () => { const files = [ { name: 'pngimage.png', @@ -256,7 +256,7 @@ describe('fileUploadStore', () => { expect(console.error).toHaveBeenCalled() }) - test('removes file from selection', async() => { + test('removes file from selection', async () => { const files = [ { name: 'pngimage.png', @@ -287,7 +287,7 @@ describe('fileUploadStore', () => { expect(Object.values(uploads)[0].file).toBe(files[0]) }) - test('discard an entire upload', async() => { + test('discard an entire upload', async () => { const files = [ { name: 'pngimage.png', @@ -317,7 +317,7 @@ describe('fileUploadStore', () => { expect(store.getters.currentUploadId).not.toBeDefined() }) - test('autorenames files using timestamps when requested', async() => { + test('autorenames files using timestamps when requested', async () => { const files = [ { name: 'pngimage.png', @@ -349,7 +349,7 @@ describe('fileUploadStore', () => { }) }) - test('set attachment folder', async() => { + test('set attachment folder', async () => { store = new Vuex.Store(storeConfig) setAttachmentFolder.mockResolvedValue() diff --git a/src/store/guestNameStore.js b/src/store/guestNameStore.js index 53e3ff014..759568649 100644 --- a/src/store/guestNameStore.js +++ b/src/store/guestNameStore.js @@ -29,8 +29,9 @@ const state = { const getters = { /** * Gets the participants array + * * @param {object} state the state object. - * @returns {array} the participants array (if there are participants in the store) + * @return {Array} the participants array (if there are participants in the store) */ getGuestName: (state) => (token, actorId) => { if (state.guestNames[token] && state.guestNames[token][actorId]) { @@ -43,6 +44,7 @@ const getters = { const mutations = { /** * Adds a guest name to the store + * * @param {object} state current store state * @param {boolean} noUpdate Only set the guest name if it was not set before * @param {string} token the token of the conversation diff --git a/src/store/messagesStore.js b/src/store/messagesStore.js index 6b878ad1c..c00736c7c 100644 --- a/src/store/messagesStore.js +++ b/src/store/messagesStore.js @@ -40,9 +40,9 @@ import { * Returns whether the given message contains a mention to self, directly * or indirectly through a global mention. * - * @param {Object} context store context - * @param {Object} message message object - * @returns {bool} true if the message contains a mention to self or all, + * @param {object} context store context + * @param {object} message message object + * @return {bool} true if the message contains a mention to self or all, * false otherwise */ function hasMentionToSelf(context, message) { @@ -118,7 +118,7 @@ const getters = { * * @param {object} state the state object. * @param {object} getters the getters object. - * @returns {bool} true if more messages exist that needs loading, false otherwise + * @return {bool} true if more messages exist that needs loading, false otherwise */ hasMoreMessagesToLoad: (state, getters) => (token) => { const conversation = getters.conversation(token) @@ -131,8 +131,9 @@ const getters = { /** * Gets the messages array + * * @param {object} state the state object. - * @returns {array} the messages array (if there are messages in the store) + * @return {Array} the messages array (if there are messages in the store) */ messagesList: (state) => (token) => { if (state.messages[token]) { @@ -142,9 +143,10 @@ const getters = { }, /** * Gets the messages object + * * @param {object} state the state object. * @param {string} token the conversation token. - * @returns {object} the messages object (if there are messages in the store) + * @return {object} the messages object (if there are messages in the store) */ messages: (state) => (token) => { if (state.messages[token]) { @@ -154,10 +156,11 @@ const getters = { }, /** * Gets a single message object + * * @param {object} state the state object. * @param {string} token the conversation token. * @param {string} id the message id. - * @returns {object} the message object (if the message is found in the store) + * @return {object} the message object (if the message is found in the store) */ message: (state) => (token, id) => { if (state.messages[token][id]) { @@ -227,6 +230,7 @@ const mutations = { /** * Adds a message to the store. + * * @param {object} state current store state; * @param {object} message the message; */ @@ -244,6 +248,7 @@ const mutations = { }, /** * Deletes a message from the store. + * * @param {object} state current store state; * @param {object} message the message; */ @@ -255,9 +260,12 @@ const mutations = { /** * Deletes a message from the store. + * * @param {object} state current store state; + * @param message.message * @param {object} message the message; * @param {string} placeholder Placeholder message until deleting finished + * @param message.placeholder */ markMessageAsDeleting(state, { message, placeholder }) { Vue.set(state.messages[message.token][message.id], 'messageType', 'comment_deleted') @@ -265,6 +273,7 @@ const mutations = { }, /** * Adds a temporary message to the store. + * * @param {object} state current store state; * @param {object} message the temporary message; */ @@ -277,9 +286,12 @@ const mutations = { /** * Adds a temporary message to the store. + * * @param {object} state current store state; + * @param message.message * @param {object} message the temporary message; * @param {string} reason the reason the temporary message failed; + * @param message.reason */ markTemporaryMessageAsFailed(state, { message, reason }) { if (state.messages[message.token][message.id]) { @@ -367,8 +379,10 @@ const actions = { * Delete a message * * @param {object} context default store context; + * @param message.message * @param {object} message the message to be deleted; * @param {string} placeholder Placeholder message until deleting finished + * @param message.placeholder */ async deleteMessage(context, { message, placeholder }) { const messageObject = Object.assign({}, context.getters.message(message.token, message.id)) @@ -405,7 +419,7 @@ const actions = { * @param {int} index index; * @param {object} file file to upload; * @param {string} localUrl local URL of file to upload; - * @returns {object} temporary message + * @return {object} temporary message */ createTemporaryMessage(context, { text, token, uploadId, index, file, localUrl, isVoiceMessage }) { const messageToBeReplied = context.getters.getMessageToBeReplied(token) @@ -470,8 +484,10 @@ const actions = { * Mark a temporary message as failed to allow retrying it again * * @param {object} context default store context; + * @param message.message * @param {object} message the temporary message; * @param {string} reason the reason the temporary message failed; + * @param message.reason */ markTemporaryMessageAsFailed(context, { message, reason }) { context.commit('markTemporaryMessageAsFailed', { message, reason }) @@ -529,8 +545,10 @@ const actions = { * in the conversation. * * @param {object} context default store context; + * @param token.token * @param {object} token the token of the conversation to be updated; * @param {bool} updateVisually whether to also clear the marker visually in the UI; + * @param token.updateVisually */ async clearLastReadMessage(context, { token, updateVisually = false }) { const conversation = context.getters.conversations[token] @@ -547,9 +565,12 @@ const actions = { * Optionally also updated the marker visually in the UI if specified. * * @param {object} context default store context; + * @param token.token * @param {object} token the token of the conversation to be updated; * @param {number} id the id of the message on which to set the read marker; * @param {bool} updateVisually whether to also update the marker visually in the UI; + * @param token.id + * @param token.updateVisually */ async updateLastReadMessage(context, { token, id = 0, updateVisually = false }) { const conversation = context.getters.conversations[token] @@ -642,7 +663,7 @@ const actions = { * Cancels a previously running "fetchMessages" action if applicable. * * @param {object} context default store context; - * @returns {bool} true if a request got cancelled, false otherwise + * @return {bool} true if a request got cancelled, false otherwise */ cancelFetchMessages(context) { if (context.state.cancelFetchMessages) { @@ -751,7 +772,7 @@ const actions = { * * @param {object} context default store context; * @param {string} requestId request id - * @returns {bool} true if a request got cancelled, false otherwise + * @return {bool} true if a request got cancelled, false otherwise */ cancelLookForNewMessages(context, { requestId }) { if (context.state.cancelLookForNewMessages[requestId]) { @@ -865,7 +886,7 @@ const actions = { * * @param {object} context default store context; * @param {string} messageId the message id for which to cancel; - * @returns {bool} true if a request got cancelled, false otherwise + * @return {bool} true if a request got cancelled, false otherwise */ cancelPostNewMessage(context, { messageId }) { if (context.state.cancelPostNewMessage[messageId]) { @@ -878,9 +899,11 @@ const actions = { /** * Posts a simple text message to a room + * * @param {object} context default store context; * will be forwarded; * @param {object} message the message object; + * @param message.messageToBeForwarded */ async forwardMessage(context, { messageToBeForwarded }) { const response = await postNewMessage(messageToBeForwarded) diff --git a/src/store/messagesStore.spec.js b/src/store/messagesStore.spec.js index 6d96be7b6..8d416fb30 100644 --- a/src/store/messagesStore.spec.js +++ b/src/store/messagesStore.spec.js @@ -164,7 +164,7 @@ describe('messagesStore', () => { store.dispatch('processMessage', message) }) - test('deletes from server and replaces with returned system message', async() => { + test('deletes from server and replaces with returned system message', async () => { deleteMessage.mockResolvedValueOnce({ status: 200, data: { @@ -191,7 +191,7 @@ describe('messagesStore', () => { }]) }) - test('deletes from server and replaces with returned system message including parent', async() => { + test('deletes from server and replaces with returned system message including parent', async () => { deleteMessage.mockResolvedValueOnce({ status: 200, data: { @@ -285,7 +285,7 @@ describe('messagesStore', () => { store = new Vuex.Store(testStoreConfig) }) - test('creates temporary message', async() => { + test('creates temporary message', async () => { const temporaryMessage = await store.dispatch('createTemporaryMessage', { text: 'blah', token: TOKEN, @@ -317,7 +317,7 @@ describe('messagesStore', () => { }) }) - test('creates temporary message with message to be replied', async() => { + test('creates temporary message with message to be replied', async () => { getMessageToBeRepliedMock.mockReset() getMessageToBeRepliedMock.mockReturnValue(() => ({ id: 123, @@ -350,7 +350,7 @@ describe('messagesStore', () => { }) }) - test('creates temporary message with file', async() => { + test('creates temporary message with file', async () => { const file = { type: 'text/plain', name: 'original-name.txt', @@ -393,7 +393,7 @@ describe('messagesStore', () => { }) }) - test('adds temporary message to the list', async() => { + test('adds temporary message to the list', async () => { const temporaryMessage = await store.dispatch('createTemporaryMessage', { text: 'blah', token: TOKEN, @@ -444,7 +444,7 @@ describe('messagesStore', () => { }]) }) - test('marks temporary message as failed', async() => { + test('marks temporary message as failed', async () => { const temporaryMessage = await store.dispatch('createTemporaryMessage', { text: 'blah', token: TOKEN, @@ -477,7 +477,7 @@ describe('messagesStore', () => { }]) }) - test('removeTemporaryMessageFromStore', async() => { + test('removeTemporaryMessageFromStore', async () => { const temporaryMessage = await store.dispatch('createTemporaryMessage', { text: 'blah', token: TOKEN, @@ -493,7 +493,7 @@ describe('messagesStore', () => { expect(store.getters.messagesList(TOKEN)).toStrictEqual([]) }) - test('gets temporary message by reference', async() => { + test('gets temporary message by reference', async () => { const temporaryMessage = await store.dispatch('createTemporaryMessage', { text: 'blah', token: TOKEN, @@ -574,7 +574,7 @@ describe('messagesStore', () => { expect(store.getters.getVisualLastReadMessageId('token-2')).toBe(2) }) - test('clears last read message', async() => { + test('clears last read message', async () => { getUserIdMock.mockReturnValue(() => 'user-1') store.dispatch('setVisualLastReadMessageId', { token: TOKEN, id: 100 }) @@ -595,7 +595,7 @@ describe('messagesStore', () => { expect(store.getters.getVisualLastReadMessageId(TOKEN)).toBe(100) }) - test('clears last read message and update visually', async() => { + test('clears last read message and update visually', async () => { getUserIdMock.mockReturnValue(() => 'user-1') store.dispatch('setVisualLastReadMessageId', { token: TOKEN, id: 100 }) @@ -616,7 +616,7 @@ describe('messagesStore', () => { expect(store.getters.getVisualLastReadMessageId(TOKEN)).toBe(123) }) - test('clears last read message for guests', async() => { + test('clears last read message for guests', async () => { getUserIdMock.mockReturnValue(() => null) store.dispatch('setVisualLastReadMessageId', { token: TOKEN, id: 100 }) @@ -637,7 +637,7 @@ describe('messagesStore', () => { expect(store.getters.getVisualLastReadMessageId(TOKEN)).toBe(123) }) - test('updates last read message', async() => { + test('updates last read message', async () => { getUserIdMock.mockReturnValue(() => 'user-1') store.dispatch('setVisualLastReadMessageId', { token: TOKEN, id: 100 }) @@ -659,7 +659,7 @@ describe('messagesStore', () => { expect(store.getters.getVisualLastReadMessageId(TOKEN)).toBe(100) }) - test('updates last read message and update visually', async() => { + test('updates last read message and update visually', async () => { getUserIdMock.mockReturnValue(() => 'user-1') store.dispatch('setVisualLastReadMessageId', { token: TOKEN, id: 100 }) @@ -681,7 +681,7 @@ describe('messagesStore', () => { expect(store.getters.getVisualLastReadMessageId(TOKEN)).toBe(200) }) - test('updates last read message for guests', async() => { + test('updates last read message for guests', async () => { getUserIdMock.mockReturnValue(() => null) store.dispatch('setVisualLastReadMessageId', { token: TOKEN, id: 100 }) @@ -728,7 +728,7 @@ describe('messagesStore', () => { store = new Vuex.Store(testStoreConfig) }) - test('fetches messages from server including last known', async() => { + test('fetches messages from server including last known', async () => { const messages = [{ id: 1, token: TOKEN, @@ -779,7 +779,7 @@ describe('messagesStore', () => { expect(store.getters.getLastKnownMessageId(TOKEN)).toBe(2) }) - test('fetches messages from server excluding last known', async() => { + test('fetches messages from server excluding last known', async () => { const messages = [{ id: 1, token: TOKEN, @@ -847,7 +847,7 @@ describe('messagesStore', () => { expect(store.state.cancelFetchMessages).toBe(null) }) - test('cancels fetching messages when fetching again', async() => { + test('cancels fetching messages when fetching again', async () => { store.dispatch('fetchMessages', { token: TOKEN, lastKnownMessageId: 100, @@ -899,7 +899,7 @@ describe('messagesStore', () => { store = new Vuex.Store(testStoreConfig) }) - test('looks for new messages', async() => { + test('looks for new messages', async () => { const messages = [{ id: 1, token: TOKEN, @@ -958,7 +958,7 @@ describe('messagesStore', () => { expect(store.getters.getFirstKnownMessageId(TOKEN)).toBe(null) }) - test('looks for new messages does not update last message if lower', async() => { + test('looks for new messages does not update last message if lower', async () => { const messages = [{ id: 1, token: TOKEN, @@ -998,7 +998,7 @@ describe('messagesStore', () => { expect(store.getters.getLastKnownMessageId(TOKEN)).toBe(null) }) - test('cancels look for new messages', async() => { + test('cancels look for new messages', async () => { store.dispatch('lookForNewMessages', { token: TOKEN, requestId: 'request1', @@ -1012,7 +1012,7 @@ describe('messagesStore', () => { expect(cancelFunctionMocks[0]).toHaveBeenCalledWith('canceled') }) - test('cancels look for new messages when called again', async() => { + test('cancels look for new messages when called again', async () => { store.dispatch('lookForNewMessages', { token: TOKEN, requestId: 'request1', @@ -1028,7 +1028,7 @@ describe('messagesStore', () => { expect(cancelFunctionMocks[0]).toHaveBeenCalledWith('canceled') }) - test('cancels look for new messages call individually', async() => { + test('cancels look for new messages call individually', async () => { store.dispatch('lookForNewMessages', { token: TOKEN, requestId: 'request1', @@ -1061,6 +1061,10 @@ describe('messagesStore', () => { } }) + /** + * @param messages + * @param expectedPayload + */ async function testUpdateMessageCounters(messages, expectedPayload) { const response = { headers: { @@ -1092,7 +1096,7 @@ describe('messagesStore', () => { } describe('updating unread messages counter', () => { - test('updates unread message counter for regular messages', async() => { + test('updates unread message counter for regular messages', async () => { const messages = [{ id: 101, token: TOKEN, @@ -1110,7 +1114,7 @@ describe('messagesStore', () => { await testUpdateMessageCounters(messages, expectedPayload) }) - test('skips system messages when counting unread messages', async() => { + test('skips system messages when counting unread messages', async () => { const messages = [{ id: 101, token: TOKEN, @@ -1129,7 +1133,7 @@ describe('messagesStore', () => { await testUpdateMessageCounters(messages, expectedPayload) }) - test('only counts unread messages from the last unread message', async() => { + test('only counts unread messages from the last unread message', async () => { const messages = [{ id: 99, token: TOKEN, @@ -1156,7 +1160,7 @@ describe('messagesStore', () => { await testUpdateMessageCounters(messages, expectedPayload) }) - test('does not update counter if no new messages were found', async() => { + test('does not update counter if no new messages were found', async () => { const messages = [{ // this one is the last read message so doesn't count id: 100, @@ -1166,7 +1170,7 @@ describe('messagesStore', () => { await testUpdateMessageCounters(messages, null) }) - test('does not update counter if the conversation store is already in sync', async() => { + test('does not update counter if the conversation store is already in sync', async () => { // same as the retrieved message, conversation is in sync testConversation.lastMessage.id = 102 const messages = [{ @@ -1198,6 +1202,10 @@ describe('messagesStore', () => { store = new Vuex.Store(testStoreConfig) }) + /** + * @param messageParameters + * @param expectedValue + */ async function testMentionFlag(messageParameters, expectedValue) { const messages = [{ id: 101, @@ -1213,7 +1221,7 @@ describe('messagesStore', () => { await testUpdateMessageCounters(messages, expectedPayload) } - test('updates unread mention flag for global message', async() => { + test('updates unread mention flag for global message', async () => { await testMentionFlag({ 'mention-1': { type: 'call', @@ -1221,7 +1229,7 @@ describe('messagesStore', () => { }, true) }) - test('updates unread mention flag for guest mention', async() => { + test('updates unread mention flag for guest mention', async () => { getActorIdMock.mockReturnValue(() => 'me_as_guest') getActorTypeMock.mockReturnValue(() => ATTENDEE.ACTOR_TYPE.GUESTS) await testMentionFlag({ @@ -1236,7 +1244,7 @@ describe('messagesStore', () => { }, true) }) - test('does not update unread mention flag for a different guest mention', async() => { + test('does not update unread mention flag for a different guest mention', async () => { getActorIdMock.mockReturnValue(() => 'me_as_guest') getActorTypeMock.mockReturnValue(() => ATTENDEE.ACTOR_TYPE.GUESTS) await testMentionFlag({ @@ -1247,7 +1255,7 @@ describe('messagesStore', () => { }, undefined) }) - test('updates unread mention flag for user mention', async() => { + test('updates unread mention flag for user mention', async () => { getUserIdMock.mockReturnValue(() => 'me_as_user') getActorTypeMock.mockReturnValue(() => ATTENDEE.ACTOR_TYPE.USERS) await testMentionFlag({ @@ -1262,7 +1270,7 @@ describe('messagesStore', () => { }, true) }) - test('does not update unread mention flag for another user mention', async() => { + test('does not update unread mention flag for another user mention', async () => { getUserIdMock.mockReturnValue(() => 'me_as_user') getActorTypeMock.mockReturnValue(() => ATTENDEE.ACTOR_TYPE.USERS) await testMentionFlag({ @@ -1273,12 +1281,12 @@ describe('messagesStore', () => { }, undefined) }) - test('does not update unread mention flag when no params', async() => { + test('does not update unread mention flag when no params', async () => { await testMentionFlag({}, undefined) await testMentionFlag(null, undefined) }) - test('does not update unread mention flag when already set', async() => { + test('does not update unread mention flag when already set', async () => { testConversation.unreadMention = true await testMentionFlag({ 'mention-1': { @@ -1287,7 +1295,7 @@ describe('messagesStore', () => { }, undefined) }) - test('does not update unread mention flag for non-mention parameter', async() => { + test('does not update unread mention flag for non-mention parameter', async () => { testConversation.unreadMention = true await testMentionFlag({ 'file-1': { @@ -1296,7 +1304,7 @@ describe('messagesStore', () => { }, undefined) }) - test('does not update unread mention flag for previously read messages', async() => { + test('does not update unread mention flag for previously read messages', async () => { const messages = [{ // this message was already read id: 100, @@ -1373,7 +1381,7 @@ describe('messagesStore', () => { restoreConsole() }) - test('posts new message', async() => { + test('posts new message', async () => { const temporaryMessage = { id: 'temp-123', message: 'blah', @@ -1477,6 +1485,10 @@ describe('messagesStore', () => { expect(store.getters.isSendingMessages).toBe(false) }) + /** + * @param statusCode + * @param reasonCode + */ async function testMarkMessageErrors(statusCode, reasonCode) { const temporaryMessage = { id: 'temp-123', @@ -1512,15 +1524,15 @@ describe('messagesStore', () => { expect(console.error).toHaveBeenCalled() } - test('marks message as failed on permission denied', async() => { + test('marks message as failed on permission denied', async () => { await testMarkMessageErrors(403, 'read-only') }) - test('marks message as failed when lobby enabled', async() => { + test('marks message as failed when lobby enabled', async () => { await testMarkMessageErrors(412, 'lobby') }) - test('marks message as failed with generic error', async() => { + test('marks message as failed with generic error', async () => { await testMarkMessageErrors(500, 'other') }) @@ -1550,7 +1562,7 @@ describe('messagesStore', () => { ]) }) - test('does not timeout after request returns', async() => { + test('does not timeout after request returns', async () => { const temporaryMessage = { id: 'temp-123', message: 'blah', @@ -1584,6 +1596,10 @@ describe('messagesStore', () => { }) describe('hasMoreMessagesToLoad', () => { + /** + * @param lastKnownMessageId + * @param lastConversationMessageId + */ function setupWithValues(lastKnownMessageId, lastConversationMessageId) { store.dispatch('setLastKnownMessageId', { token: TOKEN, id: 123 }) const conversationMock = jest.fn().mockReturnValue({ diff --git a/src/store/newGroupConversationStore.js b/src/store/newGroupConversationStore.js index 1f9b6d818..7029939bf 100644 --- a/src/store/newGroupConversationStore.js +++ b/src/store/newGroupConversationStore.js @@ -34,8 +34,9 @@ const getDefaultState = () => { const getters = { /** * Gets the selected participants array + * * @param {object} state the state object. - * @returns {array} the selected participants array + * @return {Array} the selected participants array */ selectedParticipants: (state) => { if (state.selectedParticipants) { @@ -48,6 +49,7 @@ const getters = { const mutations = { /** * Adds a the selected participants to the store. + * * @param {object} state current store state; * @param {object} participant the selected participant; */ @@ -57,6 +59,7 @@ const mutations = { /** * Adds a the selected participants to the store. + * * @param {object} state current store state; * @param {object} participant the selected participants */ @@ -68,6 +71,7 @@ const mutations = { /** * Purges the store + * * @param {object} state current store state; */ purgeNewGroupConversationStore(state) { @@ -81,6 +85,8 @@ const actions = { * Adds or removes the participant to the selected participants array * * @param {object} context default store context; + * @param context.commit + * @param context.state * @param {object} participant the clicked participant; */ updateSelectedParticipants({ commit, state }, participant) { diff --git a/src/store/participantsStore.js b/src/store/participantsStore.js index 24ad4dafa..4539dd379 100644 --- a/src/store/participantsStore.js +++ b/src/store/participantsStore.js @@ -61,8 +61,9 @@ const getters = { }, /** * Gets the participants array + * * @param {object} state the state object. - * @returns {array} the participants array (if there are participants in the store) + * @return {Array} the participants array (if there are participants in the store) */ participantsList: (state) => (token) => { if (state.participants[token]) { @@ -109,9 +110,12 @@ const getters = { const mutations = { /** * Adds a message to the store. + * * @param {object} state current store state; + * @param token.token * @param {object} token the token of the conversation; * @param {object} participant the participant; + * @param token.participant */ addParticipant(state, { token, participant }) { if (!state.participants[token]) { @@ -161,6 +165,7 @@ const mutations = { }, /** * Purges a given conversation from the previously added participants + * * @param {object} state current store state; * @param {string} token the conversation to purge; */ @@ -191,6 +196,7 @@ const actions = { * Only call this after purgeParticipantsStore, otherwise use addParticipantOnce * * @param {object} context default store context; + * @param context.commit * @param {string} token the conversation to add the participant; * @param {object} participant the participant; */ @@ -201,6 +207,8 @@ const actions = { * Only add a participant when they are not there yet * * @param {object} context default store context; + * @param context.commit + * @param context.getters * @param {string} token the conversation to add the participant; * @param {object} participant the participant; */ @@ -255,7 +263,9 @@ const actions = { }, /** * Purges a given conversation from the previously added participants + * * @param {object} context default store context; + * @param context.commit * @param {string} token the conversation to purge; */ purgeParticipantsStore({ commit }, token) { @@ -358,7 +368,7 @@ const actions = { * Resends email invitations for the given conversation. * If no userId is set, send to all applicable participants. * - * @param {Object} _ unused + * @param {object} _ unused * @param {string} token conversation token * @param {int} attendeeId attendee id to target, or null for all */ @@ -369,7 +379,7 @@ const actions = { /** * Makes the current user active in the given conversation. * - * @param {Object} context unused + * @param {object} context unused * @param {string} token conversation token */ async joinConversation(context, { token }) { @@ -457,7 +467,7 @@ const actions = { /** * Makes the current user inactive in the given conversation. * - * @param {Object} context unused + * @param {object} context unused * @param {string} token conversation token */ async leaveConversation(context, { token }) { @@ -468,7 +478,7 @@ const actions = { * Removes the current user from the conversation, which * means the user is not a participant any more. * - * @param {Object} context unused + * @param {object} context unused * @param {string} token conversation token */ async removeCurrentUserFromConversation(context, { token }) { diff --git a/src/store/participantsStore.spec.js b/src/store/participantsStore.spec.js index 3dd943ad9..4ba6c39e6 100644 --- a/src/store/participantsStore.spec.js +++ b/src/store/participantsStore.spec.js @@ -88,7 +88,7 @@ describe('participantsStore', () => { expect(removeAttendeeFromConversation).not.toHaveBeenCalled() }) - test('removes participant', async() => { + test('removes participant', async () => { store.dispatch('addParticipant', { token: TOKEN, participant: { attendeeId: 1 }, }) @@ -209,6 +209,10 @@ describe('participantsStore', () => { expect(promoteToModerator).not.toHaveBeenCalled() }) + /** + * @param participantType + * @param expectedParticipantType + */ async function testPromoteModerator(participantType, expectedParticipantType) { promoteToModerator.mockResolvedValue() @@ -234,10 +238,10 @@ describe('participantsStore', () => { ]) } - test('promotes given user to moderator', async() => { + test('promotes given user to moderator', async () => { await testPromoteModerator(PARTICIPANT.TYPE.USER, PARTICIPANT.TYPE.MODERATOR) }) - test('promotes given guest to guest moderator', async() => { + test('promotes given guest to guest moderator', async () => { await testPromoteModerator(PARTICIPANT.TYPE.GUEST, PARTICIPANT.TYPE.GUEST_MODERATOR) }) }) @@ -252,6 +256,10 @@ describe('participantsStore', () => { expect(demoteFromModerator).not.toHaveBeenCalled() }) + /** + * @param participantType + * @param expectedParticipantType + */ async function testDemoteModerator(participantType, expectedParticipantType) { promoteToModerator.mockResolvedValue() @@ -277,10 +285,10 @@ describe('participantsStore', () => { ]) } - test('demotes given moderator to user', async() => { + test('demotes given moderator to user', async () => { await testDemoteModerator(PARTICIPANT.TYPE.MODERATOR, PARTICIPANT.TYPE.USER) }) - test('promotes given guest to guest moderator', async() => { + test('promotes given guest to guest moderator', async () => { await testDemoteModerator(PARTICIPANT.TYPE.GUEST_MODERATOR, PARTICIPANT.TYPE.GUEST) }) }) @@ -324,7 +332,7 @@ describe('participantsStore', () => { store = new Vuex.Store(testStoreConfig) }) - test('joins call', async() => { + test('joins call', async () => { store.dispatch('addParticipant', { token: TOKEN, participant: { @@ -373,7 +381,7 @@ describe('participantsStore', () => { }) }) - test('joins and leaves call', async() => { + test('joins and leaves call', async () => { store.dispatch('addParticipant', { token: TOKEN, participant: { @@ -443,7 +451,7 @@ describe('participantsStore', () => { ]) }) - test('resends invitations', async() => { + test('resends invitations', async () => { resendInvitations.mockResolvedValue() await store.dispatch('resendInvitations', { @@ -484,7 +492,7 @@ describe('participantsStore', () => { }) }) - test('joins conversation', async() => { + test('joins conversation', async () => { store = new Vuex.Store(testStoreConfig) const response = { status: 200, @@ -512,7 +520,7 @@ describe('participantsStore', () => { expect(joinedConversationEventMock).toHaveBeenCalledWith({ token: TOKEN }) }) - test('force join conversation', async() => { + test('force join conversation', async () => { store = new Vuex.Store(testStoreConfig) const updatedParticipantData = Object.assign({}, participantData, { sessionId: 'another-session-id' }) const response = { @@ -560,6 +568,10 @@ describe('participantsStore', () => { restoreConsole() }) + /** + * @param lastPingAge + * @param inCall + */ function prepareTestJoinWithMaxPingAge(lastPingAge, inCall) { const mockDate = new Date('2020-01-01 20:00:00') participantData.lastPing = mockDate.getTime() / 1000 - lastPingAge @@ -580,7 +592,7 @@ describe('participantsStore', () => { } describe('when not in call', () => { - test('forces join when max ping age > 40s', async() => { + test('forces join when max ping age > 40s', async () => { prepareTestJoinWithMaxPingAge(41, PARTICIPANT.CALL_FLAG.DISCONNECTED) testStoreConfig.actions.forceJoinConversation = jest.fn() @@ -593,7 +605,7 @@ describe('participantsStore', () => { expect(testStoreConfig.actions.forceJoinConversation).toHaveBeenCalledWith(expect.anything(), { token: TOKEN }) }) - test('shows force when max ping age <= 40s', async() => { + test('shows force when max ping age <= 40s', async () => { prepareTestJoinWithMaxPingAge(40, PARTICIPANT.CALL_FLAG.DISCONNECTED) testStoreConfig.actions.forceJoinConversation = jest.fn() @@ -608,7 +620,7 @@ describe('participantsStore', () => { }) describe('when in call', () => { - test('forces join when max ping age > 60s', async() => { + test('forces join when max ping age > 60s', async () => { prepareTestJoinWithMaxPingAge(61, PARTICIPANT.CALL_FLAG.IN_CALL) testStoreConfig.actions.forceJoinConversation = jest.fn() @@ -621,7 +633,7 @@ describe('participantsStore', () => { expect(testStoreConfig.actions.forceJoinConversation).toHaveBeenCalledWith(expect.anything(), { token: TOKEN }) }) - test('shows force when max ping age <= 60s', async() => { + test('shows force when max ping age <= 60s', async () => { prepareTestJoinWithMaxPingAge(60, PARTICIPANT.CALL_FLAG.IN_CALL) testStoreConfig.actions.forceJoinConversation = jest.fn() @@ -637,7 +649,7 @@ describe('participantsStore', () => { }) }) - test('leaves conversation', async() => { + test('leaves conversation', async () => { leaveConversation.mockResolvedValue() await store.dispatch('leaveConversation', { token: TOKEN }) @@ -645,7 +657,7 @@ describe('participantsStore', () => { expect(leaveConversation).toHaveBeenCalledWith(TOKEN) }) - test('removes current user from conversation', async() => { + test('removes current user from conversation', async () => { removeCurrentUserFromConversation.mockResolvedValue() testStoreConfig = cloneDeep(participantsStore) diff --git a/src/store/sidebarStore.js b/src/store/sidebarStore.js index 8e8a3a936..4a75b0510 100644 --- a/src/store/sidebarStore.js +++ b/src/store/sidebarStore.js @@ -55,6 +55,7 @@ const mutations = { }, /** * Renaming state of the conversation + * * @param {object} state current store state; * @param {boolean} boolean the state of the renaming action; */ @@ -91,6 +92,7 @@ const actions = { }, /** * Renaming state of the conversation + * * @param {object} context default store context; * @param {boolean} boolean the state of the renaming action; */ diff --git a/src/store/tokenStore.js b/src/store/tokenStore.js index 29a785349..2eccd7342 100644 --- a/src/store/tokenStore.js +++ b/src/store/tokenStore.js @@ -29,7 +29,7 @@ const state = { * might have a window of time in which we might be in * conversation B in talk's UI while still leaving conversation * A in the signaling server. - **/ + */ lastJoinedConversationToken: '', } diff --git a/src/utils/cancelableRequest.js b/src/utils/cancelableRequest.js index b6344ce91..007fdf1da 100644 --- a/src/utils/cancelableRequest.js +++ b/src/utils/cancelableRequest.js @@ -2,6 +2,7 @@ * @copyright Copyright (c) 2019 Marco Ambrosini * * @author Marco Ambrosini + * * @author John Molakvoæ * * @license GNU AGPL version 3 or any later version @@ -26,8 +27,8 @@ import axios from '@nextcloud/axios' /** * Creates an axios 'cancelable request object'. * - * @param {function} request the axios promise request - * @returns {Object} The cancelable requests + * @param {Function} request the axios promise request + * @return {object} The cancelable requests * `object.request`: the api request funtion with the cancel token associated to it. * `object.cancel`: the cancel function, when call it's going to delete the request. */ @@ -43,7 +44,7 @@ const CancelableRequest = function(request) { * * @param {string} data the data to send the request to * @param {object} [options] optional config for the request - * @returns { object } + * @return { object } */ const fetch = async function(data, options) { return request( diff --git a/src/utils/clipboard.js b/src/utils/clipboard.js index 2167a6abb..bdab8d56d 100644 --- a/src/utils/clipboard.js +++ b/src/utils/clipboard.js @@ -1,15 +1,15 @@ /** - * @typedef {Object} ClipboardContent + * @typedef {object} ClipboardContent * @property {('file'|'text'|'none')} kind content type (file or text) * @property {File[] | FileList | undefined} files files array - * @property {String | undefined} text text content + * @property {string | undefined} text text content */ /** * Fetches the clipboard content from the event. * * @param {ClipboardEvent} event native event - * @returns {ClipboardContent} + * @return {ClipboardContent} */ const fetchClipboardContent = function(event) { const clipboardData = event.clipboardData diff --git a/src/utils/fileUpload.js b/src/utils/fileUpload.js index e07ea9f48..4fa0ebe4e 100644 --- a/src/utils/fileUpload.js +++ b/src/utils/fileUpload.js @@ -24,21 +24,22 @@ * Returns the file extension for the given path * * @param {string} path path - * @returns {string} file extension including the dot + * @return {string} file extension including the dot */ const getFileExtension = function(path) { return path.match(/\.[0-9a-z]+$/i) ? path.match(/\.[0-9a-z]+$/i)[0] : '' } /** - * Checks the existence of a path in a folder and if a match is found, returns - * a unique path for that folder. - * @param {object} client The webdav client object - * @param {string} userRoot user root path - * @param {string} path The path whose existence in the destination is to - * be checked - * @returns {string} The unique path - */ + * Checks the existence of a path in a folder and if a match is found, returns + * a unique path for that folder. + * + * @param {object} client The webdav client object + * @param {string} userRoot user root path + * @param {string} path The path whose existence in the destination is to + * be checked + * @return {string} The unique path + */ const findUniquePath = async function(client, userRoot, path) { // Return the input path if it doesn't exist in the destination folder if (await client.exists(userRoot + path) === false) { diff --git a/src/utils/signaling.js b/src/utils/signaling.js index e9f19f006..412273dba 100644 --- a/src/utils/signaling.js +++ b/src/utils/signaling.js @@ -1,12 +1,18 @@ /** * @copyright Copyright (c) 2019 Daniel Calviño Sánchez + * * @copyright Copyright (c) 2019 Ivan Sein + * * @copyright Copyright (c) 2019 Joachim Bauch + * * @copyright Copyright (c) 2019 Joas Schilling * * @author Daniel Calviño Sánchez + * * @author Ivan Sein + * * @author Joachim Bauch + * * @author Joas Schilling * * @license GNU AGPL version 3 or any later version @@ -49,8 +55,8 @@ const Signaling = { /** * Creates a connection to the signaling server * - * @param {Object} settings The signaling settings - * @returns {Standalone|Internal} + * @param {object} settings The signaling settings + * @return {Standalone|Internal} */ createConnection(settings) { if (!settings) { @@ -65,6 +71,9 @@ const Signaling = { }, } +/** + * @param settings + */ function Base(settings) { this.settings = settings this.sessionId = '' @@ -322,6 +331,9 @@ Signaling.Base.prototype.leaveCall = function(token, keepToken) { } // Connection to the internal signaling server provided by the app. +/** + * @param settings + */ function Internal(settings) { Signaling.Base.prototype.constructor.apply(this, arguments) this.hideWarning = settings.hideWarning @@ -420,8 +432,8 @@ Signaling.Internal.prototype.sendCallMessage = function(data) { } /** - * @private - */ + * @private + */ Signaling.Internal.prototype._startPullingMessages = function() { const token = this.currentRoomToken if (!token) { @@ -508,8 +520,8 @@ Signaling.Internal.prototype._startPullingMessages = function() { } /** - * @private - */ + * @private + */ Signaling.Internal.prototype.sendPendingMessages = function() { if (!this.spreedArrayConnection.length || this.isSendingMessages) { return @@ -527,6 +539,10 @@ Signaling.Internal.prototype.sendPendingMessages = function() { }.bind(this)) } +/** + * @param settings + * @param urls + */ function Standalone(settings, urls) { Signaling.Base.prototype.constructor.apply(this, arguments) if (typeof (urls) === 'string') { diff --git a/src/utils/webrtc/MediaDevicesManager.js b/src/utils/webrtc/MediaDevicesManager.js index b8081398c..e9bfe7d7f 100644 --- a/src/utils/webrtc/MediaDevicesManager.js +++ b/src/utils/webrtc/MediaDevicesManager.js @@ -176,7 +176,7 @@ MediaDevicesManager.prototype = { * technically supported by the browser but not available due to the page * being loaded in an insecure context. * - * @returns {boolean} true if MediaDevices interface is supported, false + * @return {boolean} true if MediaDevices interface is supported, false * otherwise. */ isSupported() { @@ -356,7 +356,7 @@ MediaDevicesManager.prototype = { * * @param {MediaStreamConstraints} constraints the constraints specifying * the media to request - * @returns {Promise} resolved with a MediaStream object when successful, or + * @return {Promise} resolved with a MediaStream object when successful, or * rejected with a DOMException in case of error */ getUserMedia(constraints) { diff --git a/src/utils/webrtc/index.js b/src/utils/webrtc/index.js index f2591455f..28dbe0575 100644 --- a/src/utils/webrtc/index.js +++ b/src/utils/webrtc/index.js @@ -46,6 +46,9 @@ let cancelFetchSignalingSettings = null let signaling = null let tokensInSignaling = {} +/** + * @param token + */ async function getSignalingSettings(token) { // If getSignalingSettings is called again while a previous one was still // being executed the previous one is cancelled. @@ -76,6 +79,9 @@ async function getSignalingSettings(token) { return settings } +/** + * @param token + */ async function connectSignaling(token) { const settings = await getSignalingSettings(token) if (!settings) { @@ -104,6 +110,10 @@ let pendingJoinCallToken = null let startedCall = null let failedToStartCall = null +/** + * @param signaling + * @param configuration + */ function startCall(signaling, configuration) { let flags = PARTICIPANT.CALL_FLAG.IN_CALL if (configuration) { @@ -122,6 +132,9 @@ function startCall(signaling, configuration) { }) } +/** + * + */ function setupWebRtc() { if (webRtc) { return @@ -137,7 +150,7 @@ function setupWebRtc() { * * @param {string} token Conversation to join * @param {string} sessionId Session id to join with - * @returns {Promise} + * @return {Promise} */ async function signalingJoinConversation(token, sessionId) { await connectSignaling(token) @@ -151,7 +164,7 @@ async function signalingJoinConversation(token, sessionId) { * * @param {string} token Conversation to join the call * @param {int} flags Bitwise combination of PARTICIPANT.CALL_FLAG - * @returns {Promise} Resolved with the actual flags based on the + * @return {Promise} Resolved with the actual flags based on the * available media */ async function signalingJoinCall(token, flags) { @@ -217,7 +230,7 @@ async function signalingJoinCall(token, flags) { * Leave the call of the given conversation * * @param {string} token Conversation to leave the call - * @returns {Promise} + * @return {Promise} */ async function signalingLeaveCall(token) { sentVideoQualityThrottler.destroy() @@ -235,7 +248,7 @@ async function signalingLeaveCall(token) { * Leave the given conversation on the respective signaling server * * @param {string} token Conversation to leave - * @returns {Promise} + * @return {Promise} */ async function signalingLeaveConversation(token) { if (tokensInSignaling[token]) { diff --git a/src/utils/webrtc/models/CallParticipantCollection.js b/src/utils/webrtc/models/CallParticipantCollection.js index e88ff6337..80a32bc97 100644 --- a/src/utils/webrtc/models/CallParticipantCollection.js +++ b/src/utils/webrtc/models/CallParticipantCollection.js @@ -21,6 +21,9 @@ import CallParticipantModel from './CallParticipantModel' +/** + * + */ export default function CallParticipantCollection() { this.callParticipantModels = [] diff --git a/src/utils/webrtc/models/CallParticipantModel.js b/src/utils/webrtc/models/CallParticipantModel.js index a58d56470..19863a7f9 100644 --- a/src/utils/webrtc/models/CallParticipantModel.js +++ b/src/utils/webrtc/models/CallParticipantModel.js @@ -33,6 +33,9 @@ export const ConnectionState = { CLOSED: 'closed', } +/** + * @param options + */ export default function CallParticipantModel(options) { this.attributes = { diff --git a/src/utils/webrtc/models/LocalCallParticipantModel.js b/src/utils/webrtc/models/LocalCallParticipantModel.js index 90ff133f9..1fa31602f 100644 --- a/src/utils/webrtc/models/LocalCallParticipantModel.js +++ b/src/utils/webrtc/models/LocalCallParticipantModel.js @@ -23,6 +23,9 @@ import store from '../../../store/index.js' import { ConnectionState } from './CallParticipantModel' +/** + * + */ export default function LocalCallParticipantModel() { this.attributes = { diff --git a/src/utils/webrtc/models/LocalMediaModel.js b/src/utils/webrtc/models/LocalMediaModel.js index 6a7fae7b4..9807a066d 100644 --- a/src/utils/webrtc/models/LocalMediaModel.js +++ b/src/utils/webrtc/models/LocalMediaModel.js @@ -21,6 +21,9 @@ import store from '../../../store/index.js' +/** + * + */ export default function LocalMediaModel() { this.attributes = { diff --git a/src/utils/webrtc/simplewebrtc/localmedia.js b/src/utils/webrtc/simplewebrtc/localmedia.js index 3bb273081..3ab6485d2 100644 --- a/src/utils/webrtc/simplewebrtc/localmedia.js +++ b/src/utils/webrtc/simplewebrtc/localmedia.js @@ -10,6 +10,9 @@ const UAParser = require('ua-parser-js') // being initialized yet. const webrtcIndex = require('../index.js') +/** + * @param stream + */ function isAllTracksEnded(stream) { let isAllTracksEnded = true stream.getTracks().forEach(function(t) { @@ -18,6 +21,9 @@ function isAllTracksEnded(stream) { return isAllTracksEnded } +/** + * @param stream + */ function isAllAudioTracksEnded(stream) { let isAllAudioTracksEnded = true stream.getAudioTracks().forEach(function(t) { @@ -26,6 +32,9 @@ function isAllAudioTracksEnded(stream) { return isAllAudioTracksEnded } +/** + * @param opts + */ function LocalMedia(opts) { WildEmitter.call(this) @@ -74,7 +83,7 @@ util.inherits(LocalMedia, WildEmitter) * MediaStreamTrack is ended. * * @param {MediaStreamTrack} track the track to clone - * @returns {MediaStreamTrack} the linked track + * @return {MediaStreamTrack} the linked track */ const cloneLinkedTrack = function(track) { const linkedTrack = track.clone() @@ -98,7 +107,7 @@ const cloneLinkedTrack = function(track) { * ended. * * @param {MediaStream} stream the stream to clone - * @returns {MediaStream} the linked stream + * @return {MediaStream} the linked stream */ const cloneLinkedStream = function(stream) { const linkedStream = new MediaStream() @@ -127,7 +136,7 @@ const cloneLinkedStream = function(stream) { * no media was available when started. An active local media will automatically * react to changes in the selected media devices. * - * @returns {bool} true if the local media is active, false otherwise + * @return {bool} true if the local media is active, false otherwise */ LocalMedia.prototype.isLocalMediaActive = function() { return this._localMediaActive @@ -143,7 +152,7 @@ LocalMedia.prototype.isLocalMediaActive = function() { * resolution, so if the camera does not have such resolution it will still * return the highest resolution available without failing. * - * @param {Object} constraints the constraints to be adjusted + * @param {object} constraints the constraints to be adjusted */ LocalMedia.prototype._adjustVideoConstraintsForChromium = function(constraints) { const parser = new UAParser() diff --git a/src/utils/webrtc/simplewebrtc/peer.js b/src/utils/webrtc/simplewebrtc/peer.js index 0d1e3222a..5e40e6d9b 100644 --- a/src/utils/webrtc/simplewebrtc/peer.js +++ b/src/utils/webrtc/simplewebrtc/peer.js @@ -7,6 +7,9 @@ const util = require('util') const webrtcSupport = require('webrtcsupport') const WildEmitter = require('wildemitter') +/** + * @param stream + */ function isAllTracksEnded(stream) { let isAllTracksEnded = true stream.getTracks().forEach(function(t) { @@ -15,6 +18,9 @@ function isAllTracksEnded(stream) { return isAllTracksEnded } +/** + * @param options + */ function Peer(options) { const self = this @@ -124,6 +130,9 @@ function Peer(options) { util.inherits(Peer, WildEmitter) +/** + * + */ function shouldPreferH264() { try { return initialState.loadState('spreed', 'prefer_h264') @@ -134,6 +143,9 @@ function shouldPreferH264() { } } +/** + * @param sessionDescription + */ function preferH264VideoCodecIfAvailable(sessionDescription) { const sdpInfo = sdpTransform.parse(sessionDescription.sdp) @@ -686,7 +698,7 @@ Peer.prototype.handleLocalTrackReplaced = function(newTrack, oldTrack, stream) { * be added rather than replaced, which requires a renegotiation. In both cases * the process will start again once the connection is restablished. * - * @returns {Promise} a Promise fulfilled when the processing ends; if it was + * @return {Promise} a Promise fulfilled when the processing ends; if it was * completed the resolved value is true, and if it was stopped before * finishing the resolved value is false. */ @@ -750,7 +762,7 @@ Peer.prototype._processPendingReplaceTracksAsync = async function() { * @param {MediaStreamTrack|null} newTrack the new track to set. * @param {MediaStreamTrack|null} oldTrack the old track to be replaced. * @param {MediaStream} stream the stream that the new track belongs to. - * @returns {Promise} + * @return {Promise} */ Peer.prototype._replaceTrack = async function(newTrack, oldTrack, stream) { let senderFound = false diff --git a/src/utils/webrtc/simplewebrtc/simplewebrtc.js b/src/utils/webrtc/simplewebrtc/simplewebrtc.js index c49287f3b..d1dbee6e1 100644 --- a/src/utils/webrtc/simplewebrtc/simplewebrtc.js +++ b/src/utils/webrtc/simplewebrtc/simplewebrtc.js @@ -6,6 +6,9 @@ const webrtcSupport = require('webrtcsupport') const attachMediaStream = require('attachmediastream') const mockconsole = require('mockconsole') +/** + * @param opts + */ function SimpleWebRTC(opts) { const self = this const options = opts || {} diff --git a/src/utils/webrtc/simplewebrtc/webrtc.js b/src/utils/webrtc/simplewebrtc/webrtc.js index 5c14c4913..7cfd08662 100644 --- a/src/utils/webrtc/simplewebrtc/webrtc.js +++ b/src/utils/webrtc/simplewebrtc/webrtc.js @@ -6,6 +6,9 @@ const mockconsole = require('mockconsole') const localMedia = require('./localmedia') const Peer = require('./peer') +/** + * @param opts + */ function WebRTC(opts) { const self = this const options = opts || {} diff --git a/src/utils/webrtc/webrtc.js b/src/utils/webrtc/webrtc.js index c7bc58437..0d8999196 100644 --- a/src/utils/webrtc/webrtc.js +++ b/src/utils/webrtc/webrtc.js @@ -1,12 +1,18 @@ /** * @copyright Copyright (c) 2019 Daniel Calviño Sánchez + * * @copyright Copyright (c) 2019 Ivan Sein + * * @copyright Copyright (c) 2019 Joachim Bauch + * * @copyright Copyright (c) 2019 Joas Schilling * * @author Daniel Calviño Sánchez + * * @author Ivan Sein + * * @author Joachim Bauch + * * @author Joas Schilling * * @license GNU AGPL version 3 or any later version @@ -51,12 +57,20 @@ let showedTURNWarning = false let sendCurrentStateWithRepetitionTimeout = null let startedWithMedia +/** + * @param a + * @param b + */ function arrayDiff(a, b) { return a.filter(function(i) { return b.indexOf(i) < 0 }) } +/** + * @param signaling + * @param sessionId + */ function createScreensharingPeer(signaling, sessionId) { const currentSessionId = signaling.getSessionId() const useMcu = signaling.hasFeature('mcu') @@ -120,6 +134,9 @@ function createScreensharingPeer(signaling, sessionId) { } } +/** + * @param signaling + */ function checkStartPublishOwnPeer(signaling) { 'use strict' const currentSessionId = signaling.getSessionId() @@ -174,6 +191,9 @@ function checkStartPublishOwnPeer(signaling) { }, 10000) } +/** + * + */ function sendCurrentMediaState() { if (!webrtc.webrtc.isVideoEnabled()) { webrtc.webrtc.emit('videoOff') @@ -190,10 +210,16 @@ function sendCurrentMediaState() { // TODO The participant name should be got from the participant list, but it is // not currently possible to associate a Nextcloud ID with a standalone // signaling ID for guests. +/** + * + */ function sendCurrentNick() { webrtc.webrtc.emit('nickChanged', store.getters.getDisplayName()) } +/** + * @param timeout + */ function sendCurrentStateWithRepetition(timeout) { if (!timeout) { timeout = 0 @@ -220,6 +246,9 @@ function sendCurrentStateWithRepetition(timeout) { }, timeout) } +/** + * @param user + */ function userHasStreams(user) { let flags = user if (Object.prototype.hasOwnProperty.call(flags, 'inCall')) { @@ -230,6 +259,11 @@ function userHasStreams(user) { return (flags & REQUIRED_FLAGS) !== 0 } +/** + * @param signaling + * @param newUsers + * @param disconnectedSessionIds + */ function usersChanged(signaling, newUsers, disconnectedSessionIds) { 'use strict' const currentSessionId = signaling.getSessionId() @@ -394,6 +428,10 @@ function usersChanged(signaling, newUsers, disconnectedSessionIds) { } } +/** + * @param signaling + * @param users + */ function usersInCallChanged(signaling, users) { const previousSelfInCall = selfInCall @@ -447,6 +485,11 @@ function usersInCallChanged(signaling, users) { } } +/** + * @param signaling + * @param _callParticipantCollection + * @param _localCallParticipantModel + */ export default function initWebRtc(signaling, _callParticipantCollection, _localCallParticipantModel) { callParticipantCollection = _callParticipantCollection localCallParticipantModel = _localCallParticipantModel @@ -611,6 +654,9 @@ export default function initWebRtc(signaling, _callParticipantCollection, _local webrtc.sendDirectlyToAll(channel, message, payload) } + /** + * @param peer + */ function handleIceConnectionStateConnected(peer) { // Send the current information about the state. if (!signaling.hasFeature('mcu')) { @@ -627,6 +673,9 @@ export default function initWebRtc(signaling, _callParticipantCollection, _local } } + /** + * @param peer + */ function handleIceConnectionStateDisconnected(peer) { setTimeout(function() { if (peer.pc.iceConnectionState !== 'disconnected') { @@ -653,6 +702,9 @@ export default function initWebRtc(signaling, _callParticipantCollection, _local }, 5000) } + /** + * @param peer + */ function handleIceConnectionStateFailed(peer) { if (!showedTURNWarning && !signaling.settings.turnservers.length) { showError( @@ -695,6 +747,9 @@ export default function initWebRtc(signaling, _callParticipantCollection, _local } } + /** + * @param peer + */ function setHandlerForIceConnectionStateChange(peer) { // Initialize ice restart counter for peer spreedPeerConnectionTable[peer.id] = 0 @@ -731,6 +786,9 @@ export default function initWebRtc(signaling, _callParticipantCollection, _local }) } + /** + * @param peer + */ function setHandlerForOwnIceConnectionStateChange(peer) { peer.pc.addEventListener('iceconnectionstatechange', function() { peer.emit('extendedIceConnectionStateChange', peer.pc.iceConnectionState) @@ -791,6 +849,9 @@ export default function initWebRtc(signaling, _callParticipantCollection, _local signaling.forceReconnect(true, flags) } + /** + * @param peer + */ function setHandlerForNegotiationNeeded(peer) { peer.pc.addEventListener('negotiationneeded', function() { // Negotiation needed will be first triggered before the connection @@ -951,6 +1012,11 @@ export default function initWebRtc(signaling, _callParticipantCollection, _local } }) + /** + * @param peer + * @param track + * @param mediaType + */ function checkPeerMedia(peer, track, mediaType) { return new Promise((resolve, reject) => { peer.pc.getStats(track).then(function(stats) { @@ -983,16 +1049,26 @@ export default function initWebRtc(signaling, _callParticipantCollection, _local }) } + /** + * @param peer + */ function stopPeerCheckAudioMedia(peer) { clearInterval(peer.check_audio_interval) peer.check_audio_interval = null } + /** + * @param peer + */ function stopPeerCheckVideoMedia(peer) { clearInterval(peer.check_video_interval) peer.check_video_interval = null } + /** + * @param peerId + * @param mediaType + */ function stopPeerIdCheckMediaType(peerId, mediaType) { // There should be just one video peer with that id, but iterating is // safer. @@ -1015,11 +1091,18 @@ export default function initWebRtc(signaling, _callParticipantCollection, _local }) } + /** + * @param peer + */ function stopPeerCheckMedia(peer) { stopPeerCheckAudioMedia(peer) stopPeerCheckVideoMedia(peer) } + /** + * @param peer + * @param stream + */ function startPeerCheckMedia(peer, stream) { stopPeerCheckMedia(peer) peer.check_video_interval = setInterval(function() { diff --git a/src/views/Dashboard.vue b/src/views/Dashboard.vue index e891dd6a9..4903f78ce 100644 --- a/src/views/Dashboard.vue +++ b/src/views/Dashboard.vue @@ -100,7 +100,8 @@ export default { * This is a simplified version of the last chat message. * Parameters are parsed without markup (just replaced with the name), * e.g. no avatars on mentions. - * @returns {string} A simple message to show below the conversation name + * + * @return {string} A simple message to show below the conversation name */ simpleLastChatMessage() { return (lastChatMessage) => { diff --git a/src/views/RoomSelector.spec.js b/src/views/RoomSelector.spec.js index 5ea7e53d9..14da0efe2 100644 --- a/src/views/RoomSelector.spec.js +++ b/src/views/RoomSelector.spec.js @@ -66,7 +66,7 @@ describe('RoomSelector.vue', () => { jest.clearAllMocks() }) - test('renders sorted conversation list fetched from server', async() => { + test('renders sorted conversation list fetched from server', async () => { const wrapper = shallowMount(RoomSelector) expect(mockAxios.get).toHaveBeenCalledWith( @@ -90,7 +90,7 @@ describe('RoomSelector.vue', () => { expect(list.at(1).text()).toBe('zzz') expect(list.at(2).text()).toBe('abc') }) - test('excludes non-postable conversations', async() => { + test('excludes non-postable conversations', async () => { const wrapper = shallowMount(RoomSelector, { propsData: { showPostableOnly: true, @@ -117,7 +117,7 @@ describe('RoomSelector.vue', () => { expect(list.at(0).text()).toBe('conversation one') expect(list.at(1).text()).toBe('zzz') }) - test('emits select event on select', async() => { + test('emits select event on select', async () => { const wrapper = shallowMount(RoomSelector) expect(mockAxios.get).toHaveBeenCalledWith( @@ -145,7 +145,7 @@ describe('RoomSelector.vue', () => { expect(eventHandler).toHaveBeenCalledWith('token-3') }) - test('emits close event', async() => { + test('emits close event', async () => { const wrapper = shallowMount(RoomSelector) const eventHandler = jest.fn() -- cgit v1.2.3