1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-11 13:53:34 +00:00

Add eslint-plugin-rxjs & rxjs-angular (#3373)

This commit is contained in:
Oscar Hinton
2022-08-26 18:09:28 +02:00
committed by GitHub
parent feb6e67bc4
commit e7c7037a14
102 changed files with 866 additions and 49 deletions

View File

@@ -29,7 +29,7 @@ describe("session syncer", () => {
afterEach(() => {
jest.resetAllMocks();
behaviorSubject.unsubscribe();
behaviorSubject.complete();
});
describe("constructor", () => {

View File

@@ -1,4 +1,4 @@
import { BehaviorSubject, Subscription } from "rxjs";
import { BehaviorSubject, concatMap, Subscription } from "rxjs";
import { Utils } from "@bitwarden/common/misc/utils";
@@ -41,13 +41,17 @@ export class SessionSyncer {
// This may be a memory leak.
// There is no good time to unsubscribe from this observable. Hopefully Manifest V3 clears memory from temporary
// contexts. If so, this is handled by destruction of the context.
this.subscription = this.behaviorSubject.subscribe(async (next) => {
if (this.ignoreNextUpdate) {
this.ignoreNextUpdate = false;
return;
}
await this.updateSession(next);
});
this.subscription = this.behaviorSubject
.pipe(
concatMap(async (next) => {
if (this.ignoreNextUpdate) {
this.ignoreNextUpdate = false;
return;
}
await this.updateSession(next);
})
)
.subscribe();
}
private listenForUpdates() {

View File

@@ -109,6 +109,7 @@ export class TwoFactorComponent extends BaseTwoFactorComponent {
}
}
// eslint-disable-next-line rxjs-angular/prefer-takeuntil, rxjs/no-async-subscribe
this.route.queryParams.pipe(first()).subscribe(async (qParams) => {
if (qParams.sso === "true") {
super.onSuccessfulLogin = () => {

View File

@@ -35,7 +35,7 @@ export class AppComponent implements OnInit, OnDestroy {
private lastActivity: number = null;
private activeUserId: string;
private destroy$: Subject<void> = new Subject<void>();
private destroy$ = new Subject<void>();
constructor(
private toastrService: ToastrService,
@@ -132,6 +132,7 @@ export class AppComponent implements OnInit, OnDestroy {
BrowserApi.messageListener("app.component", (window as any).bitwardenPopupMainMessageListener);
// eslint-disable-next-line rxjs/no-async-subscribe
this.router.events.pipe(takeUntil(this.destroy$)).subscribe(async (event) => {
if (event instanceof NavigationEnd) {
const url = event.urlAfterRedirects || event.url || "";

View File

@@ -19,6 +19,7 @@ import { PopupUtilsService } from "../services/popup-utils.service";
selector: "app-send-add-edit",
templateUrl: "send-add-edit.component.html",
})
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
export class SendAddEditComponent extends BaseAddEditComponent {
// Options header
showOptions = false;
@@ -98,6 +99,7 @@ export class SendAddEditComponent extends BaseAddEditComponent {
this.isUnsupportedMac =
this.platformUtilsService.isChrome() && window?.navigator?.appVersion.includes("Mac OS X 11");
// eslint-disable-next-line rxjs-angular/prefer-takeuntil, rxjs/no-async-subscribe
this.route.queryParams.pipe(first()).subscribe(async (params) => {
if (params.sendId) {
this.sendId = params.sendId;

View File

@@ -70,6 +70,7 @@ export class SendTypeComponent extends BaseSendComponent {
async ngOnInit() {
// Let super class finish
await super.ngOnInit();
// eslint-disable-next-line rxjs-angular/prefer-takeuntil, rxjs/no-async-subscribe
this.route.queryParams.pipe(first()).subscribe(async (params) => {
if (this.applySavedState) {
this.state = await this.stateService.getBrowserSendTypeComponentState();

View File

@@ -13,6 +13,7 @@ import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUti
selector: "app-folder-add-edit",
templateUrl: "folder-add-edit.component.html",
})
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
export class FolderAddEditComponent extends BaseFolderAddEditComponent {
constructor(
folderService: FolderService,
@@ -27,6 +28,7 @@ export class FolderAddEditComponent extends BaseFolderAddEditComponent {
}
async ngOnInit() {
// eslint-disable-next-line rxjs-angular/prefer-takeuntil, rxjs/no-async-subscribe
this.route.queryParams.pipe(first()).subscribe(async (params) => {
if (params.folderId) {
this.folderId = params.folderId;

View File

@@ -37,6 +37,7 @@ const RateUrls = {
selector: "app-settings",
templateUrl: "settings.component.html",
})
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
export class SettingsComponent implements OnInit {
@ViewChild("vaultTimeoutActionSelect", { read: ElementRef, static: true })
vaultTimeoutActionSelectRef: ElementRef;
@@ -102,6 +103,7 @@ export class SettingsComponent implements OnInit {
this.vaultTimeout.setValue(timeout);
}
this.previousVaultTimeout = this.vaultTimeout.value;
// eslint-disable-next-line rxjs-angular/prefer-takeuntil, rxjs/no-async-subscribe
this.vaultTimeout.valueChanges.subscribe(async (value) => {
await this.saveVaultTimeout(value);
});

View File

@@ -27,6 +27,7 @@ import { PopupUtilsService } from "../services/popup-utils.service";
selector: "app-vault-add-edit",
templateUrl: "add-edit.component.html",
})
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
export class AddEditComponent extends BaseAddEditComponent {
currentUris: string[];
showAttachments = true;
@@ -72,6 +73,7 @@ export class AddEditComponent extends BaseAddEditComponent {
async ngOnInit() {
await super.ngOnInit();
// eslint-disable-next-line rxjs-angular/prefer-takeuntil, rxjs/no-async-subscribe
this.route.queryParams.pipe(first()).subscribe(async (params) => {
if (params.cipherId) {
this.cipherId = params.cipherId;

View File

@@ -17,6 +17,7 @@ import { StateService } from "@bitwarden/common/abstractions/state.service";
selector: "app-vault-attachments",
templateUrl: "attachments.component.html",
})
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
export class AttachmentsComponent extends BaseAttachmentsComponent {
openedAttachmentsInPopup: boolean;
@@ -46,6 +47,7 @@ export class AttachmentsComponent extends BaseAttachmentsComponent {
}
async ngOnInit() {
// eslint-disable-next-line rxjs-angular/prefer-takeuntil, rxjs/no-async-subscribe
this.route.queryParams.pipe(first()).subscribe(async (params) => {
this.cipherId = params.cipherId;
await this.init();

View File

@@ -80,6 +80,7 @@ export class CiphersComponent extends BaseCiphersComponent implements OnInit, On
this.searchTypeSearch = !this.platformUtilsService.isSafari();
this.showOrganizations = await this.organizationService.hasOrganizations();
this.vaultFilter = this.vaultFilterService.getVaultFilter();
// eslint-disable-next-line rxjs-angular/prefer-takeuntil, rxjs/no-async-subscribe
this.route.queryParams.pipe(first()).subscribe(async (params) => {
if (this.applySavedState) {
this.state = await this.stateService.getBrowserCipherComponentState();

View File

@@ -14,6 +14,7 @@ import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUti
selector: "app-vault-collections",
templateUrl: "collections.component.html",
})
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
export class CollectionsComponent extends BaseCollectionsComponent {
constructor(
collectionService: CollectionService,
@@ -28,9 +29,11 @@ export class CollectionsComponent extends BaseCollectionsComponent {
}
async ngOnInit() {
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
this.onSavedCollections.subscribe(() => {
this.back();
});
// eslint-disable-next-line rxjs-angular/prefer-takeuntil, rxjs/no-async-subscribe
this.route.queryParams.pipe(first()).subscribe(async (params) => {
this.cipherId = params.cipherId;
await this.load();

View File

@@ -12,6 +12,7 @@ import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUti
selector: "app-password-history",
templateUrl: "password-history.component.html",
})
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
export class PasswordHistoryComponent extends BasePasswordHistoryComponent {
constructor(
cipherService: CipherService,
@@ -24,6 +25,7 @@ export class PasswordHistoryComponent extends BasePasswordHistoryComponent {
}
async ngOnInit() {
// eslint-disable-next-line rxjs-angular/prefer-takeuntil, rxjs/no-async-subscribe
this.route.queryParams.pipe(first()).subscribe(async (params) => {
if (params.cipherId) {
this.cipherId = params.cipherId;

View File

@@ -14,6 +14,7 @@ import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUti
selector: "app-vault-share",
templateUrl: "share.component.html",
})
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
export class ShareComponent extends BaseShareComponent {
constructor(
collectionService: CollectionService,
@@ -36,9 +37,11 @@ export class ShareComponent extends BaseShareComponent {
}
async ngOnInit() {
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
this.onSharedCipher.subscribe(() => {
this.router.navigate(["view-cipher", { cipherId: this.cipherId }]);
});
// eslint-disable-next-line rxjs-angular/prefer-takeuntil, rxjs/no-async-subscribe
this.route.queryParams.pipe(first()).subscribe(async (params) => {
this.cipherId = params.cipherId;
await this.load();

View File

@@ -114,6 +114,7 @@ export class VaultFilterComponent implements OnInit, OnDestroy {
});
const restoredScopeState = await this.restoreState();
// eslint-disable-next-line rxjs-angular/prefer-takeuntil, rxjs/no-async-subscribe
this.route.queryParams.pipe(first()).subscribe(async (params) => {
this.state = await this.browserStateService.getBrowserGroupingComponentState();
if (this.state?.searchText) {

View File

@@ -47,6 +47,7 @@ import { VaultFilterService } from "../../services/vaultFilter.service";
]),
],
})
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
export class VaultSelectComponent implements OnInit {
@Output() onVaultSelectionChanged = new EventEmitter();
@@ -168,6 +169,7 @@ export class VaultSelectComponent implements OnInit {
this.overlayRef.outsidePointerEvents(),
this.overlayRef.backdropClick(),
this.overlayRef.detachments()
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
).subscribe(() => {
this.close();
});

View File

@@ -88,6 +88,7 @@ export class ViewComponent extends BaseViewComponent {
ngOnInit() {
this.inPopout = this.popupUtilsService.inPopout(window);
// eslint-disable-next-line rxjs-angular/prefer-takeuntil, rxjs/no-async-subscribe
this.route.queryParams.pipe(first()).subscribe(async (params) => {
if (params.cipherId) {
this.cipherId = params.cipherId;

View File

@@ -1,4 +1,4 @@
import { BehaviorSubject } from "rxjs/internal/BehaviorSubject";
import { BehaviorSubject } from "rxjs";
import { Folder } from "@bitwarden/common/models/domain/folder";
import { FolderView } from "@bitwarden/common/models/view/folderView";

View File

@@ -69,6 +69,7 @@ export class LockComponent extends BaseLockComponent {
const forcePasswordReset = await this.stateService.getForcePasswordReset();
this.successRoute = forcePasswordReset === true ? this.unAuthenicatedUrl : this.authenicatedUrl;
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
this.route.queryParams.subscribe((params) => {
if (this.supportsBiometric && params.promptBiometric && autoPromptBiometric) {
setTimeout(async () => {

View File

@@ -102,13 +102,16 @@ export class LoginComponent extends BaseLoginComponent implements OnDestroy {
this.environmentModal
);
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
modal.onShown.subscribe(() => {
this.showingModal = true;
});
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
modal.onClosed.subscribe(() => {
this.showingModal = false;
});
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
childComponent.onSaved.subscribe(() => {
modal.close();
});

View File

@@ -24,6 +24,7 @@ import { DeleteAccountComponent } from "./delete-account.component";
selector: "app-settings",
templateUrl: "settings.component.html",
})
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
export class SettingsComponent implements OnInit {
vaultTimeoutAction: string;
pin: boolean = null;
@@ -178,6 +179,7 @@ export class SettingsComponent implements OnInit {
this.vaultTimeout.setValue(await this.stateService.getVaultTimeout());
this.vaultTimeoutAction = await this.stateService.getVaultTimeoutAction();
this.previousVaultTimeout = this.vaultTimeout.value;
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
this.vaultTimeout.valueChanges.pipe(debounceTime(500)).subscribe(() => {
this.saveVaultTimeoutOptions();
});

View File

@@ -21,6 +21,7 @@ import { TwoFactorOptionsComponent } from "./two-factor-options.component";
selector: "app-two-factor",
templateUrl: "two-factor.component.html",
})
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
export class TwoFactorComponent extends BaseTwoFactorComponent {
@ViewChild("twoFactorOptions", { read: ViewContainerRef, static: true })
twoFactorOptionsModal: ViewContainerRef;
@@ -67,18 +68,22 @@ export class TwoFactorComponent extends BaseTwoFactorComponent {
this.twoFactorOptionsModal
);
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
modal.onShown.subscribe(() => {
this.showingModal = true;
});
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
modal.onClosed.subscribe(() => {
this.showingModal = false;
});
// eslint-disable-next-line rxjs-angular/prefer-takeuntil, rxjs/no-async-subscribe
childComponent.onProviderSelected.subscribe(async (provider: TwoFactorProviderType) => {
modal.close();
this.selectedProviderType = provider;
await this.init();
});
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
childComponent.onRecoverSelected.subscribe(() => {
modal.close();
});

View File

@@ -98,7 +98,7 @@ export class AppComponent implements OnInit, OnDestroy {
private isIdle = false;
private activeUserId: string = null;
private destroy$: Subject<void> = new Subject<void>();
private destroy$ = new Subject<void>();
constructor(
private broadcasterService: BroadcasterService,
@@ -377,10 +377,12 @@ export class AppComponent implements OnInit, OnDestroy {
);
this.modal = modal;
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
childComponent.onSaved.subscribe(() => {
this.modal.close();
});
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
this.modal.onClosed.subscribe(() => {
this.modal = null;
});
@@ -396,11 +398,13 @@ export class AppComponent implements OnInit, OnDestroy {
);
this.modal = modal;
// eslint-disable-next-line rxjs-angular/prefer-takeuntil, rxjs/no-async-subscribe
childComponent.onSavedFolder.subscribe(async () => {
this.modal.close();
this.syncService.fullSync(false);
});
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
this.modal.onClosed.subscribe(() => {
this.modal = null;
});
@@ -415,6 +419,7 @@ export class AppComponent implements OnInit, OnDestroy {
(comp) => (comp.comingFromAddEdit = false)
);
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
this.modal.onClosed.subscribe(() => {
this.modal = null;
});
@@ -539,6 +544,7 @@ export class AppComponent implements OnInit, OnDestroy {
[this.modal] = await this.modalService.openViewRef(type, ref);
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
this.modal.onClosed.subscribe(() => {
this.modal = null;
});

View File

@@ -48,6 +48,7 @@ export class SwitcherAccount extends Account {
]),
],
})
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
export class AccountSwitcherComponent implements OnInit {
isOpen = false;
accounts: { [userId: string]: SwitcherAccount } = {};
@@ -84,6 +85,7 @@ export class AccountSwitcherComponent implements OnInit {
) {}
async ngOnInit(): Promise<void> {
// eslint-disable-next-line rxjs-angular/prefer-takeuntil, rxjs/no-async-subscribe
this.stateService.accounts.subscribe(async (accounts: { [userId: string]: Account }) => {
for (const userId in accounts) {
accounts[userId].profile.authenticationStatus = await this.authService.getAuthStatus(

View File

@@ -17,16 +17,19 @@ export class SearchComponent implements OnInit, OnDestroy {
private activeAccountSubscription: Subscription;
constructor(private searchBarService: SearchBarService, private stateService: StateService) {
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
this.searchBarService.state$.subscribe((state) => {
this.state = state;
});
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
this.searchText.valueChanges.subscribe((value) => {
this.searchBarService.setSearchText(value);
});
}
ngOnInit() {
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
this.activeAccountSubscription = this.stateService.activeAccount$.subscribe((value) => {
this.searchBarService.setSearchText("");
this.searchText.patchValue("");

View File

@@ -56,6 +56,7 @@ export class SendComponent extends BaseSendComponent implements OnInit, OnDestro
policyService,
logService
);
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
this.searchBarService.searchText$.subscribe((searchText) => {
this.searchText = searchText;
this.searchTextChanged();

View File

@@ -10,10 +10,12 @@ import { SearchBarService } from "../layout/search/search-bar.service";
selector: "app-vault-ciphers",
templateUrl: "ciphers.component.html",
})
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
export class CiphersComponent extends BaseCiphersComponent {
constructor(searchService: SearchService, searchBarService: SearchBarService) {
super(searchService);
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
searchBarService.searchText$.subscribe((searchText) => {
this.searchText = searchText;
this.search(200);

View File

@@ -216,6 +216,7 @@ export class VaultComponent implements OnInit, OnDestroy {
}
async load() {
// eslint-disable-next-line rxjs-angular/prefer-takeuntil, rxjs/no-async-subscribe
this.route.queryParams.pipe(first()).subscribe(async (params) => {
if (params.cipherId) {
const cipherView = new CipherView();
@@ -458,9 +459,12 @@ export class VaultComponent implements OnInit, OnDestroy {
this.modal = modal;
let madeAttachmentChanges = false;
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
childComponent.onUploadedAttachment.subscribe(() => (madeAttachmentChanges = true));
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
childComponent.onDeletedAttachment.subscribe(() => (madeAttachmentChanges = true));
// eslint-disable-next-line rxjs-angular/prefer-takeuntil, rxjs/no-async-subscribe
this.modal.onClosed.subscribe(async () => {
this.modal = null;
if (madeAttachmentChanges) {
@@ -482,11 +486,13 @@ export class VaultComponent implements OnInit, OnDestroy {
);
this.modal = modal;
// eslint-disable-next-line rxjs-angular/prefer-takeuntil, rxjs/no-async-subscribe
childComponent.onSharedCipher.subscribe(async () => {
this.modal.close();
this.viewCipher(cipher);
await this.ciphersComponent.refresh();
});
// eslint-disable-next-line rxjs-angular/prefer-takeuntil, rxjs/no-async-subscribe
this.modal.onClosed.subscribe(async () => {
this.modal = null;
});
@@ -504,10 +510,12 @@ export class VaultComponent implements OnInit, OnDestroy {
);
this.modal = modal;
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
childComponent.onSavedCollections.subscribe(() => {
this.modal.close();
this.viewCipher(cipher);
});
// eslint-disable-next-line rxjs-angular/prefer-takeuntil, rxjs/no-async-subscribe
this.modal.onClosed.subscribe(async () => {
this.modal = null;
});
@@ -524,6 +532,7 @@ export class VaultComponent implements OnInit, OnDestroy {
(comp) => (comp.cipherId = cipher.id)
);
// eslint-disable-next-line rxjs-angular/prefer-takeuntil, rxjs/no-async-subscribe
this.modal.onClosed.subscribe(async () => {
this.modal = null;
});
@@ -596,6 +605,7 @@ export class VaultComponent implements OnInit, OnDestroy {
);
this.modal = modal;
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
childComponent.onSelected.subscribe((value: string) => {
this.modal.close();
if (loginType) {
@@ -608,6 +618,7 @@ export class VaultComponent implements OnInit, OnDestroy {
}
});
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
this.modal.onClosed.subscribe(() => {
this.modal = null;
});
@@ -629,15 +640,18 @@ export class VaultComponent implements OnInit, OnDestroy {
);
this.modal = modal;
// eslint-disable-next-line rxjs-angular/prefer-takeuntil, rxjs/no-async-subscribe
childComponent.onSavedFolder.subscribe(async (folder: FolderView) => {
this.modal.close();
await this.vaultFilterComponent.reloadCollectionsAndFolders(this.activeFilter);
});
// eslint-disable-next-line rxjs-angular/prefer-takeuntil, rxjs/no-async-subscribe
childComponent.onDeletedFolder.subscribe(async (folder: FolderView) => {
this.modal.close();
await this.vaultFilterComponent.reloadCollectionsAndFolders(this.activeFilter);
});
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
this.modal.onClosed.subscribe(() => {
this.modal = null;
});

View File

@@ -26,6 +26,7 @@ import { RouterService, StateService } from "../core";
selector: "app-login",
templateUrl: "login.component.html",
})
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
export class LoginComponent extends BaseLoginComponent {
showResetPasswordAutoEnrollWarning = false;
enforcedPasswordPolicyOptions: MasterPasswordPolicyOptions;
@@ -68,6 +69,7 @@ export class LoginComponent extends BaseLoginComponent {
}
async ngOnInit() {
// eslint-disable-next-line rxjs-angular/prefer-takeuntil, rxjs/no-async-subscribe
this.route.queryParams.pipe(first()).subscribe(async (qParams) => {
if (qParams.email != null && qParams.email.indexOf("@") > -1) {
this.email = qParams.email;

View File

@@ -27,6 +27,7 @@ import { RouterService } from "../core";
selector: "app-register",
templateUrl: "register.component.html",
})
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
export class RegisterComponent extends BaseRegisterComponent {
email = "";
showCreateOrgMessage = false;
@@ -70,6 +71,7 @@ export class RegisterComponent extends BaseRegisterComponent {
}
async ngOnInit() {
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
this.route.queryParams.pipe(first()).subscribe((qParams) => {
this.referenceData = new ReferenceEventRequest();
if (qParams.email != null && qParams.email.indexOf("@") > -1) {

View File

@@ -17,6 +17,7 @@ import { StateService } from "@bitwarden/common/abstractions/state.service";
selector: "app-sso",
templateUrl: "sso.component.html",
})
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
export class SsoComponent extends BaseSsoComponent {
constructor(
authService: AuthService,
@@ -50,6 +51,7 @@ export class SsoComponent extends BaseSsoComponent {
async ngOnInit() {
super.ngOnInit();
// eslint-disable-next-line rxjs-angular/prefer-takeuntil, rxjs/no-async-subscribe
this.route.queryParams.pipe(first()).subscribe(async (qParams) => {
if (qParams.identifier != null) {
this.identifier = qParams.identifier;

View File

@@ -24,6 +24,7 @@ import { VerticalStepperComponent } from "./vertical-stepper/vertical-stepper.co
selector: "app-trial",
templateUrl: "trial-initiation.component.html",
})
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
export class TrialInitiationComponent implements OnInit {
email = "";
org = "";
@@ -76,6 +77,7 @@ export class TrialInitiationComponent implements OnInit {
) {}
async ngOnInit(): Promise<void> {
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
this.route.queryParams.pipe(first()).subscribe((qParams) => {
this.referenceData = new ReferenceEventRequest();
if (qParams.email != null && qParams.email.indexOf("@") > -1) {

View File

@@ -22,6 +22,7 @@ import { TwoFactorOptionsComponent } from "./two-factor-options.component";
selector: "app-two-factor",
templateUrl: "two-factor.component.html",
})
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
export class TwoFactorComponent extends BaseTwoFactorComponent {
@ViewChild("twoFactorOptions", { read: ViewContainerRef, static: true })
twoFactorOptionsModal: ViewContainerRef;
@@ -63,11 +64,13 @@ export class TwoFactorComponent extends BaseTwoFactorComponent {
TwoFactorOptionsComponent,
this.twoFactorOptionsModal,
(comp) => {
// eslint-disable-next-line rxjs-angular/prefer-takeuntil, rxjs/no-async-subscribe
comp.onProviderSelected.subscribe(async (provider: TwoFactorProviderType) => {
modal.close();
this.selectedProviderType = provider;
await this.init();
});
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
comp.onRecoverSelected.subscribe(() => {
modal.close();
});

View File

@@ -13,6 +13,7 @@ import { VerifyEmailRequest } from "@bitwarden/common/models/request/verifyEmail
selector: "app-verify-email-token",
templateUrl: "verify-email-token.component.html",
})
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
export class VerifyEmailTokenComponent implements OnInit {
constructor(
private router: Router,
@@ -25,6 +26,7 @@ export class VerifyEmailTokenComponent implements OnInit {
) {}
ngOnInit() {
// eslint-disable-next-line rxjs-angular/prefer-takeuntil, rxjs/no-async-subscribe
this.route.queryParams.pipe(first()).subscribe(async (qParams) => {
if (qParams.userId != null && qParams.token != null) {
try {

View File

@@ -12,6 +12,7 @@ import { VerifyDeleteRecoverRequest } from "@bitwarden/common/models/request/ver
selector: "app-verify-recover-delete",
templateUrl: "verify-recover-delete.component.html",
})
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
export class VerifyRecoverDeleteComponent implements OnInit {
email: string;
formPromise: Promise<any>;
@@ -29,6 +30,7 @@ export class VerifyRecoverDeleteComponent implements OnInit {
) {}
ngOnInit() {
// eslint-disable-next-line rxjs-angular/prefer-takeuntil, rxjs/no-async-subscribe
this.route.queryParams.pipe(first()).subscribe(async (qParams) => {
if (qParams.userId != null && qParams.token != null && qParams.email != null) {
this.userId = qParams.userId;

View File

@@ -215,7 +215,7 @@ export class AppComponent implements OnDestroy, OnInit {
ngOnDestroy() {
this.broadcasterService.unsubscribe(BroadcasterSubscriptionId);
this.destroy$.next();
this.destroy$.unsubscribe();
this.destroy$.complete();
}
private async logOut(expired: boolean) {

View File

@@ -29,6 +29,7 @@ export abstract class BaseAcceptComponent implements OnInit {
abstract unauthedHandler(qParams: Params): Promise<void>;
ngOnInit() {
// eslint-disable-next-line rxjs/no-async-subscribe
this.route.queryParams.pipe(first()).subscribe(async (qParams) => {
let error = this.requiredParameters.some((e) => qParams?.[e] == null || qParams[e] === "");
let errorMessage: string = null;

View File

@@ -343,6 +343,7 @@ export abstract class BasePeopleComponent<
comp.name = this.userNamePipe.transform(user);
comp.userId = user != null ? user.userId : null;
comp.publicKey = publicKey;
// eslint-disable-next-line rxjs/no-async-subscribe
comp.onConfirmedUser.subscribe(async () => {
try {
comp.formPromise = confirmUser(publicKey);

View File

@@ -18,6 +18,7 @@ import { canAccessOrgAdmin } from "../organizations/navigation-permissions";
selector: "app-navbar",
templateUrl: "navbar.component.html",
})
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
export class NavbarComponent implements OnInit {
selfHosted = false;
name: string;

View File

@@ -31,6 +31,7 @@ export class OrganizationLayoutComponent implements OnInit, OnDestroy {
ngOnInit() {
document.body.classList.remove("layout_frontend");
// eslint-disable-next-line rxjs-angular/prefer-takeuntil, rxjs/no-async-subscribe
this.route.params.subscribe(async (params: any) => {
this.organizationId = params.organizationId;
await this.load();

View File

@@ -27,6 +27,7 @@ import { EntityUsersComponent } from "./entity-users.component";
selector: "app-org-manage-collections",
templateUrl: "collections.component.html",
})
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
export class CollectionsComponent implements OnInit {
@ViewChild("addEdit", { read: ViewContainerRef, static: true }) addEditModalRef: ViewContainerRef;
@ViewChild("usersTemplate", { read: ViewContainerRef, static: true })
@@ -59,9 +60,11 @@ export class CollectionsComponent implements OnInit {
) {}
async ngOnInit() {
// eslint-disable-next-line rxjs-angular/prefer-takeuntil, rxjs/no-async-subscribe
this.route.parent.parent.params.subscribe(async (params) => {
this.organizationId = params.organizationId;
await this.load();
// eslint-disable-next-line rxjs-angular/prefer-takeuntil, rxjs/no-async-subscribe, rxjs/no-nested-subscribe
this.route.queryParams.pipe(first()).subscribe(async (qParams) => {
this.searchText = qParams.search;
});
@@ -131,10 +134,12 @@ export class CollectionsComponent implements OnInit {
comp.collectionId = collection != null ? collection.id : null;
comp.canSave = canCreate || canEdit;
comp.canDelete = canDelete;
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
comp.onSavedCollection.subscribe(() => {
modal.close();
this.load();
});
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
comp.onDeletedCollection.subscribe(() => {
modal.close();
this.removeCollection(collection);
@@ -183,6 +188,7 @@ export class CollectionsComponent implements OnInit {
comp.entityId = collection.id;
comp.entityName = collection.name;
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
comp.onEditedUsers.subscribe(() => {
this.load();
modal.close();

View File

@@ -20,6 +20,7 @@ import { EventService } from "../../core";
selector: "app-org-events",
templateUrl: "events.component.html",
})
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
export class EventsComponent extends BaseEventsComponent implements OnInit {
exportFileName = "org-events";
organizationId: string;
@@ -52,6 +53,7 @@ export class EventsComponent extends BaseEventsComponent implements OnInit {
}
async ngOnInit() {
// eslint-disable-next-line rxjs-angular/prefer-takeuntil, rxjs/no-async-subscribe
this.route.parent.parent.params.subscribe(async (params) => {
this.organizationId = params.organizationId;
this.organization = await this.organizationService.get(this.organizationId);

View File

@@ -18,6 +18,7 @@ import { GroupAddEditComponent } from "./group-add-edit.component";
selector: "app-org-groups",
templateUrl: "groups.component.html",
})
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
export class GroupsComponent implements OnInit {
@ViewChild("addEdit", { read: ViewContainerRef, static: true }) addEditModalRef: ViewContainerRef;
@ViewChild("usersTemplate", { read: ViewContainerRef, static: true })
@@ -45,9 +46,11 @@ export class GroupsComponent implements OnInit {
) {}
async ngOnInit() {
// eslint-disable-next-line rxjs-angular/prefer-takeuntil, rxjs/no-async-subscribe
this.route.parent.parent.params.subscribe(async (params) => {
this.organizationId = params.organizationId;
await this.load();
/* eslint-disable-next-line rxjs-angular/prefer-takeuntil, rxjs/no-async-subscribe, rxjs/no-nested-subscribe */
this.route.queryParams.pipe(first()).subscribe(async (qParams) => {
this.searchText = qParams.search;
});
@@ -88,10 +91,12 @@ export class GroupsComponent implements OnInit {
(comp) => {
comp.organizationId = this.organizationId;
comp.groupId = group != null ? group.id : null;
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
comp.onSavedGroup.subscribe(() => {
modal.close();
this.load();
});
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
comp.onDeletedGroup.subscribe(() => {
modal.close();
this.removeGroup(group);
@@ -139,6 +144,7 @@ export class GroupsComponent implements OnInit {
comp.entityId = group.id;
comp.entityName = group.name;
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
comp.onEditedUsers.subscribe(() => {
modal.close();
});

View File

@@ -8,12 +8,14 @@ import { Organization } from "@bitwarden/common/models/domain/organization";
selector: "app-org-manage",
templateUrl: "manage.component.html",
})
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
export class ManageComponent implements OnInit {
organization: Organization;
constructor(private route: ActivatedRoute, private organizationService: OrganizationService) {}
ngOnInit() {
// eslint-disable-next-line rxjs-angular/prefer-takeuntil, rxjs/no-async-subscribe
this.route.parent.params.subscribe(async (params) => {
this.organization = await this.organizationService.get(params.organizationId);
});

View File

@@ -43,6 +43,7 @@ import { UserGroupsComponent } from "./user-groups.component";
selector: "app-org-people",
templateUrl: "people.component.html",
})
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
export class PeopleComponent
extends BasePeopleComponent<OrganizationUserUserDetailsResponse>
implements OnInit
@@ -112,6 +113,7 @@ export class PeopleComponent
}
async ngOnInit() {
// eslint-disable-next-line rxjs-angular/prefer-takeuntil, rxjs/no-async-subscribe
this.route.parent.parent.params.subscribe(async (params) => {
this.organizationId = params.organizationId;
const organization = await this.organizationService.get(this.organizationId);
@@ -138,6 +140,7 @@ export class PeopleComponent
await this.load();
// eslint-disable-next-line rxjs-angular/prefer-takeuntil, rxjs/no-async-subscribe, rxjs/no-nested-subscribe
this.route.queryParams.pipe(first()).subscribe(async (qParams) => {
this.searchText = qParams.search;
if (qParams.viewEvents != null) {
@@ -237,18 +240,22 @@ export class PeopleComponent
comp.organizationId = this.organizationId;
comp.organizationUserId = user != null ? user.id : null;
comp.usesKeyConnector = user?.usesKeyConnector;
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
comp.onSavedUser.subscribe(() => {
modal.close();
this.load();
});
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
comp.onDeletedUser.subscribe(() => {
modal.close();
this.removeUser(user);
});
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
comp.onRevokedUser.subscribe(() => {
modal.close();
this.load();
});
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
comp.onRestoredUser.subscribe(() => {
modal.close();
this.load();
@@ -265,6 +272,7 @@ export class PeopleComponent
comp.name = this.userNamePipe.transform(user);
comp.organizationId = this.organizationId;
comp.organizationUserId = user != null ? user.id : null;
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
comp.onSavedUser.subscribe(() => {
modal.close();
});
@@ -389,6 +397,7 @@ export class PeopleComponent
comp.organizationId = this.organizationId;
comp.id = user != null ? user.id : null;
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
comp.onPasswordReset.subscribe(() => {
modal.close();
this.load();
@@ -427,6 +436,7 @@ export class PeopleComponent
// Workaround to handle closing the modal shortly after it has been opened
let close = false;
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
modal.onShown.subscribe(() => {
if (close) {
modal.close();

View File

@@ -18,6 +18,7 @@ import { PolicyEditComponent } from "./policy-edit.component";
selector: "app-org-policies",
templateUrl: "policies.component.html",
})
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
export class PoliciesComponent implements OnInit {
@ViewChild("editTemplate", { read: ViewContainerRef, static: true })
editModalRef: ViewContainerRef;
@@ -40,6 +41,7 @@ export class PoliciesComponent implements OnInit {
) {}
async ngOnInit() {
// eslint-disable-next-line rxjs-angular/prefer-takeuntil, rxjs/no-async-subscribe
this.route.parent.parent.params.subscribe(async (params) => {
this.organizationId = params.organizationId;
this.organization = await this.organizationService.get(this.organizationId);
@@ -48,6 +50,7 @@ export class PoliciesComponent implements OnInit {
await this.load();
// Handle policies component launch from Event message
/* eslint-disable-next-line rxjs-angular/prefer-takeuntil, rxjs/no-async-subscribe, rxjs/no-nested-subscribe */
this.route.queryParams.pipe(first()).subscribe(async (qParams) => {
if (qParams.policyId != null) {
const policyIdFromEvents: string = qParams.policyId;
@@ -85,6 +88,7 @@ export class PoliciesComponent implements OnInit {
comp.policy = policy;
comp.organizationId = this.organizationId;
comp.policiesEnabledMap = this.policiesEnabledMap;
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
comp.onSavedPolicy.subscribe(() => {
modal.close();
this.load();

View File

@@ -24,6 +24,7 @@ import { DeleteOrganizationComponent } from "./delete-organization.component";
selector: "app-org-account",
templateUrl: "account.component.html",
})
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
export class AccountComponent {
@ViewChild("deleteOrganizationTemplate", { read: ViewContainerRef, static: true })
deleteModalRef: ViewContainerRef;
@@ -62,6 +63,7 @@ export class AccountComponent {
async ngOnInit() {
this.selfHosted = this.platformUtilsService.isSelfHost();
// eslint-disable-next-line rxjs-angular/prefer-takeuntil, rxjs/no-async-subscribe
this.route.parent.parent.params.subscribe(async (params) => {
this.organizationId = params.organizationId;
this.canManageBilling = (
@@ -118,6 +120,7 @@ export class AccountComponent {
this.deleteModalRef,
(comp) => {
comp.organizationId = this.organizationId;
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
comp.onSuccess.subscribe(() => {
this.router.navigate(["/"]);
});

View File

@@ -14,6 +14,7 @@ import { BillingResponse } from "@bitwarden/common/models/response/billingRespon
selector: "app-org-billing",
templateUrl: "./organization-billing.component.html",
})
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
export class OrganizationBillingComponent implements OnInit {
loading = false;
firstLoaded = false;
@@ -39,6 +40,7 @@ export class OrganizationBillingComponent implements OnInit {
) {}
async ngOnInit() {
// eslint-disable-next-line rxjs-angular/prefer-takeuntil, rxjs/no-async-subscribe
this.route.parent.parent.params.subscribe(async (params) => {
this.organizationId = params.organizationId;
await this.load();

View File

@@ -26,6 +26,7 @@ import { BillingSyncApiKeyComponent } from "./billing-sync-api-key.component";
selector: "app-org-subscription",
templateUrl: "organization-subscription.component.html",
})
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
export class OrganizationSubscriptionComponent implements OnInit {
@ViewChild("setupBillingSyncTemplate", { read: ViewContainerRef, static: true })
setupBillingSyncModalRef: ViewContainerRef;
@@ -72,6 +73,7 @@ export class OrganizationSubscriptionComponent implements OnInit {
}
async ngOnInit() {
// eslint-disable-next-line rxjs-angular/prefer-takeuntil, rxjs/no-async-subscribe
this.route.parent.parent.params.subscribe(async (params) => {
this.organizationId = params.organizationId;
await this.load();
@@ -187,6 +189,7 @@ export class OrganizationSubscriptionComponent implements OnInit {
comp.hasBillingToken = this.hasBillingSyncToken;
}
);
// eslint-disable-next-line rxjs-angular/prefer-takeuntil, rxjs/no-async-subscribe
ref.onClosed.subscribe(async () => {
await this.load();
});

View File

@@ -8,6 +8,7 @@ import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUti
selector: "app-org-settings",
templateUrl: "settings.component.html",
})
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
export class SettingsComponent {
access2fa = false;
showBilling: boolean;
@@ -19,6 +20,7 @@ export class SettingsComponent {
) {}
ngOnInit() {
// eslint-disable-next-line rxjs-angular/prefer-takeuntil, rxjs/no-async-subscribe
this.route.parent.params.subscribe(async (params) => {
const organization = await this.organizationService.get(params.organizationId);
this.showBilling = !this.platformUtilsService.isSelfHost() && organization.canManageBilling;

View File

@@ -18,6 +18,7 @@ import { TwoFactorSetupComponent as BaseTwoFactorSetupComponent } from "../../se
selector: "app-two-factor-setup",
templateUrl: "../../settings/two-factor-setup.component.html",
})
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
export class TwoFactorSetupComponent extends BaseTwoFactorSetupComponent {
constructor(
apiService: ApiService,
@@ -43,6 +44,7 @@ export class TwoFactorSetupComponent extends BaseTwoFactorSetupComponent {
}
async ngOnInit() {
// eslint-disable-next-line rxjs-angular/prefer-takeuntil, rxjs/no-async-subscribe
this.route.parent.parent.params.subscribe(async (params) => {
this.organizationId = params.organizationId;
await super.ngOnInit();
@@ -55,6 +57,7 @@ export class TwoFactorSetupComponent extends BaseTwoFactorSetupComponent {
const duoComp = await this.openModal(this.duoModalRef, TwoFactorDuoComponent);
duoComp.type = TwoFactorProviderType.OrganizationDuo;
duoComp.organizationId = this.organizationId;
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
duoComp.onUpdated.subscribe((enabled: boolean) => {
this.updateStatus(enabled, TwoFactorProviderType.OrganizationDuo);
});

View File

@@ -22,6 +22,7 @@ import { DeleteOrganizationComponent } from "../settings/delete-organization.com
selector: "families-for-enterprise-setup",
templateUrl: "families-for-enterprise-setup.component.html",
})
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
export class FamiliesForEnterpriseSetupComponent implements OnInit {
@ViewChild(OrganizationPlansComponent, { static: false })
set organizationPlansComponent(value: OrganizationPlansComponent) {
@@ -32,6 +33,7 @@ export class FamiliesForEnterpriseSetupComponent implements OnInit {
value.plan = PlanType.FamiliesAnnually;
value.product = ProductType.Families;
value.acceptingSponsorship = true;
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
value.onSuccess.subscribe(this.onOrganizationCreateSuccess.bind(this));
}
@@ -63,6 +65,7 @@ export class FamiliesForEnterpriseSetupComponent implements OnInit {
async ngOnInit() {
document.body.classList.remove("layout_frontend");
// eslint-disable-next-line rxjs-angular/prefer-takeuntil, rxjs/no-async-subscribe
this.route.queryParams.pipe(first()).subscribe(async (qParams) => {
const error = qParams.token == null;
if (error) {
@@ -130,6 +133,7 @@ export class FamiliesForEnterpriseSetupComponent implements OnInit {
(comp) => {
comp.organizationId = organizationId;
comp.deleteOrganizationRequestType = "InvalidFamiliesForEnterprise";
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
comp.onSuccess.subscribe(() => {
this.router.navigate(["/"]);
});

View File

@@ -18,6 +18,7 @@ import { ExposedPasswordsReportComponent as BaseExposedPasswordsReportComponent
selector: "app-org-exposed-passwords-report",
templateUrl: "../../reports/pages/exposed-passwords-report.component.html",
})
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
export class ExposedPasswordsReportComponent extends BaseExposedPasswordsReportComponent {
manageableCiphers: Cipher[];
@@ -42,6 +43,7 @@ export class ExposedPasswordsReportComponent extends BaseExposedPasswordsReportC
}
ngOnInit() {
// eslint-disable-next-line rxjs-angular/prefer-takeuntil, rxjs/no-async-subscribe
this.route.parent.parent.params.subscribe(async (params) => {
this.organization = await this.organizationService.get(params.organizationId);
this.manageableCiphers = await this.cipherService.getAll();

View File

@@ -19,6 +19,7 @@ import { ExportComponent } from "../../../tools/import-export/export.component";
selector: "app-org-export",
templateUrl: "../../../tools/import-export/export.component.html",
})
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
export class OrganizationExportComponent extends ExportComponent {
constructor(
cryptoService: CryptoService,
@@ -48,6 +49,7 @@ export class OrganizationExportComponent extends ExportComponent {
}
async ngOnInit() {
// eslint-disable-next-line rxjs-angular/prefer-takeuntil, rxjs/no-async-subscribe
this.route.parent.parent.params.subscribe(async (params) => {
this.organizationId = params.organizationId;
});

View File

@@ -14,6 +14,7 @@ import { ImportComponent } from "../../../tools/import-export/import.component";
selector: "app-org-import",
templateUrl: "../../../tools/import-export/import.component.html",
})
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
export class OrganizationImportComponent extends ImportComponent {
organizationName: string;
@@ -31,6 +32,7 @@ export class OrganizationImportComponent extends ImportComponent {
}
async ngOnInit() {
// eslint-disable-next-line rxjs-angular/prefer-takeuntil, rxjs/no-async-subscribe
this.route.parent.parent.params.subscribe(async (params) => {
this.organizationId = params.organizationId;
this.successNavigate = ["organizations", this.organizationId, "vault"];

View File

@@ -17,6 +17,7 @@ import { InactiveTwoFactorReportComponent as BaseInactiveTwoFactorReportComponen
selector: "app-inactive-two-factor-report",
templateUrl: "../../reports/pages/inactive-two-factor-report.component.html",
})
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
export class InactiveTwoFactorReportComponent extends BaseInactiveTwoFactorReportComponent {
constructor(
cipherService: CipherService,
@@ -39,6 +40,7 @@ export class InactiveTwoFactorReportComponent extends BaseInactiveTwoFactorRepor
}
async ngOnInit() {
// eslint-disable-next-line rxjs-angular/prefer-takeuntil, rxjs/no-async-subscribe
this.route.parent.parent.params.subscribe(async (params) => {
this.organization = await this.organizationService.get(params.organizationId);
await super.ngOnInit();

View File

@@ -17,6 +17,7 @@ import { ReusedPasswordsReportComponent as BaseReusedPasswordsReportComponent }
selector: "app-reused-passwords-report",
templateUrl: "../../reports/pages/reused-passwords-report.component.html",
})
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
export class ReusedPasswordsReportComponent extends BaseReusedPasswordsReportComponent {
manageableCiphers: Cipher[];
@@ -33,6 +34,7 @@ export class ReusedPasswordsReportComponent extends BaseReusedPasswordsReportCom
}
async ngOnInit() {
// eslint-disable-next-line rxjs-angular/prefer-takeuntil, rxjs/no-async-subscribe
this.route.parent.parent.params.subscribe(async (params) => {
this.organization = await this.organizationService.get(params.organizationId);
this.manageableCiphers = await this.cipherService.getAll();

View File

@@ -9,6 +9,7 @@ import { Organization } from "@bitwarden/common/models/domain/organization";
selector: "app-org-tools",
templateUrl: "tools.component.html",
})
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
export class ToolsComponent {
organization: Organization;
accessReports = false;
@@ -21,6 +22,7 @@ export class ToolsComponent {
) {}
ngOnInit() {
// eslint-disable-next-line rxjs-angular/prefer-takeuntil, rxjs/no-async-subscribe
this.route.parent.params.subscribe(async (params) => {
this.organization = await this.organizationService.get(params.organizationId);
// TODO: Maybe we want to just make sure they are not on a free plan? Just compare useTotp for now

View File

@@ -16,6 +16,7 @@ import { UnsecuredWebsitesReportComponent as BaseUnsecuredWebsitesReportComponen
selector: "app-unsecured-websites-report",
templateUrl: "../../reports/pages/unsecured-websites-report.component.html",
})
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
export class UnsecuredWebsitesReportComponent extends BaseUnsecuredWebsitesReportComponent {
constructor(
cipherService: CipherService,
@@ -30,6 +31,7 @@ export class UnsecuredWebsitesReportComponent extends BaseUnsecuredWebsitesRepor
}
async ngOnInit() {
// eslint-disable-next-line rxjs-angular/prefer-takeuntil, rxjs/no-async-subscribe
this.route.parent.parent.params.subscribe(async (params) => {
this.organization = await this.organizationService.get(params.organizationId);
await super.ngOnInit();

View File

@@ -18,6 +18,7 @@ import { WeakPasswordsReportComponent as BaseWeakPasswordsReportComponent } from
selector: "app-weak-passwords-report",
templateUrl: "../../reports/pages/weak-passwords-report.component.html",
})
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
export class WeakPasswordsReportComponent extends BaseWeakPasswordsReportComponent {
manageableCiphers: Cipher[];
@@ -42,6 +43,7 @@ export class WeakPasswordsReportComponent extends BaseWeakPasswordsReportCompone
}
async ngOnInit() {
// eslint-disable-next-line rxjs-angular/prefer-takeuntil, rxjs/no-async-subscribe
this.route.parent.parent.params.subscribe(async (params) => {
this.organization = await this.organizationService.get(params.organizationId);
this.manageableCiphers = await this.cipherService.getAll();

View File

@@ -86,11 +86,13 @@ export class VaultComponent implements OnInit, OnDestroy {
? "trashCleanupWarningSelfHosted"
: "trashCleanupWarning"
);
// eslint-disable-next-line rxjs-angular/prefer-takeuntil, rxjs/no-async-subscribe
this.route.parent.params.subscribe(async (params: any) => {
this.organization = await this.organizationService.get(params.organizationId);
this.vaultFilterComponent.organization = this.organization;
this.ciphersComponent.organization = this.organization;
/* eslint-disable-next-line rxjs-angular/prefer-takeuntil, rxjs/no-async-subscribe, rxjs/no-nested-subscribe */
this.route.queryParams.pipe(first()).subscribe(async (qParams) => {
this.ciphersComponent.searchText = this.vaultFilterComponent.searchText = qParams.search;
if (!this.organization.canViewAllCollections) {
@@ -126,6 +128,7 @@ export class VaultComponent implements OnInit, OnDestroy {
}
}
/* eslint-disable-next-line rxjs-angular/prefer-takeuntil, rxjs/no-async-subscribe, rxjs/no-nested-subscribe */
this.route.queryParams.subscribe(async (params) => {
const cipherId = getCipherIdFromParams(params);
if (cipherId) {
@@ -191,11 +194,14 @@ export class VaultComponent implements OnInit, OnDestroy {
(comp) => {
comp.organization = this.organization;
comp.cipherId = cipher.id;
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
comp.onUploadedAttachment.subscribe(() => (madeAttachmentChanges = true));
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
comp.onDeletedAttachment.subscribe(() => (madeAttachmentChanges = true));
}
);
// eslint-disable-next-line rxjs-angular/prefer-takeuntil, rxjs/no-async-subscribe
modal.onClosed.subscribe(async () => {
if (madeAttachmentChanges) {
await this.ciphersComponent.refresh();
@@ -217,6 +223,7 @@ export class VaultComponent implements OnInit, OnDestroy {
}
comp.organization = this.organization;
comp.cipherId = cipher.id;
// eslint-disable-next-line rxjs-angular/prefer-takeuntil, rxjs/no-async-subscribe
comp.onSavedCollections.subscribe(async () => {
modal.close();
await this.ciphersComponent.refresh();
@@ -258,14 +265,17 @@ export class VaultComponent implements OnInit, OnDestroy {
(comp) => {
comp.organization = this.organization;
comp.cipherId = cipherId;
// eslint-disable-next-line rxjs-angular/prefer-takeuntil, rxjs/no-async-subscribe
comp.onSavedCipher.subscribe(async () => {
modal.close();
await this.ciphersComponent.refresh();
});
// eslint-disable-next-line rxjs-angular/prefer-takeuntil, rxjs/no-async-subscribe
comp.onDeletedCipher.subscribe(async () => {
modal.close();
await this.ciphersComponent.refresh();
});
// eslint-disable-next-line rxjs-angular/prefer-takeuntil, rxjs/no-async-subscribe
comp.onRestoredCipher.subscribe(async () => {
modal.close();
await this.ciphersComponent.refresh();

View File

@@ -53,14 +53,17 @@ export class CipherReportComponent {
}
comp.cipherId = cipher == null ? null : cipher.id;
// eslint-disable-next-line rxjs/no-async-subscribe
comp.onSavedCipher.subscribe(async () => {
modal.close();
await this.load();
});
// eslint-disable-next-line rxjs/no-async-subscribe
comp.onDeletedCipher.subscribe(async () => {
modal.close();
await this.load();
});
// eslint-disable-next-line rxjs/no-async-subscribe
comp.onRestoredCipher.subscribe(async () => {
modal.close();
await this.load();

View File

@@ -14,6 +14,7 @@ export class ReportsLayoutComponent implements OnDestroy {
constructor(router: Router) {
this.subscription = router.events
.pipe(filter((event) => event instanceof NavigationEnd))
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
.subscribe((event) => {
this.homepage = (event as NavigationEnd).url == "/reports";
});

View File

@@ -22,6 +22,7 @@ import { SendAccessView } from "@bitwarden/common/models/view/sendAccessView";
selector: "app-send-access",
templateUrl: "access.component.html",
})
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
export class AccessComponent implements OnInit {
send: SendAccessView;
sendType = SendType;
@@ -72,6 +73,7 @@ export class AccessComponent implements OnInit {
}
ngOnInit() {
// eslint-disable-next-line rxjs-angular/prefer-takeuntil, rxjs/no-async-subscribe
this.route.params.subscribe(async (params) => {
this.id = params.sendId;
this.key = params.key;

View File

@@ -85,10 +85,12 @@ export class SendComponent extends BaseSendComponent {
this.sendAddEditModalRef,
(comp) => {
comp.sendId = send == null ? null : send.id;
// eslint-disable-next-line rxjs-angular/prefer-takeuntil, rxjs/no-async-subscribe
comp.onSavedSend.subscribe(async () => {
modal.close();
await this.load();
});
// eslint-disable-next-line rxjs-angular/prefer-takeuntil, rxjs/no-async-subscribe
comp.onDeletedSend.subscribe(async () => {
modal.close();
await this.load();

View File

@@ -11,6 +11,7 @@ import { OrganizationPlansComponent } from "./organization-plans.component";
selector: "app-create-organization",
templateUrl: "create-organization.component.html",
})
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
export class CreateOrganizationComponent implements OnInit {
@ViewChild(OrganizationPlansComponent, { static: true })
orgPlansComponent: OrganizationPlansComponent;
@@ -18,6 +19,7 @@ export class CreateOrganizationComponent implements OnInit {
constructor(private route: ActivatedRoute) {}
ngOnInit() {
// eslint-disable-next-line rxjs-angular/prefer-takeuntil, rxjs/no-async-subscribe
this.route.queryParams.pipe(first()).subscribe(async (qParams) => {
if (qParams.plan === "families") {
this.orgPlansComponent.plan = PlanType.FamiliesAnnually;

View File

@@ -18,6 +18,7 @@ import { EmergencyAddEditComponent } from "./emergency-add-edit.component";
selector: "emergency-access-view",
templateUrl: "emergency-access-view.component.html",
})
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
export class EmergencyAccessViewComponent implements OnInit {
@ViewChild("cipherAddEdit", { read: ViewContainerRef, static: true })
cipherAddEditModalRef: ViewContainerRef;
@@ -38,6 +39,7 @@ export class EmergencyAccessViewComponent implements OnInit {
) {}
ngOnInit() {
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
this.route.params.subscribe((qParams) => {
if (qParams.id == null) {
return this.router.navigate(["settings/emergency-access"]);

View File

@@ -27,6 +27,7 @@ import { EmergencyAccessTakeoverComponent } from "./emergency-access-takeover.co
selector: "emergency-access",
templateUrl: "emergency-access.component.html",
})
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
export class EmergencyAccessComponent implements OnInit {
@ViewChild("addEdit", { read: ViewContainerRef, static: true }) addEditModalRef: ViewContainerRef;
@ViewChild("takeoverTemplate", { read: ViewContainerRef, static: true })
@@ -84,10 +85,12 @@ export class EmergencyAccessComponent implements OnInit {
comp.name = this.userNamePipe.transform(details);
comp.emergencyAccessId = details?.id;
comp.readOnly = !this.canAccessPremium;
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
comp.onSaved.subscribe(() => {
modal.close();
this.load();
});
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
comp.onDeleted.subscribe(() => {
modal.close();
this.remove(details);
@@ -132,6 +135,7 @@ export class EmergencyAccessComponent implements OnInit {
comp.name = this.userNamePipe.transform(contact);
comp.emergencyAccessId = contact.id;
comp.userId = contact?.granteeId;
// eslint-disable-next-line rxjs-angular/prefer-takeuntil, rxjs/no-async-subscribe
comp.onConfirmed.subscribe(async () => {
modal.close();
@@ -264,6 +268,7 @@ export class EmergencyAccessComponent implements OnInit {
comp.email = details.email;
comp.emergencyAccessId = details != null ? details.id : null;
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
comp.onDone.subscribe(() => {
modal.close();
this.platformUtilsService.showToast(

View File

@@ -27,7 +27,7 @@ export class PaymentComponent implements OnInit, OnDestroy {
@Input() hideCredit = false;
@Input() trialFlow = false;
private destroy$: Subject<void> = new Subject<void>();
private destroy$ = new Subject<void>();
bank: any = {
routing_number: null,

View File

@@ -18,6 +18,7 @@ type TaxInfoView = Omit<TaxInfoResponse, "taxIdType"> & {
selector: "app-tax-info",
templateUrl: "tax-info.component.html",
})
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
export class TaxInfoComponent {
@Input() trialFlow = false;
@Output() onCountryChanged = new EventEmitter();
@@ -56,6 +57,7 @@ export class TaxInfoComponent {
) {}
async ngOnInit() {
// eslint-disable-next-line rxjs-angular/prefer-takeuntil, rxjs/no-async-subscribe
this.route.parent.parent.params.subscribe(async (params) => {
this.organizationId = params.organizationId;
if (this.organizationId) {

View File

@@ -25,6 +25,7 @@ import { TwoFactorYubiKeyComponent } from "./two-factor-yubikey.component";
selector: "app-two-factor-setup",
templateUrl: "two-factor-setup.component.html",
})
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
export class TwoFactorSetupComponent implements OnInit {
@ViewChild("recoveryTemplate", { read: ViewContainerRef, static: true })
recoveryModalRef: ViewContainerRef;
@@ -116,6 +117,7 @@ export class TwoFactorSetupComponent implements OnInit {
this.authenticatorModalRef,
TwoFactorAuthenticatorComponent
);
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
authComp.onUpdated.subscribe((enabled: boolean) => {
this.updateStatus(enabled, TwoFactorProviderType.Authenticator);
});
@@ -123,6 +125,7 @@ export class TwoFactorSetupComponent implements OnInit {
}
case TwoFactorProviderType.Yubikey: {
const yubiComp = await this.openModal(this.yubikeyModalRef, TwoFactorYubiKeyComponent);
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
yubiComp.onUpdated.subscribe((enabled: boolean) => {
this.updateStatus(enabled, TwoFactorProviderType.Yubikey);
});
@@ -130,6 +133,7 @@ export class TwoFactorSetupComponent implements OnInit {
}
case TwoFactorProviderType.Duo: {
const duoComp = await this.openModal(this.duoModalRef, TwoFactorDuoComponent);
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
duoComp.onUpdated.subscribe((enabled: boolean) => {
this.updateStatus(enabled, TwoFactorProviderType.Duo);
});
@@ -137,6 +141,7 @@ export class TwoFactorSetupComponent implements OnInit {
}
case TwoFactorProviderType.Email: {
const emailComp = await this.openModal(this.emailModalRef, TwoFactorEmailComponent);
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
emailComp.onUpdated.subscribe((enabled: boolean) => {
this.updateStatus(enabled, TwoFactorProviderType.Email);
});
@@ -147,6 +152,7 @@ export class TwoFactorSetupComponent implements OnInit {
this.webAuthnModalRef,
TwoFactorWebAuthnComponent
);
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
webAuthnComp.onUpdated.subscribe((enabled: boolean) => {
this.updateStatus(enabled, TwoFactorProviderType.WebAuthn);
});

View File

@@ -17,6 +17,7 @@ import { CiphersComponent } from "./ciphers.component";
selector: "app-vault-bulk-actions",
templateUrl: "bulk-actions.component.html",
})
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
export class BulkActionsComponent {
@Input() ciphersComponent: CiphersComponent;
@Input() deleted: boolean;
@@ -60,6 +61,7 @@ export class BulkActionsComponent {
comp.permanent = this.deleted;
comp.cipherIds = selectedIds;
comp.organization = this.organization;
// eslint-disable-next-line rxjs-angular/prefer-takeuntil, rxjs/no-async-subscribe
comp.onDeleted.subscribe(async () => {
modal.close();
await this.ciphersComponent.refresh();
@@ -88,6 +90,7 @@ export class BulkActionsComponent {
this.bulkRestoreModalRef,
(comp) => {
comp.cipherIds = selectedIds;
// eslint-disable-next-line rxjs-angular/prefer-takeuntil, rxjs/no-async-subscribe
comp.onRestored.subscribe(async () => {
modal.close();
await this.ciphersComponent.refresh();
@@ -116,6 +119,7 @@ export class BulkActionsComponent {
this.bulkShareModalRef,
(comp) => {
comp.ciphers = selectedCiphers;
// eslint-disable-next-line rxjs-angular/prefer-takeuntil, rxjs/no-async-subscribe
comp.onShared.subscribe(async () => {
modal.close();
await this.ciphersComponent.refresh();
@@ -144,6 +148,7 @@ export class BulkActionsComponent {
this.bulkMoveModalRef,
(comp) => {
comp.cipherIds = selectedIds;
// eslint-disable-next-line rxjs-angular/prefer-takeuntil, rxjs/no-async-subscribe
comp.onMoved.subscribe(async () => {
modal.close();
await this.ciphersComponent.refresh();

View File

@@ -8,6 +8,7 @@ import { VaultFilterService } from "./shared/vault-filter.service";
selector: "./app-vault-filter",
templateUrl: "vault-filter.component.html",
})
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
export class VaultFilterComponent extends BaseVaultFilterComponent {
@Output() onSearchTextChanged = new EventEmitter<string>();
@@ -22,6 +23,7 @@ export class VaultFilterComponent extends BaseVaultFilterComponent {
async ngOnInit() {
await super.ngOnInit();
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
this.vaultFilterService.collapsedFilterNodes$.subscribe((nodes) => {
this.collapsedFilterNodes = nodes;
});

View File

@@ -97,6 +97,7 @@ export class VaultComponent implements OnInit, OnDestroy {
: "trashCleanupWarning"
);
// eslint-disable-next-line rxjs-angular/prefer-takeuntil, rxjs/no-async-subscribe
this.route.queryParams.pipe(first()).subscribe(async (params) => {
await this.syncService.fullSync(false);
const canAccessPremium = await this.stateService.getCanAccessPremium();
@@ -120,6 +121,7 @@ export class VaultComponent implements OnInit, OnDestroy {
}
await this.ciphersComponent.reload();
/* eslint-disable-next-line rxjs-angular/prefer-takeuntil, rxjs/no-async-subscribe, rxjs/no-nested-subscribe */
this.route.queryParams.subscribe(async (params) => {
const cipherId = getCipherIdFromParams(params);
if (cipherId) {
@@ -221,12 +223,16 @@ export class VaultComponent implements OnInit, OnDestroy {
this.attachmentsModalRef,
(comp) => {
comp.cipherId = cipher.id;
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
comp.onUploadedAttachment.subscribe(() => (madeAttachmentChanges = true));
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
comp.onDeletedAttachment.subscribe(() => (madeAttachmentChanges = true));
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
comp.onReuploadedAttachment.subscribe(() => (madeAttachmentChanges = true));
}
);
// eslint-disable-next-line rxjs-angular/prefer-takeuntil, rxjs/no-async-subscribe
modal.onClosed.subscribe(async () => {
if (madeAttachmentChanges) {
await this.ciphersComponent.refresh();
@@ -241,6 +247,7 @@ export class VaultComponent implements OnInit, OnDestroy {
this.shareModalRef,
(comp) => {
comp.cipherId = cipher.id;
// eslint-disable-next-line rxjs-angular/prefer-takeuntil, rxjs/no-async-subscribe
comp.onSharedCipher.subscribe(async () => {
modal.close();
await this.ciphersComponent.refresh();
@@ -255,6 +262,7 @@ export class VaultComponent implements OnInit, OnDestroy {
this.collectionsModalRef,
(comp) => {
comp.cipherId = cipher.id;
// eslint-disable-next-line rxjs-angular/prefer-takeuntil, rxjs/no-async-subscribe
comp.onSavedCollections.subscribe(async () => {
modal.close();
await this.ciphersComponent.refresh();
@@ -269,6 +277,7 @@ export class VaultComponent implements OnInit, OnDestroy {
this.folderAddEditModalRef,
(comp) => {
comp.folderId = null;
// eslint-disable-next-line rxjs-angular/prefer-takeuntil, rxjs/no-async-subscribe
comp.onSavedFolder.subscribe(async () => {
modal.close();
await this.filterComponent.reloadCollectionsAndFolders(this.activeFilter);
@@ -283,10 +292,12 @@ export class VaultComponent implements OnInit, OnDestroy {
this.folderAddEditModalRef,
(comp) => {
comp.folderId = folderId;
// eslint-disable-next-line rxjs-angular/prefer-takeuntil, rxjs/no-async-subscribe
comp.onSavedFolder.subscribe(async () => {
modal.close();
await this.filterComponent.reloadCollectionsAndFolders(this.activeFilter);
});
// eslint-disable-next-line rxjs-angular/prefer-takeuntil, rxjs/no-async-subscribe
comp.onDeletedFolder.subscribe(async () => {
modal.close();
await this.filterComponent.reloadCollectionsAndFolders(this.activeFilter);
@@ -334,14 +345,17 @@ export class VaultComponent implements OnInit, OnDestroy {
this.cipherAddEditModalRef,
(comp) => {
comp.cipherId = id;
// eslint-disable-next-line rxjs-angular/prefer-takeuntil, rxjs/no-async-subscribe
comp.onSavedCipher.subscribe(async () => {
modal.close();
await this.ciphersComponent.refresh();
});
// eslint-disable-next-line rxjs-angular/prefer-takeuntil, rxjs/no-async-subscribe
comp.onDeletedCipher.subscribe(async () => {
modal.close();
await this.ciphersComponent.refresh();
});
// eslint-disable-next-line rxjs-angular/prefer-takeuntil, rxjs/no-async-subscribe
comp.onRestoredCipher.subscribe(async () => {
modal.close();
await this.ciphersComponent.refresh();