From 1376ea8fd5b0417778f0d8b648e415e0573105e1 Mon Sep 17 00:00:00 2001 From: neobooru <50623835+neobooru@users.noreply.github.com> Date: Sun, 28 May 2023 17:43:09 +0200 Subject: [PATCH] Small fixes in the merge posts feature. --- package.json | 1 + pnpm-lock.yaml | 3 ++- src/popup/pages/MergePost.vue | 16 ++++++++++++-- src/stores/index.ts | 39 +++++++++++++++++++++-------------- 4 files changed, 40 insertions(+), 19 deletions(-) diff --git a/package.json b/package.json index 7a7cb7c..8c7aad1 100644 --- a/package.json +++ b/package.json @@ -28,6 +28,7 @@ "dependencies": { "axios": "^1.2.2", "basscss": "^8.1.0", + "deepmerge": "^4.3.1", "lodash": "^4.17.21", "markdown-it": "^13.0.1", "neo-scraper": "^0.5.8", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 77dbde2..af9abe4 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -20,6 +20,7 @@ specifiers: chokidar: ^3.5.3 cross-env: ^7.0.3 crx: ^5.0.1 + deepmerge: ^4.3.1 eslint: ^8.32.0 eslint-plugin-vue: ^9.9.0 esno: ^0.16.3 @@ -48,6 +49,7 @@ specifiers: dependencies: axios: 1.4.0 basscss: 8.1.0 + deepmerge: 4.3.1 lodash: 4.17.21 markdown-it: 13.0.1 neo-scraper: 0.5.8 @@ -2192,7 +2194,6 @@ packages: /deepmerge/4.3.1: resolution: {integrity: sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A==} engines: {node: '>=0.10.0'} - dev: true /defaults/1.0.4: resolution: {integrity: sha512-eFuaLoy/Rxalv2kr+lqMlUnrDWV+3j4pljOIJgLIhI058IQfWJ7vXhyEIHu+HtC738klGALYxOKDO0bQP3tg8A==} diff --git a/src/popup/pages/MergePost.vue b/src/popup/pages/MergePost.vue index 4b51e0a..c8b237e 100644 --- a/src/popup/pages/MergePost.vue +++ b/src/popup/pages/MergePost.vue @@ -2,6 +2,7 @@ import { isEqual, cloneDeep } from "lodash"; import SzurubooruApi from "~/api"; import { Post, UpdatePostRequest } from "~/api/models"; +import { isMobile } from "~/env"; import { BrowserCommand, PostUpdateCommandData, TagDetails } from "~/models"; import { cfg, useMergeStore, usePopupStore } from "~/stores"; import { emptyPost, getUrl } from "~/utils"; @@ -146,6 +147,12 @@ async function mergeChanges() { return; } + merge.uploadInfo.push({ + instanceId: szuruConfig.id, + postId: `merge-${existingPostRo.id}`, + info: { state: "uploading", instancePostId: existingPostRo.id }, + }); + const cmdData = new PostUpdateCommandData(existingPostRo.id, req, szuruConfig); const cmd = new BrowserCommand("update_post", cmdData); await browser.runtime.sendMessage(cmd); @@ -194,7 +201,13 @@ watch( ); onMounted(async () => { + // Clear upload info and error. + merge.uploadInfo.splice(0); + merge.genericError = undefined; + + // Load existing post data. existingPostRo = await szuru?.getPost(props.postId); + if (existingPostRo) { post.value = cloneDeep(existingPostRo); if (cfg.value.merge.appendSource) appendSources(); @@ -237,8 +250,7 @@ onMounted(async () => { - -