Page MenuHomePhorge

D2008.1774811940.diff
No OneTemporary

Authored By
Unknown
Size
8 KB
Referenced Files
None
Subscribers
None

D2008.1774811940.diff

diff --git a/src/resources/vue/Meet/Room.vue b/src/resources/vue/Meet/Room.vue
--- a/src/resources/vue/Meet/Room.vue
+++ b/src/resources/vue/Meet/Room.vue
@@ -70,9 +70,8 @@
<input type="password" class="form-control" id="setup-password" v-model="password" placeholder="Password">
</div>
<div class="mt-3">
- <button type="button"
+ <button type="button" id="join-button"
@click="joinSession"
- :disabled="roomState == 'init' || roomState == 327 || roomState == 404"
:class="'btn w-100 btn-' + (isRoomReady() ? 'success' : 'primary')"
>
<span v-if="isRoomReady()">JOIN NOW</span>
@@ -130,6 +129,8 @@
import LogonForm from '../Login'
import SessionSecurityOptions from './SessionSecurityOptions'
+ let roomRequest
+
export default {
components: {
LogonForm,
@@ -177,7 +178,7 @@
this.setupSession()
},
beforeDestroy() {
- clearTimeout(window.roomRequest)
+ clearTimeout(roomRequest)
if (this.meet) {
this.meet.leaveRoom()
@@ -198,6 +199,8 @@
axios.post('/api/v4/openvidu/rooms/' + this.room + '/connections/' + id + '/dismiss')
},
initSession(init) {
+ const button = $('#join-button').prop('disabled', true)
+
this.post = {
password: this.password,
nickname: this.nickname,
@@ -212,6 +215,13 @@
axios.post('/api/v4/openvidu/rooms/' + this.room, this.post, { ignoreErrors: true })
.then(response => {
+ button.prop('disabled', false)
+
+ // We already have token, the response is redundant
+ if (this.roomState == 'ready' && this.session.token) {
+ return
+ }
+
this.roomState = 'ready'
this.session = response.data
@@ -233,6 +243,8 @@
this.roomState = error.response.status
}
+ button.prop('disabled', this.roomState == 'init' || this.roomState == 327 || this.roomState == 404)
+
if (data.config) {
this.session.config = data.config
}
@@ -241,7 +253,12 @@
case 323:
// Waiting for the owner to open the room...
// Update room state every 10 seconds
- window.roomRequest = setTimeout(() => { this.initSession() }, 10000)
+ roomRequest = setTimeout(() => { this.initSession() }, 10000)
+ break;
+
+ case 324:
+ // Room is ready for the owner, but the 'init' was not requested yet
+ clearTimeout(roomRequest)
break;
case 325:
@@ -261,7 +278,7 @@
case 327:
// Waiting for the owner's approval to join
// Update room state every 10 seconds
- window.roomRequest = setTimeout(() => { this.initSession(true) }, 10000)
+ roomRequest = setTimeout(() => { this.initSession(true) }, 10000)
break;
}
})
@@ -334,7 +351,7 @@
return
}
- clearTimeout(window.roomRequest)
+ clearTimeout(roomRequest)
$('#app').addClass('meet')
$('#meet-setup').addClass('hidden')
diff --git a/src/tests/Browser/Meet/RoomSecurityTest.php b/src/tests/Browser/Meet/RoomSecurityTest.php
--- a/src/tests/Browser/Meet/RoomSecurityTest.php
+++ b/src/tests/Browser/Meet/RoomSecurityTest.php
@@ -170,7 +170,8 @@
$guest->visit(new RoomPage('john'))
->waitFor('@setup-form')
->waitUntilMissing('@setup-status-message.loading')
- ->assertSeeIn('@setup-button:not([disabled]).btn-success', 'JOIN NOW')
+ ->assertButtonEnabled('@setup-button')
+ ->assertSeeIn('@setup-button.btn-success', 'JOIN NOW')
// try without the nickname
->click('@setup-button')
->waitFor('@setup-nickname-input.is-invalid')
@@ -179,12 +180,13 @@
"The room is locked. Please, enter your name and try again."
)
->assertMissing('@setup-password-input')
- ->assertSeeIn('@setup-button:not([disabled]).btn-success', 'JOIN NOW')
+ ->assertButtonEnabled('@setup-button')
+ ->assertSeeIn('@setup-button.btn-success', 'JOIN NOW')
->type('@setup-nickname-input', 'Guest<p>')
->click('@setup-button')
->assertMissing('@setup-nickname-input.is-invalid')
- ->waitFor('@setup-button[disabled]')
- ->assertSeeIn('@setup-status-message', "Waiting for permission to join the room.");
+ ->waitForText("Waiting for permission to join the room.")
+ ->assertButtonDisabled('@setup-button');
// Test denying the request (this will also test custom toasts)
$owner
@@ -208,8 +210,8 @@
->waitUntilMissing('@setup-status-message.loading')
->type('@setup-nickname-input', 'guest')
->click('@setup-button')
- ->waitFor('@setup-button[disabled]')
- ->assertSeeIn('@setup-status-message', "Waiting for permission to join the room.");
+ ->waitForText("Waiting for permission to join the room.")
+ ->assertButtonDisabled('@setup-button');
$owner
->whenAvailable(new Toast(Toast::TYPE_CUSTOM), function ($browser) {
diff --git a/src/tests/Browser/Meet/RoomSetupTest.php b/src/tests/Browser/Meet/RoomSetupTest.php
--- a/src/tests/Browser/Meet/RoomSetupTest.php
+++ b/src/tests/Browser/Meet/RoomSetupTest.php
@@ -56,7 +56,7 @@
->assertMissing('@login-form')
->assertVisible('@setup-form')
->assertSeeIn('@setup-status-message', "The room does not exist.")
- ->assertVisible('@setup-button[disabled]');
+ ->assertButtonDisabled('@setup-button');
});
}
@@ -166,7 +166,10 @@
->assertSeeIn('@setup-status-message', "The room is closed. It will be open for others after you join.")
->assertSeeIn('@setup-button', "JOIN")
->type('@setup-nickname-input', 'john')
- // Join the room
+ // Join the room (click the button twice, to make sure it does not
+ // produce redundant participants/subscribers in the room)
+ ->click('@setup-button')
+ ->pause(10)
->click('@setup-button')
->waitFor('@session')
->assertMissing('@setup-form')
diff --git a/src/tests/Browser/Meet/RoomsTest.php b/src/tests/Browser/Meet/RoomsTest.php
--- a/src/tests/Browser/Meet/RoomsTest.php
+++ b/src/tests/Browser/Meet/RoomsTest.php
@@ -89,7 +89,7 @@
$browser->click('@links a.link-chat')
->waitFor('#meet-rooms')
->waitFor('.card-text a')
- ->assertSeeIn('.card-title', 'Video chat')
+ ->assertSeeIn('.card-title', 'Voice & Video Conferencing')
->assertSeeIn('.card-text a', $href)
->assertAttribute('.card-text a', 'href', $href)
->click('.card-text a')
diff --git a/src/tests/Browser/Pages/Meet/Room.php b/src/tests/Browser/Pages/Meet/Room.php
--- a/src/tests/Browser/Pages/Meet/Room.php
+++ b/src/tests/Browser/Pages/Meet/Room.php
@@ -68,7 +68,7 @@
'@setup-volume' => '#setup-preview .volume',
'@setup-video' => '#setup-preview video',
'@setup-status-message' => '#meet-setup div.status-message',
- '@setup-button' => '#meet-setup form button',
+ '@setup-button' => '#join-button',
'@toolbar' => '#meet-session-toolbar',

File Metadata

Mime Type
text/plain
Expires
Sun, Mar 29, 7:19 PM (3 d, 22 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
18773763
Default Alt Text
D2008.1774811940.diff (8 KB)

Event Timeline