Custom channel emoticons WIP (#130)

This commit is contained in:
John Livingston
2024-05-28 17:56:24 +02:00
parent 6713192719
commit dad29a941f
15 changed files with 341 additions and 31 deletions

View File

@ -91,11 +91,19 @@ export const livechatSpecificsPlugin = {
'livechat_mini_muc_head',
'livechat_specific_external_authent',
'livechat_task_app_enabled',
'livechat_task_app_restore'
'livechat_task_app_restore',
'livechat_custom_emojis_url',
'emoji_categories'
]) {
_converse.api.settings.set(k, params[k])
}
// We also unload emojis, in case there are custom emojis.
window.converse.emojis = {
initialized: false,
initialized_promise: getOpenPromise()
}
// Then login.
_converse.api.user.login()
}
@ -144,3 +152,32 @@ export const livechatSpecificsPlugin = {
}
}
}
// FIXME: this function is copied from @converse. Should not do so.
function getOpenPromise (): any {
const wrapper: any = {
isResolved: false,
isPending: true,
isRejected: false
}
const promise: any = new Promise((resolve, reject) => {
wrapper.resolve = resolve
wrapper.reject = reject
})
Object.assign(promise, wrapper)
promise.then(
function (v: any) {
promise.isResolved = true
promise.isPending = false
promise.isRejected = false
return v
},
function (e: any) {
promise.isResolved = false
promise.isPending = false
promise.isRejected = true
throw (e)
}
)
return promise
}