Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/spreed.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src/store
diff options
context:
space:
mode:
authormarco <marcoambrosini@pm.me>2021-10-15 12:55:33 +0300
committermarco <marcoambrosini@pm.me>2021-10-15 12:55:33 +0300
commitb4ade919ce8d2c3e2efd3a2f31216b827353fae2 (patch)
tree729c2180cd7b60617523653ee77f72fa8058f2c3 /src/store
parenta688328c676ef354020195b9d4f29ff3885b5e19 (diff)
Fix Styles
Signed-off-by: marco <marcoambrosini@pm.me>
Diffstat (limited to 'src/store')
-rw-r--r--src/store/participantsStore.js99
1 files changed, 56 insertions, 43 deletions
diff --git a/src/store/participantsStore.js b/src/store/participantsStore.js
index 7f1799d8e..c37e16e65 100644
--- a/src/store/participantsStore.js
+++ b/src/store/participantsStore.js
@@ -29,9 +29,7 @@ import {
leaveConversation,
removeCurrentUserFromConversation,
} from '../services/participantsService'
-import {
- generateUrl,
-} from '@nextcloud/router'
+import { generateUrl } from '@nextcloud/router'
import {
joinCall,
leaveCall,
@@ -56,14 +54,16 @@ const getters = {
isInCall: (state) => (token) => {
return !!(state.inCall[token] && Object.keys(state.inCall[token]).length > 0)
},
+
isConnecting: (state) => (token) => {
return !!(state.connecting[token] && Object.keys(state.connecting[token]).length > 0)
},
/**
- * Gets the participants array
+ * Gets the participants array.
*
- * @param {object} state the state object.
- * @return {Array} the participants array (if there are participants in the store)
+ * @param {object} state - the state object.
+ * @return {Array} the participants array (if there are participants in the
+ * store).
*/
participantsList: (state) => (token) => {
if (state.participants[token]) {
@@ -71,12 +71,14 @@ const getters = {
}
return []
},
+
getParticipant: (state) => (token, index) => {
if (state.participants[token] && state.participants[token][index]) {
return state.participants[token][index]
}
return {}
},
+
getParticipantIndex: (state) => (token, participantIdentifier) => {
if (!state.participants[token]) {
return -1
@@ -115,12 +117,12 @@ const getters = {
const mutations = {
/**
- * Adds a message to the store.
+ * Add a message to the store.
*
- * @param {object} state current store state;
- * @param {object} data the wrapping object;
- * @param {object} data.token the token of the conversation;
- * @param {object} data.participant the participant;
+ * @param {object} state - current store state.
+ * @param {object} data - the wrapping object.
+ * @param {object} data.token - the token of the conversation.
+ * @param {object} data.participant - the participant.
*/
addParticipant(state, { token, participant }) {
if (!state.participants[token]) {
@@ -128,6 +130,7 @@ const mutations = {
}
state.participants[token].push(participant)
},
+
updateParticipant(state, { token, index, updatedData }) {
if (state.participants[token] && state.participants[token][index]) {
state.participants[token][index] = Object.assign(state.participants[token][index], updatedData)
@@ -135,6 +138,7 @@ const mutations = {
console.error('Error while updating the participant')
}
},
+
deleteParticipant(state, { token, index }) {
if (state.participants[token] && state.participants[token][index]) {
Vue.delete(state.participants[token], index)
@@ -142,6 +146,7 @@ const mutations = {
console.error('The conversation you are trying to purge doesn\'t exist')
}
},
+
setInCall(state, { token, sessionId, flags }) {
if (flags === PARTICIPANT.CALL_FLAG.DISCONNECTED) {
if (state.inCall[token] && state.inCall[token][sessionId]) {
@@ -163,16 +168,18 @@ const mutations = {
Vue.set(state.connecting[token], sessionId, flags)
}
},
+
finishedConnecting(state, { token, sessionId }) {
if (state.connecting[token] && state.connecting[token][sessionId]) {
Vue.delete(state.connecting[token], sessionId)
}
},
+
/**
- * Purges a given conversation from the previously added participants
+ * Purge a given conversation from the previously added participants.
*
- * @param {object} state current store state;
- * @param {string} token the conversation to purge;
+ * @param {object} state - current store state.
+ * @param {string} token - the conversation to purge.
*/
purgeParticipantsStore(state, token) {
if (state.participants[token]) {
@@ -186,6 +193,7 @@ const mutations = {
}
Vue.set(state.peers[token], peer.sessionId, peer)
},
+
purgePeersStore(state, token) {
if (state.peers[token]) {
Vue.delete(state.peers, token)
@@ -194,30 +202,30 @@ const mutations = {
}
const actions = {
-
/**
- * Adds participant to the store.
+ * Add participant to the store.
*
- * Only call this after purgeParticipantsStore, otherwise use addParticipantOnce
+ * Only call this after purgeParticipantsStore, otherwise use addParticipantOnce.
*
- * @param {object} context default store context;
- * @param {Function} context.commit the contexts commit function.
- * @param {object} data the wrapping object;
- * @param {string} data.token the conversation to add the participant;
- * @param {object} data.participant the participant;
+ * @param {object} context - default store context.
+ * @param {Function} context.commit - the contexts commit function.
+ * @param {object} data - the wrapping object.
+ * @param {string} data.token - the conversation to add the participant.
+ * @param {object} data.participant - the participant.
*/
addParticipant({ commit }, { token, participant }) {
commit('addParticipant', { token, participant })
},
+
/**
* Only add a participant when they are not there yet
*
- * @param {object} context default store context;
- * @param {Function} context.commit the contexts commit function.
- * @param {object} context.getters the contexts getters object.
- * @param {object} data the wrapping object;
- * @param {string} data.token the conversation to add the participant;
- * @param {object} data.participant the participant;
+ * @param {object} context - default store context.
+ * @param {Function} context.commit - the contexts commit function.
+ * @param {object} context.getters - the contexts getters object.
+ * @param {object} data - the wrapping object.
+ * @param {string} data.token - the conversation to add the participant.
+ * @param {object} data.participant - the participant.
*/
addParticipantOnce({ commit, getters }, { token, participant }) {
const index = getters.getParticipantIndex(token, participant)
@@ -225,6 +233,7 @@ const actions = {
commit('addParticipant', { token, participant })
}
},
+
async promoteToModerator({ commit, getters }, { token, attendeeId }) {
const index = getters.getParticipantIndex(token, { attendeeId })
if (index === -1) {
@@ -242,6 +251,7 @@ const actions = {
}
commit('updateParticipant', { token, index, updatedData })
},
+
async demoteFromModerator({ commit, getters }, { token, attendeeId }) {
const index = getters.getParticipantIndex(token, { attendeeId })
if (index === -1) {
@@ -259,6 +269,7 @@ const actions = {
}
commit('updateParticipant', { token, index, updatedData })
},
+
async removeParticipant({ commit, getters }, { token, attendeeId }) {
const index = getters.getParticipantIndex(token, { attendeeId })
if (index === -1) {
@@ -268,6 +279,7 @@ const actions = {
await removeAttendeeFromConversation(token, attendeeId)
commit('deleteParticipant', { token, index })
},
+
/**
* Purges a given conversation from the previously added participants
*
@@ -282,6 +294,7 @@ const actions = {
addPeer({ commit }, { token, peer }) {
commit('addPeer', { token, peer })
},
+
purgePeersStore({ commit }, token) {
commit('purgePeersStore', token)
},
@@ -375,10 +388,10 @@ const actions = {
* Resends email invitations for the given conversation.
* If no userId is set, send to all applicable participants.
*
- * @param {object} _ unused
- * @param {object} data the wrapping object;
- * @param {string} data.token conversation token
- * @param {number} data.attendeeId attendee id to target, or null for all
+ * @param {object} _ - unused.
+ * @param {object} data - the wrapping object.
+ * @param {string} data.token - conversation token.
+ * @param {number} data.attendeeId - attendee id to target, or null for all.
*/
async resendInvitations(_, { token, attendeeId }) {
await resendInvitations(token, { attendeeId })
@@ -387,9 +400,9 @@ const actions = {
/**
* Makes the current user active in the given conversation.
*
- * @param {object} context unused
- * @param {object} data the wrapping object;
- * @param {string} data.token conversation token
+ * @param {object} context - unused.
+ * @param {object} data - the wrapping object.
+ * @param {string} data.token - conversation token.
*/
async joinConversation(context, { token }) {
const forceJoin = SessionStorage.getItem('joined_conversation') === token
@@ -476,21 +489,21 @@ const actions = {
/**
* Makes the current user inactive in the given conversation.
*
- * @param {object} context unused
- * @param {object} data the wrapping object;
- * @param {string} data.token conversation token
+ * @param {object} context - unused.
+ * @param {object} data - the wrapping object.
+ * @param {string} data.token - conversation token.
*/
async leaveConversation(context, { token }) {
await leaveConversation(token)
},
/**
- * Removes the current user from the conversation, which
- * means the user is not a participant any more.
+ * Removes the current user from the conversation, which means the user is
+ * not a participant any more.
*
- * @param {object} context unused
- * @param {object} data the wrapping object;
- * @param {string} data.token conversation token
+ * @param {object} context - The context object.
+ * @param {object} data - the wrapping object.
+ * @param {string} data.token - conversation token.
*/
async removeCurrentUserFromConversation(context, { token }) {
await removeCurrentUserFromConversation(token)