mirror of
https://github.com/bitwarden/browser
synced 2025-12-18 09:13:33 +00:00
Fix glob processing in npm. Ban single param parens (#257)
This commit is contained in:
@@ -159,7 +159,7 @@ export class AddEditComponent implements OnInit {
|
||||
const myEmail = await this.userService.getEmail();
|
||||
this.ownershipOptions.push({ name: myEmail, value: null });
|
||||
const orgs = await this.userService.getAllOrganizations();
|
||||
orgs.sort(Utils.getSortFunction(this.i18nService, 'name')).forEach((o) => {
|
||||
orgs.sort(Utils.getSortFunction(this.i18nService, 'name')).forEach(o => {
|
||||
if (o.enabled && o.status === OrganizationUserStatusType.Confirmed) {
|
||||
this.ownershipOptions.push({ name: o.name, value: o.id });
|
||||
if (policies != null && o.usePolicies && !o.canManagePolicies && this.allowPersonal) {
|
||||
@@ -231,7 +231,7 @@ export class AddEditComponent implements OnInit {
|
||||
if (this.cipher != null && (!this.editMode || addEditCipherInfo != null || this.cloneMode)) {
|
||||
await this.organizationChanged();
|
||||
if (this.collectionIds != null && this.collectionIds.length > 0 && this.collections.length > 0) {
|
||||
this.collections.forEach((c) => {
|
||||
this.collections.forEach(c => {
|
||||
if (this.collectionIds.indexOf(c.id) > -1) {
|
||||
(c as any).checked = true;
|
||||
}
|
||||
@@ -273,7 +273,7 @@ export class AddEditComponent implements OnInit {
|
||||
// Allows saving of selected collections during "Add" and "Clone" flows
|
||||
if ((!this.editMode || this.cloneMode) && this.cipher.organizationId != null) {
|
||||
this.cipher.collectionIds = this.collections == null ? [] :
|
||||
this.collections.filter((c) => (c as any).checked).map((c) => c.id);
|
||||
this.collections.filter(c => (c as any).checked).map(c => c.id);
|
||||
}
|
||||
|
||||
// Clear current Cipher Id to trigger "Add" cipher flow
|
||||
@@ -459,10 +459,10 @@ export class AddEditComponent implements OnInit {
|
||||
|
||||
async organizationChanged() {
|
||||
if (this.writeableCollections != null) {
|
||||
this.writeableCollections.forEach((c) => (c as any).checked = false);
|
||||
this.writeableCollections.forEach(c => (c as any).checked = false);
|
||||
}
|
||||
if (this.cipher.organizationId != null) {
|
||||
this.collections = this.writeableCollections.filter((c) => c.organizationId === this.cipher.organizationId);
|
||||
this.collections = this.writeableCollections.filter(c => c.organizationId === this.cipher.organizationId);
|
||||
const org = await this.userService.getOrganization(this.cipher.organizationId);
|
||||
if (org != null) {
|
||||
this.cipher.organizationUseTotp = org.useTotp;
|
||||
@@ -496,7 +496,7 @@ export class AddEditComponent implements OnInit {
|
||||
|
||||
protected async loadCollections() {
|
||||
const allCollections = await this.collectionService.getAllDecrypted();
|
||||
return allCollections.filter((c) => !c.readOnly);
|
||||
return allCollections.filter(c => !c.readOnly);
|
||||
}
|
||||
|
||||
protected loadCipher() {
|
||||
|
||||
@@ -192,7 +192,7 @@ export class AttachmentsComponent implements OnInit {
|
||||
// 3. Delete old
|
||||
this.deletePromises[attachment.id] = this.deleteCipherAttachment(attachment.id);
|
||||
await this.deletePromises[attachment.id];
|
||||
const foundAttachment = this.cipher.attachments.filter((a2) => a2.id === attachment.id);
|
||||
const foundAttachment = this.cipher.attachments.filter(a2 => a2.id === attachment.id);
|
||||
if (foundAttachment.length > 0) {
|
||||
const i = this.cipher.attachments.indexOf(foundAttachment[0]);
|
||||
if (i > -1) {
|
||||
|
||||
@@ -82,7 +82,7 @@ export class CiphersComponent {
|
||||
if (this.searchTimeout != null) {
|
||||
clearTimeout(this.searchTimeout);
|
||||
}
|
||||
const deletedFilter: (cipher: CipherView) => boolean = (c) => c.isDeleted === this.deleted;
|
||||
const deletedFilter: (cipher: CipherView) => boolean = c => c.isDeleted === this.deleted;
|
||||
if (timeout == null) {
|
||||
this.ciphers = await this.searchService.searchCiphers(this.searchText, [this.filter, deletedFilter], null);
|
||||
await this.resetPaging();
|
||||
|
||||
@@ -42,9 +42,9 @@ export class CollectionsComponent implements OnInit {
|
||||
this.cipher = await this.cipherDomain.decrypt();
|
||||
this.collections = await this.loadCollections();
|
||||
|
||||
this.collections.forEach((c) => (c as any).checked = false);
|
||||
this.collections.forEach(c => (c as any).checked = false);
|
||||
if (this.collectionIds != null) {
|
||||
this.collections.forEach((c) => {
|
||||
this.collections.forEach(c => {
|
||||
(c as any).checked = this.collectionIds != null && this.collectionIds.indexOf(c.id) > -1;
|
||||
});
|
||||
}
|
||||
@@ -52,8 +52,8 @@ export class CollectionsComponent implements OnInit {
|
||||
|
||||
async submit() {
|
||||
const selectedCollectionIds = this.collections
|
||||
.filter((c) => !!(c as any).checked)
|
||||
.map((c) => c.id);
|
||||
.filter(c => !!(c as any).checked)
|
||||
.map(c => c.id);
|
||||
if (!this.allowSelectNone && selectedCollectionIds.length === 0) {
|
||||
this.platformUtilsService.showToast('error', this.i18nService.t('errorOccurred'),
|
||||
this.i18nService.t('selectOneCollection'));
|
||||
@@ -79,7 +79,7 @@ export class CollectionsComponent implements OnInit {
|
||||
|
||||
protected async loadCollections() {
|
||||
const allCollections = await this.collectionService.getAllDecrypted();
|
||||
return allCollections.filter((c) => !c.readOnly && c.organizationId === this.cipher.organizationId);
|
||||
return allCollections.filter(c => !c.readOnly && c.organizationId === this.cipher.organizationId);
|
||||
}
|
||||
|
||||
protected saveCollections() {
|
||||
|
||||
@@ -79,7 +79,7 @@ export class GroupingsComponent {
|
||||
}
|
||||
const collections = await this.collectionService.getAllDecrypted();
|
||||
if (organizationId != null) {
|
||||
this.collections = collections.filter((c) => c.organizationId === organizationId);
|
||||
this.collections = collections.filter(c => c.organizationId === organizationId);
|
||||
} else {
|
||||
this.collections = collections;
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ export class ModalComponent implements OnDestroy {
|
||||
|
||||
const modals = Array.from(document.querySelectorAll('.modal, .modal *[data-dismiss="modal"]'));
|
||||
for (const closeElement of modals) {
|
||||
closeElement.addEventListener('click', (event) => {
|
||||
closeElement.addEventListener('click', event => {
|
||||
this.close();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -100,13 +100,13 @@ export class SendComponent implements OnInit {
|
||||
clearTimeout(this.searchTimeout);
|
||||
}
|
||||
if (timeout == null) {
|
||||
this.filteredSends = this.sends.filter((s) => this.filter == null || this.filter(s));
|
||||
this.filteredSends = this.sends.filter(s => this.filter == null || this.filter(s));
|
||||
this.applyTextSearch();
|
||||
return;
|
||||
}
|
||||
this.searchPending = true;
|
||||
this.searchTimeout = setTimeout(async () => {
|
||||
this.filteredSends = this.sends.filter((s) => this.filter == null || this.filter(s));
|
||||
this.filteredSends = this.sends.filter(s => this.filter == null || this.filter(s));
|
||||
this.applyTextSearch();
|
||||
this.searchPending = false;
|
||||
}, timeout);
|
||||
@@ -189,7 +189,7 @@ export class SendComponent implements OnInit {
|
||||
selectType(type: SendType) {
|
||||
this.clearSelections();
|
||||
this.selectedType = type;
|
||||
this.applyFilter((s) => s.type === type);
|
||||
this.applyFilter(s => s.type === type);
|
||||
}
|
||||
|
||||
clearSelections() {
|
||||
|
||||
@@ -44,7 +44,7 @@ export class SetPasswordComponent extends BaseChangePasswordComponent {
|
||||
await this.syncService.fullSync(true);
|
||||
this.syncLoading = false;
|
||||
|
||||
const queryParamsSub = this.route.queryParams.subscribe(async (qParams) => {
|
||||
const queryParamsSub = this.route.queryParams.subscribe(async qParams => {
|
||||
if (qParams.identifier != null) {
|
||||
this.identifier = qParams.identifier;
|
||||
}
|
||||
|
||||
@@ -43,10 +43,10 @@ export class ShareComponent implements OnInit {
|
||||
|
||||
async load() {
|
||||
const allCollections = await this.collectionService.getAllDecrypted();
|
||||
this.writeableCollections = allCollections.map((c) => c).filter((c) => !c.readOnly);
|
||||
this.writeableCollections = allCollections.map(c => c).filter(c => !c.readOnly);
|
||||
const orgs = await this.userService.getAllOrganizations();
|
||||
this.organizations = orgs.sort(Utils.getSortFunction(this.i18nService, 'name'))
|
||||
.filter((o) => o.enabled && o.status === OrganizationUserStatusType.Confirmed);
|
||||
.filter(o => o.enabled && o.status === OrganizationUserStatusType.Confirmed);
|
||||
|
||||
const cipherDomain = await this.cipherService.get(this.cipherId);
|
||||
this.cipher = await cipherDomain.decrypt();
|
||||
@@ -57,18 +57,18 @@ export class ShareComponent implements OnInit {
|
||||
}
|
||||
|
||||
filterCollections() {
|
||||
this.writeableCollections.forEach((c) => (c as any).checked = false);
|
||||
this.writeableCollections.forEach(c => (c as any).checked = false);
|
||||
if (this.organizationId == null || this.writeableCollections.length === 0) {
|
||||
this.collections = [];
|
||||
} else {
|
||||
this.collections = this.writeableCollections.filter((c) => c.organizationId === this.organizationId);
|
||||
this.collections = this.writeableCollections.filter(c => c.organizationId === this.organizationId);
|
||||
}
|
||||
}
|
||||
|
||||
async submit(): Promise<boolean> {
|
||||
const selectedCollectionIds = this.collections
|
||||
.filter((c) => !!(c as any).checked)
|
||||
.map((c) => c.id);
|
||||
.filter(c => !!(c as any).checked)
|
||||
.map(c => c.id);
|
||||
if (selectedCollectionIds.length === 0) {
|
||||
this.platformUtilsService.showToast('error', this.i18nService.t('errorOccurred'),
|
||||
this.i18nService.t('selectOneCollection'));
|
||||
|
||||
@@ -45,7 +45,7 @@ export class SsoComponent {
|
||||
protected passwordGenerationService: PasswordGenerationService) { }
|
||||
|
||||
async ngOnInit() {
|
||||
const queryParamsSub = this.route.queryParams.subscribe(async (qParams) => {
|
||||
const queryParamsSub = this.route.queryParams.subscribe(async qParams => {
|
||||
if (qParams.code != null && qParams.state != null) {
|
||||
const codeVerifier = await this.storageService.get<string>(ConstantsService.ssoCodeVerifierKey);
|
||||
const state = await this.storageService.get<string>(ConstantsService.ssoStateKey);
|
||||
|
||||
@@ -63,7 +63,7 @@ export class TwoFactorComponent implements OnInit, OnDestroy {
|
||||
return;
|
||||
}
|
||||
|
||||
const queryParamsSub = this.route.queryParams.subscribe(async (qParams) => {
|
||||
const queryParamsSub = this.route.queryParams.subscribe(async qParams => {
|
||||
if (qParams.identifier != null) {
|
||||
this.identifier = qParams.identifier;
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ export class BoxRowDirective implements OnInit {
|
||||
|
||||
ngOnInit(): void {
|
||||
this.formEls = Array.from(this.el.querySelectorAll('input:not([type="hidden"]), select, textarea'));
|
||||
this.formEls.forEach((formEl) => {
|
||||
this.formEls.forEach(formEl => {
|
||||
formEl.addEventListener('focus', (event: Event) => {
|
||||
this.el.classList.add('active');
|
||||
}, false);
|
||||
|
||||
@@ -15,13 +15,13 @@ export class SearchCiphersPipe implements PipeTransform {
|
||||
}
|
||||
|
||||
if (searchText == null || searchText.length < 2) {
|
||||
return ciphers.filter((c) => {
|
||||
return ciphers.filter(c => {
|
||||
return deleted !== c.isDeleted;
|
||||
});
|
||||
}
|
||||
|
||||
searchText = searchText.trim().toLowerCase();
|
||||
return ciphers.filter((c) => {
|
||||
return ciphers.filter(c => {
|
||||
if (deleted !== c.isDeleted) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ export class SearchPipe implements PipeTransform {
|
||||
}
|
||||
|
||||
searchText = searchText.trim().toLowerCase();
|
||||
return items.filter((i) => {
|
||||
return items.filter(i => {
|
||||
if (prop1 != null && i[prop1] != null && i[prop1].toString().toLowerCase().indexOf(searchText) > -1) {
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user