mirror of
https://github.com/bitwarden/browser
synced 2025-12-13 06:43:35 +00:00
Add fullSync on successful import (#5500)
Analog to https://github.com/bitwarden/clients/pull/4380 we also need to add a full sync to the import.command, so that when a user calls `bw list items` those are populated.
This commit is contained in:
committed by
GitHub
parent
1247463e29
commit
4a552343f1
@@ -2,6 +2,7 @@ import * as program from "commander";
|
|||||||
import * as inquirer from "inquirer";
|
import * as inquirer from "inquirer";
|
||||||
|
|
||||||
import { OrganizationService } from "@bitwarden/common/admin-console/abstractions/organization/organization.service.abstraction";
|
import { OrganizationService } from "@bitwarden/common/admin-console/abstractions/organization/organization.service.abstraction";
|
||||||
|
import { SyncService } from "@bitwarden/common/vault/abstractions/sync/sync.service.abstraction";
|
||||||
import { ImportServiceAbstraction, ImportType } from "@bitwarden/importer";
|
import { ImportServiceAbstraction, ImportType } from "@bitwarden/importer";
|
||||||
|
|
||||||
import { Response } from "../models/response";
|
import { Response } from "../models/response";
|
||||||
@@ -11,7 +12,8 @@ import { CliUtils } from "../utils";
|
|||||||
export class ImportCommand {
|
export class ImportCommand {
|
||||||
constructor(
|
constructor(
|
||||||
private importService: ImportServiceAbstraction,
|
private importService: ImportServiceAbstraction,
|
||||||
private organizationService: OrganizationService
|
private organizationService: OrganizationService,
|
||||||
|
private syncService: SyncService
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
async run(
|
async run(
|
||||||
@@ -76,6 +78,7 @@ export class ImportCommand {
|
|||||||
|
|
||||||
const response = await this.importService.import(importer, contents, organizationId);
|
const response = await this.importService.import(importer, contents, organizationId);
|
||||||
if (response.success) {
|
if (response.success) {
|
||||||
|
this.syncService.fullSync(true);
|
||||||
return Response.success(new MessageResponse("Imported " + filepath, null));
|
return Response.success(new MessageResponse("Imported " + filepath, null));
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|||||||
@@ -442,7 +442,11 @@ export class VaultProgram extends Program {
|
|||||||
})
|
})
|
||||||
.action(async (format, filepath, options) => {
|
.action(async (format, filepath, options) => {
|
||||||
await this.exitIfLocked();
|
await this.exitIfLocked();
|
||||||
const command = new ImportCommand(this.main.importService, this.main.organizationService);
|
const command = new ImportCommand(
|
||||||
|
this.main.importService,
|
||||||
|
this.main.organizationService,
|
||||||
|
this.main.syncService
|
||||||
|
);
|
||||||
const response = await command.run(format, filepath, options);
|
const response = await command.run(format, filepath, options);
|
||||||
this.processResponse(response);
|
this.processResponse(response);
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user