From d18bf67868f2c7d2ae1c477683fc8be01ea6b136 Mon Sep 17 00:00:00 2001 From: Jarek Radosz Date: Fri, 20 Dec 2024 16:48:13 +0100 Subject: [PATCH] DEV: Remove unnecessary optional chaining operators (#30400) --- .../javascripts/discourse/app/components/modal/history.js | 2 +- app/assets/javascripts/discourse/app/lib/uppy/uppy-upload.js | 2 +- .../javascripts/discourse/services/chat-drafts-manager.js | 3 ++- .../assets/javascripts/discourse/services/chat-guardian.js | 4 +--- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/app/assets/javascripts/discourse/app/components/modal/history.js b/app/assets/javascripts/discourse/app/components/modal/history.js index a7aa1930094..bf1ce2b42e4 100644 --- a/app/assets/javascripts/discourse/app/components/modal/history.js +++ b/app/assets/javascripts/discourse/app/components/modal/history.js @@ -28,7 +28,7 @@ export default class History extends Component { @tracked loading; @tracked postRevision; - @tracked viewMode = this.site?.mobileView ? "inline" : "side_by_side"; + @tracked viewMode = this.site.mobileView ? "inline" : "side_by_side"; @tracked bodyDiff; @tracked initialLoad = true; diff --git a/app/assets/javascripts/discourse/app/lib/uppy/uppy-upload.js b/app/assets/javascripts/discourse/app/lib/uppy/uppy-upload.js index 53cc1fff20c..41184881346 100644 --- a/app/assets/javascripts/discourse/app/lib/uppy/uppy-upload.js +++ b/app/assets/javascripts/discourse/app/lib/uppy/uppy-upload.js @@ -465,7 +465,7 @@ export default class UppyUpload { #xhrUploadUrl() { const uploadUrl = this.config.uploadUrl || this.config.uploadRootPath; - return getUrl(uploadUrl) + ".json?client_id=" + this.messageBus?.clientId; + return getUrl(uploadUrl) + ".json?client_id=" + this.messageBus.clientId; } #bindFileInputChange() { diff --git a/plugins/chat/assets/javascripts/discourse/services/chat-drafts-manager.js b/plugins/chat/assets/javascripts/discourse/services/chat-drafts-manager.js index b7b7efcdfd6..48449fc9563 100644 --- a/plugins/chat/assets/javascripts/discourse/services/chat-drafts-manager.js +++ b/plugins/chat/assets/javascripts/discourse/services/chat-drafts-manager.js @@ -7,7 +7,8 @@ export default class ChatDraftsManager extends Service { drafts = {}; willDestroy() { - cancel(this?._persistHandler); + super.willDestroy(...arguments); + cancel(this._persistHandler); } async add(message, channelId, threadId) { diff --git a/plugins/chat/assets/javascripts/discourse/services/chat-guardian.js b/plugins/chat/assets/javascripts/discourse/services/chat-guardian.js index 7f50095e4ec..cdd43556fdd 100644 --- a/plugins/chat/assets/javascripts/discourse/services/chat-guardian.js +++ b/plugins/chat/assets/javascripts/discourse/services/chat-guardian.js @@ -18,8 +18,6 @@ export default class ChatGuardian extends Service { } canUseChat() { - return ( - this.currentUser?.has_chat_enabled && this.siteSettings?.chat_enabled - ); + return this.currentUser?.has_chat_enabled && this.siteSettings.chat_enabled; } }