diff --git a/client/common/lib/contexts/peertube.ts b/client/common/lib/contexts/peertube.ts index 61c4d34d..658aa0bc 100644 --- a/client/common/lib/contexts/peertube.ts +++ b/client/common/lib/contexts/peertube.ts @@ -39,9 +39,7 @@ export class PtContext { * Keep them in cache after first request. */ public async getSettings (): Promise { - if (!this._settings) { - this._settings = await this.ptOptions.peertubeHelpers.getSettings() as LiveChatSettings - } + this._settings ??= await this.ptOptions.peertubeHelpers.getSettings() as LiveChatSettings return this._settings } } diff --git a/conversejs/lib/plugins/livechat-announcements.ts b/conversejs/lib/plugins/livechat-announcements.ts index 0f66f045..8ff899ba 100644 --- a/conversejs/lib/plugins/livechat-announcements.ts +++ b/conversejs/lib/plugins/livechat-announcements.ts @@ -54,7 +54,7 @@ function overrideMUCMessageForm (_converse: any, current: Current): void { class MUCMessageFormloaded extends MUCMessageForm { async onFormSubmitted (ev?: Event): Promise { const announcementSelect = this.querySelector('[name=livechat-announcements]') - current.announcementType = announcementSelect?.selectedOptions?.[0]?.value || undefined + current.announcementType = announcementSelect?.selectedOptions?.[0]?.value ?? undefined try { await super.onFormSubmitted(ev) if (announcementSelect) { announcementSelect.selectedIndex = 0 } // set back to default @@ -173,7 +173,7 @@ function onGetOutgoingMessageAttributes ( chatbox: any, attrs: any ): Parameters[3] { - if (!current.announcementType) { return attrs } + if (!current.announcementType) { return attrs } // undefined or "" const { __ } = _converse attrs.livechat_announcement_type = current.announcementType diff --git a/eslint.config.mjs b/eslint.config.mjs index 636b1aae..12473156 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -78,7 +78,7 @@ export default tseslint.config( '@typescript-eslint/no-unsafe-call': 'off', // FIXME: comes with eslint-config-love 84 update, and should be used. '@typescript-eslint/no-unnecessary-condition': 'off', // FIXME: comes with eslint-config-love 84 update, but seems buggy (false positive). - + '@typescript-eslint/prefer-nullish-coalescing': 'off', // disabling, because many false positive (where i want "" to act as false) 'max-len': [ 'error', { diff --git a/server/lib/routers/webchat.ts b/server/lib/routers/webchat.ts index f822449b..19ee88a7 100644 --- a/server/lib/routers/webchat.ts +++ b/server/lib/routers/webchat.ts @@ -89,17 +89,29 @@ async function initWebchatRouter (options: RegisterServerOptionsV5): Promise c !== '')) {