diff --git a/app/javascript/packs/notifications.js b/app/javascript/packs/notifications.js index cff3892..056a931 100644 --- a/app/javascript/packs/notifications.js +++ b/app/javascript/packs/notifications.js @@ -24,19 +24,13 @@ App.cable.subscriptions.create({ // console.log(userId) console.log("received broadcast") // 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 - } 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") const acceptButton = document.getElementById('accept-button') 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"] console.log(`user with id: ${userId} needs to subscribe to chatroom ${[chatRoomId]}`) } else { diff --git a/app/javascript/packs/webrtc.js b/app/javascript/packs/webrtc.js index 5c22324..5bf7376 100644 --- a/app/javascript/packs/webrtc.js +++ b/app/javascript/packs/webrtc.js @@ -207,3 +207,9 @@ const joinButton = document.getElementById("join-btn") joinButton.addEventListener('click', event => { handleJoinSession() }) + +// WARNING: COMPLETELY HACKISH SOLUTION --> MUST INTRODUCE SOME SORT OF DELAY! +setTimeout(function() { + joinButton.click() +}, 5000); + diff --git a/app/views/chat_rooms/show.html.erb b/app/views/chat_rooms/show.html.erb index 358e664..92b2f05 100644 --- a/app/views/chat_rooms/show.html.erb +++ b/app/views/chat_rooms/show.html.erb @@ -1,4 +1,4 @@ - +