From 7793de43f04664235067c787bcf9bfb576115222 Mon Sep 17 00:00:00 2001 From: "J. Ryan Stinnett" Date: Mon, 7 Jan 2019 17:59:57 -0600 Subject: [PATCH] Use per-message string substitutions in key backup panel Including unused substitutions triggers console logs, so change the key backup panel to only substitute what's actually used in each message. Fixes https://github.com/vector-im/riot-web/issues/8047. --- .../views/settings/KeyBackupPanel.js | 30 +++++++++---------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/src/components/views/settings/KeyBackupPanel.js b/src/components/views/settings/KeyBackupPanel.js index 03b98d28a02..050c726ba40 100644 --- a/src/components/views/settings/KeyBackupPanel.js +++ b/src/components/views/settings/KeyBackupPanel.js @@ -155,46 +155,44 @@ export default class KeyBackupPanel extends React.Component { let backupSigStatuses = this.state.backupSigStatus.sigs.map((sig, i) => { const deviceName = sig.device.getDisplayName() || sig.device.deviceId; - const sigStatusSubstitutions = { - validity: sub => - - {sub} - , - verify: sub => - - {sub} - , - device: sub => {deviceName}, - }; + const validity = sub => + + {sub} + ; + const verify = sub => + + {sub} + ; + const device = sub => {deviceName}; let sigStatus; if (sig.device.getFingerprint() === MatrixClientPeg.get().getDeviceEd25519Key()) { sigStatus = _t( "Backup has a valid signature from this device", - {}, sigStatusSubstitutions, + {}, { validity }, ); } else if (sig.valid && sig.device.isVerified()) { sigStatus = _t( "Backup has a valid signature from " + "verified device ", - {}, sigStatusSubstitutions, + {}, { validity, verify, device }, ); } else if (sig.valid && !sig.device.isVerified()) { sigStatus = _t( "Backup has a valid signature from " + "unverified device ", - {}, sigStatusSubstitutions, + {}, { validity, verify, device }, ); } else if (!sig.valid && sig.device.isVerified()) { sigStatus = _t( "Backup has an invalid signature from " + "verified device ", - {}, sigStatusSubstitutions, + {}, { validity, verify, device }, ); } else if (!sig.valid && !sig.device.isVerified()) { sigStatus = _t( "Backup has an invalid signature from " + "unverified device ", - {}, sigStatusSubstitutions, + {}, { validity, verify, device }, ); }