From 03f722f38a1f969d78849f2550e0baee2e4d8927 Mon Sep 17 00:00:00 2001 From: Trent Larson Date: Fri, 19 Apr 2024 20:13:44 -0600 Subject: [PATCH] make so cropping isn't behind header; delete profile image from storage when deleted --- src/components/GiftedPhotoDialog.vue | 4 ++-- src/views/AccountViewView.vue | 18 +++++++++++++----- src/views/ContactQRScanShowView.vue | 7 ++++++- 3 files changed, 21 insertions(+), 8 deletions(-) diff --git a/src/components/GiftedPhotoDialog.vue b/src/components/GiftedPhotoDialog.vue index 80b5b05..20600bf 100644 --- a/src/components/GiftedPhotoDialog.vue +++ b/src/components/GiftedPhotoDialog.vue @@ -4,7 +4,7 @@
Uploading... Look Good? @@ -12,7 +12,7 @@
diff --git a/src/views/AccountViewView.vue b/src/views/AccountViewView.vue index 6879537..0197941 100644 --- a/src/views/AccountViewView.vue +++ b/src/views/AccountViewView.vue @@ -614,7 +614,6 @@ import { } from "@/libs/endorserServer"; import { Buffer } from "buffer/"; import EntityIcon from "@/components/EntityIcon.vue"; -import {Contact} from "@/db/tables/contacts"; interface IAccount { did: string; @@ -626,7 +625,7 @@ interface IAccount { const inputFileNameRef = ref(); @Component({ - components: {EntityIcon, GiftedPhotoDialog, QuickNav, TopMessage }, + components: { EntityIcon, GiftedPhotoDialog, QuickNav, TopMessage }, }) export default class AccountViewView extends Vue { $notify!: (notification: NotificationIface, timeout?: number) => void; @@ -1384,14 +1383,18 @@ export default class AccountViewView extends Vue { group: "alert", type: "danger", title: "Error", - text: "There was a problem deleting the image.", + text: "There was a problem deleting the image. Contact support if you want it removed from the servers.", }, - 5000, + -1, ); // keep the imageUrl in localStorage so the user can try again if they want - return; } + await db.open(); + db.settings.update(MASTER_SETTINGS_KEY, { + profileImageUrl: undefined, + }); + this.profileImageUrl = undefined; } catch (error) { console.error("Error deleting image:", error); @@ -1399,6 +1402,11 @@ export default class AccountViewView extends Vue { if ((error as any).response.status === 404) { console.log("The image was already deleted:", error); + await db.open(); + db.settings.update(MASTER_SETTINGS_KEY, { + profileImageUrl: undefined, + }); + this.profileImageUrl = undefined; // it already doesn't exist so we won't say anything to the user diff --git a/src/views/ContactQRScanShowView.vue b/src/views/ContactQRScanShowView.vue index be3a0c7..86010b2 100644 --- a/src/views/ContactQRScanShowView.vue +++ b/src/views/ContactQRScanShowView.vue @@ -82,7 +82,12 @@ import { useClipboard } from "@vueuse/core"; import { NotificationIface } from "@/constants/app"; import { accountsDB, db } from "@/db/index"; import { MASTER_SETTINGS_KEY } from "@/db/tables/settings"; -import {deriveAddress, getContactPayloadFromJwtUrl, nextDerivationPath, SimpleSigner} from "@/libs/crypto"; +import { + deriveAddress, + getContactPayloadFromJwtUrl, + nextDerivationPath, + SimpleSigner, +} from "@/libs/crypto"; import QuickNav from "@/components/QuickNav.vue"; import { Account } from "@/db/tables/accounts"; import {