1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-11-18 11:05:41 +01:00

Use placeholders, minor code and style fixes

This commit is contained in:
Thomas Rittson 2021-01-14 18:04:30 +10:00
parent 078111a4fc
commit caa4d5990d
2 changed files with 15 additions and 9 deletions

View File

@ -1445,6 +1445,12 @@
"message": "Bitwarden will not ask to save login details for these domains."
},
"excludedDomainsInvalidDomain": {
"message": " is not a valid domain"
"message": "$DOMAIN$ is not a valid domain",
"placeholders": {
"domain": {
"content": "$1",
"example": "googlecom"
}
}
}
}

View File

@ -16,8 +16,8 @@ import { BrowserApi } from '../../browser/browserApi';
import { Utils } from 'jslib/misc/utils';
interface ExcludedDomain {
uri: string,
showCurrentUris: boolean
uri: string;
showCurrentUris: boolean;
}
const BroadcasterSubscriptionId = 'excludedDomains';
@ -41,11 +41,11 @@ export class ExcludedDomainsComponent implements OnInit, OnDestroy {
const savedDomains = await this.storageService.get<any>(ConstantsService.neverDomainsKey);
if (savedDomains) {
for (const uri of Object.keys(savedDomains)) {
this.excludedDomains.push({ uri: uri, showCurrentUris: false })
this.excludedDomains.push({ uri: uri, showCurrentUris: false });
}
}
this.loadCurrentUris();
await this.loadCurrentUris();
this.broadcasterService.subscribe(BroadcasterSubscriptionId, (message: any) => {
this.ngZone.run(async () => {
@ -55,7 +55,7 @@ export class ExcludedDomainsComponent implements OnInit, OnDestroy {
if (this.loadCurrentUrisTimeout != null) {
window.clearTimeout(this.loadCurrentUrisTimeout);
}
this.loadCurrentUrisTimeout = window.setTimeout(() => this.loadCurrentUris(), 500);
this.loadCurrentUrisTimeout = window.setTimeout(async () => await this.loadCurrentUris(), 500);
break;
default:
break;
@ -69,7 +69,7 @@ export class ExcludedDomainsComponent implements OnInit, OnDestroy {
}
async addUri() {
this.excludedDomains.push({ uri: '', showCurrentUris: false })
this.excludedDomains.push({ uri: '', showCurrentUris: false });
}
async removeUri(i: number) {
@ -83,10 +83,10 @@ export class ExcludedDomainsComponent implements OnInit, OnDestroy {
const validDomain = Utils.getHostname(domain.uri);
if (!validDomain) {
this.platformUtilsService.showToast('error', null,
'\'' + domain.uri + '\'' + this.i18nService.t('excludedDomainsInvalidDomain'));
this.i18nService.t('excludedDomainsInvalidDomain', domain.uri));
return;
}
savedDomains[validDomain] = null
savedDomains[validDomain] = null;
}
}
await this.storageService.save(ConstantsService.neverDomainsKey, savedDomains);