Merge pull request #389 from padloc/fix/issue-338

Redirect to new location after moving item to different vault
This commit is contained in:
Martin Kleinschrodt 2022-01-17 19:54:17 +01:00 committed by GitHub
commit 656711fcfc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 5 deletions

View File

@ -102,6 +102,10 @@ export class ItemView extends Routing(StateMixin(LitElement)) {
async handleRoute([id, mode]: [string, string], { addattachment }: { [prop: string]: string }) {
this.itemId = id;
if (this.itemId && !this._item) {
this.redirect("items");
}
this.isNew = mode === "new";
if (["new", "edit"].includes(mode)) {
@ -539,7 +543,7 @@ export class ItemView extends Routing(StateMixin(LitElement)) {
} else {
const movedItems = await this._moveItemsDialog.show([{ item: this._item!, vault: this._vault! }]);
if (movedItems && movedItems.length) {
this.go(`items/${movedItems[0].id}`, undefined, undefined, true);
this.go(`items/${movedItems[0].id}`, undefined, true, true);
}
}
}

View File

@ -504,13 +504,13 @@ export class ItemsList extends StateMixin(LitElement) {
}
cancelSearch() {
if (this._filterInput.value) {
if (this._filterInput?.value) {
this._filterInput.value = "";
this._updateFilterParam();
this._updateItems();
}
this._filterShowing = false;
this._filterInput.blur();
this._filterInput?.blur();
}
selectItem(item: ListItem) {

View File

@ -59,17 +59,17 @@ export class MoveItemsDialog extends Dialog<{ vault: Vault; item: VaultItem }[],
this._enterButton.start();
try {
let start = Date.now();
await app.moveItems(
const moved = await app.moveItems(
this.items.map((i) => i.item),
this._vaultSelect.value!
);
console.log("done moving items", Date.now() - start);
this._enterButton.success();
this.done(moved);
} catch (e) {
alert(e.message, { type: "warning" });
this._enterButton.fail();
}
this.done();
}
async show(items: { vault: Vault; item: VaultItem }[]) {