From bfaeffcb510891852bd39e183dcfc00ef7d4ac4e Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Wed, 28 Apr 2021 13:05:26 +0200 Subject: [PATCH] fix memory leak in settings view by using nested template builder --- .../web/ui/session/settings/SettingsView.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/platform/web/ui/session/settings/SettingsView.js b/src/platform/web/ui/session/settings/SettingsView.js index b4a47bea..725f0e2b 100644 --- a/src/platform/web/ui/session/settings/SettingsView.js +++ b/src/platform/web/ui/session/settings/SettingsView.js @@ -27,7 +27,7 @@ export class SettingsView extends TemplateView { ]); } - const row = (label, content, extraClass = "") => { + const row = (t, label, content, extraClass = "") => { return t.div({className: `row ${extraClass}`}, [ t.div({className: "label"}, label), t.div({className: "content"}, content), @@ -38,9 +38,9 @@ export class SettingsView extends TemplateView { settingNodes.push( t.h3("Session"), - row(vm.i18n`User ID`, vm.userId), - row(vm.i18n`Session ID`, vm.deviceId, "code"), - row(vm.i18n`Session key`, vm.fingerprintKey, "code") + row(t, vm.i18n`User ID`, vm.userId), + row(t, vm.i18n`Session ID`, vm.deviceId, "code"), + row(t, vm.i18n`Session key`, vm.fingerprintKey, "code") ); settingNodes.push( t.h3("Session Backup"), @@ -59,7 +59,7 @@ export class SettingsView extends TemplateView { const buttonLabel = vm => vm.pushNotifications.enabled ? vm.i18n`Disable`: vm.i18n`Enable`; - return row(label, t.button({ + return row(t, label, t.button({ onClick: () => vm.togglePushNotifications(), disabled: vm => vm.pushNotifications.updating }, buttonLabel)); @@ -92,13 +92,13 @@ export class SettingsView extends TemplateView { settingNodes.push( t.h3("Preferences"), - row(vm.i18n`Scale down images when sending`, this._imageCompressionRange(t, vm)), + row(t, vm.i18n`Scale down images when sending`, this._imageCompressionRange(t, vm)), ); settingNodes.push( t.h3("Application"), - row(vm.i18n`Version`, version), - row(vm.i18n`Storage usage`, vm => `${vm.storageUsage} / ${vm.storageQuota}`), - row(vm.i18n`Debug logs`, t.button({onClick: () => vm.exportLogs()}, "Export")), + row(t, vm.i18n`Version`, version), + row(t, vm.i18n`Storage usage`, vm => `${vm.storageUsage} / ${vm.storageQuota}`), + row(t, vm.i18n`Debug logs`, t.button({onClick: () => vm.exportLogs()}, "Export")), t.p(["Debug logs contain application usage data including your username, the IDs or aliases of the rooms or groups you have visited, the usernames of other users and the names of files you send. They do not contain messages. For more information, review our ", t.a({href: "https://element.io/privacy", target: "_blank", rel: "noopener"}, "privacy policy"), "."]), );