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
diff options
context:
space:
mode:
authorDaniel Calviño Sánchez <danxuliu@gmail.com>2020-01-05 19:02:39 +0300
committerDaniel Calviño Sánchez <danxuliu@gmail.com>2020-01-09 14:42:11 +0300
commit26a47813afb593ed9a504fc35b846fc9f0f50d8d (patch)
tree17e24d3b2033aff11b5778e5ec88a6025aa81649 /src
parente99cbef9e57919e3351ec455f529011e623e9a37 (diff)
Stop and start requests depending on the lobby state
When the current participant is in the lobby the messages and participants can not be fetched. Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/components/MessagesList/MessagesList.vue26
-rw-r--r--src/components/RightSidebar/Participants/ParticipantsTab.vue7
-rw-r--r--src/mixins/isInLobby.js48
3 files changed, 75 insertions, 6 deletions
diff --git a/src/components/MessagesList/MessagesList.vue b/src/components/MessagesList/MessagesList.vue
index 8f1ac8980..43cdeb7bc 100644
--- a/src/components/MessagesList/MessagesList.vue
+++ b/src/components/MessagesList/MessagesList.vue
@@ -47,6 +47,7 @@ import MessagesGroup from './MessagesGroup/MessagesGroup'
import { fetchMessages, lookForNewMessages } from '../../services/messagesService'
import CancelableRequest from '../../utils/cancelableRequest'
import Axios from '@nextcloud/axios'
+import isInLobby from '../../mixins/isInLobby'
export default {
name: 'MessagesList',
@@ -54,6 +55,10 @@ export default {
MessagesGroup,
},
+ mixins: [
+ isInLobby,
+ ],
+
props: {
/**
* The conversation token.
@@ -158,13 +163,18 @@ export default {
return true
},
+
+ conversation() {
+ return this.$store.getters.conversations[this.token]
+ },
},
watch: {
- // Watchers for "token" and "isParticipant" need to be separated and can
- // not be unified in a boolean computed property (as for example that
- // would not change when the token changes but the current participant
- // is a participant in the old and the new conversation).
+ // Watchers for "token", "isParticipant" and "isInLobby" need to be
+ // separated and can not be unified in a boolean computed property (as
+ // for example that would not change when the token changes but the
+ // current participant is a participant in the old and the new
+ // conversation).
token: {
immediate: true,
handler() {
@@ -178,6 +188,12 @@ export default {
this.handleStartGettingMessagesPreconditions()
},
},
+ isInLobby: {
+ immediate: true,
+ handler() {
+ this.handleStartGettingMessagesPreconditions()
+ },
+ },
},
beforeDestroy() {
@@ -290,7 +306,7 @@ export default {
},
handleStartGettingMessagesPreconditions() {
- if (this.token && this.isParticipant) {
+ if (this.token && this.isParticipant && !this.isInLobby) {
this.startGettingMessages()
} else {
this.cancelLookForNewMessages()
diff --git a/src/components/RightSidebar/Participants/ParticipantsTab.vue b/src/components/RightSidebar/Participants/ParticipantsTab.vue
index dc3f94f36..0110192b6 100644
--- a/src/components/RightSidebar/Participants/ParticipantsTab.vue
+++ b/src/components/RightSidebar/Participants/ParticipantsTab.vue
@@ -69,6 +69,7 @@ import { EventBus } from '../../../services/EventBus'
import { CONVERSATION, WEBINAR } from '../../../constants'
import { searchPossibleConversations } from '../../../services/conversationsService'
import { fetchParticipants } from '../../../services/participantsService'
+import isInLobby from '../../../mixins/isInLobby'
export default {
name: 'ParticipantsTab',
@@ -80,6 +81,10 @@ export default {
ParticipantsList,
},
+ mixins: [
+ isInLobby,
+ ],
+
props: {
displaySearchBox: {
type: Boolean,
@@ -206,7 +211,7 @@ export default {
},
async getParticipants() {
- if (this.token === '') {
+ if (this.token === '' || this.isInLobby) {
return
}
diff --git a/src/mixins/isInLobby.js b/src/mixins/isInLobby.js
new file mode 100644
index 000000000..b609d4d5c
--- /dev/null
+++ b/src/mixins/isInLobby.js
@@ -0,0 +1,48 @@
+/**
+ *
+ * @copyright Copyright (c) 2020, Daniel Calviño Sánchez <danxuliu@gmail.com>
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+import { PARTICIPANT, WEBINAR } from '../constants'
+
+/**
+ * Mixin to check whether the current participant is waiting in the lobby or
+ * not.
+ *
+ * Components using this mixin require a "conversation" property (that can be
+ * null) with, at least, "participantType" and "lobbyState" properties.
+ */
+export default {
+
+ computed: {
+ isModerator() {
+ return this.conversation
+ && (this.conversation.participantType === PARTICIPANT.TYPE.OWNER
+ || this.conversation.participantType === PARTICIPANT.TYPE.MODERATOR
+ || this.conversation.participantType === PARTICIPANT.TYPE.GUEST_MODERATOR)
+ },
+
+ isInLobby() {
+ return this.conversation
+ && this.conversation.lobbyState === WEBINAR.LOBBY.NON_MODERATORS
+ && !this.isModerator
+ },
+ },
+
+}