added autoclick on join room
This commit is contained in:
parent
fbde469f45
commit
a7d4422f3a
|
@ -24,19 +24,13 @@ App.cable.subscriptions.create({
|
||||||
// console.log(userId)
|
// console.log(userId)
|
||||||
console.log("received broadcast")
|
console.log("received broadcast")
|
||||||
// console.log(data.body)
|
// console.log(data.body)
|
||||||
if (data.head === 302 && data.body["caller"] === userId && data.path ) {
|
if (data.head === 302 && data.body["caller"] === userId && data.path) {
|
||||||
window.location.pathname = data.path
|
window.location.pathname = data.path
|
||||||
} else if (data["message"]["user_id"] === userId) {
|
} else if (data["message"]["user_id"] === userId) { // Some error appears here but it is not fatal
|
||||||
console.log("TRIGGER MODAL")
|
console.log("TRIGGER MODAL")
|
||||||
const acceptButton = document.getElementById('accept-button')
|
const acceptButton = document.getElementById('accept-button')
|
||||||
acceptButton.style.display = "block"
|
acceptButton.style.display = "block"
|
||||||
// const receiveCall = document.getElementById('receive-call')
|
|
||||||
// receiveCall.dataset.toggle = 'modal'
|
|
||||||
// receiveCall.dataset.target ='#calleeModal'
|
|
||||||
// console.log(receiveCall)
|
|
||||||
|
|
||||||
// const calleeModal = document.getElementById('calleeModal')
|
|
||||||
// calleeModal.modal("show")
|
|
||||||
chatRoomId = data["message"]["chat_room_id"]
|
chatRoomId = data["message"]["chat_room_id"]
|
||||||
console.log(`user with id: ${userId} needs to subscribe to chatroom ${[chatRoomId]}`)
|
console.log(`user with id: ${userId} needs to subscribe to chatroom ${[chatRoomId]}`)
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -207,3 +207,9 @@ const joinButton = document.getElementById("join-btn")
|
||||||
joinButton.addEventListener('click', event => {
|
joinButton.addEventListener('click', event => {
|
||||||
handleJoinSession()
|
handleJoinSession()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// WARNING: COMPLETELY HACKISH SOLUTION --> MUST INTRODUCE SOME SORT OF DELAY!
|
||||||
|
setTimeout(function() {
|
||||||
|
joinButton.click()
|
||||||
|
}, 5000);
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
<button id="join-btn" data-room="<%= @chat_room.id %>">Join Room</button>
|
<div id="join-btn" data-room="<%= @chat_room.id %>"></div>
|
||||||
<!-- <div id="join-session" onclick="handleJoinSession()" data-room="<%= @chat_room.id %>"> -->
|
<!-- <div id="join-session" onclick="handleJoinSession()" data-room="<%= @chat_room.id %>"> -->
|
||||||
|
|
||||||
<div id="chatroom-hook" data-chatroom-id='<%= @chat_room.id %>'></div>
|
<div id="chatroom-hook" data-chatroom-id='<%= @chat_room.id %>'></div>
|
||||||
|
|
Loading…
Reference in New Issue