Polls: notifier on votes

This commit is contained in:
John Livingston
2024-07-05 16:34:51 +02:00
parent 9b1f24eafe
commit e97c33cec5
5 changed files with 26 additions and 2 deletions

View File

@ -17,6 +17,8 @@ declare global {
}
}
let pollListenerInitiliazed: boolean = false
/**
* load the ConverseJS CSS.
* @param url CSS url
@ -164,6 +166,15 @@ async function displayConverseJS (
}
const converseJSParams: InitConverseJSParams = await (response).json()
if (!pollListenerInitiliazed) {
// First time we got here, initiliaze this event:
const i18nVoteOk = await clientOptions.peertubeHelpers.translate(LOC_POLL_VOTE_OK)
pollListenerInitiliazed = true
document.addEventListener('livechat-poll-vote', () => {
clientOptions.peertubeHelpers.notifier.success(i18nVoteOk)
})
}
await loadConverseJS(converseJSParams)
await window.initConverse(converseJSParams, chatIncludeMode, authHeader ?? null)
}