Fix some cases where the chat immediatly close

Peertube events are not fired in the good order.
This is a dirty fix: saving the current window location when
initializing the chat, and comparing the saved url when navigation-end
is triggered.
This commit is contained in:
John Livingston
2021-12-08 19:33:28 +01:00
parent 7b239c9520
commit aaab1fe604
3 changed files with 16 additions and 0 deletions

View File

@ -289,6 +289,7 @@ function register ({ registerHook, peertubeHelpers }: RegisterOptions): void {
container = document.createElement('div')
container.setAttribute('id', 'peertube-plugin-livechat-container')
container.setAttribute('peertube-plugin-livechat-state', 'initializing')
container.setAttribute('peertube-plugin-livechat-current-url', window.location.href)
placeholder.append(container)
peertubeHelpers.getSettings().then((s: any) => {