diff --git a/src/views/ContactQRScanShowView.vue b/src/views/ContactQRScanShowView.vue index 8990df30..1bb1da0e 100644 --- a/src/views/ContactQRScanShowView.vue +++ b/src/views/ContactQRScanShowView.vue @@ -213,15 +213,11 @@ export default class ContactQRScanShow extends Vue { $router!: Router; // Notification helper system - private notify = createNotifyHelpers(this.$notify); + notify!: ReturnType; activeDid = ""; apiServer = ""; - // Axios instance for API calls - get axios() { - return (this as any).$platformService.axios; - } givenName = ""; hideRegisterPromptOnNewContact = false; isRegistered = false; @@ -288,6 +284,8 @@ export default class ContactQRScanShow extends Vue { } async created() { + this.notify = createNotifyHelpers(this.$notify); + try { const settings = await this.$accountSettings(); this.activeDid = settings.activeDid || ""; diff --git a/src/views/DIDView.vue b/src/views/DIDView.vue index 30361859..8a5aaa64 100644 --- a/src/views/DIDView.vue +++ b/src/views/DIDView.vue @@ -273,6 +273,7 @@ import { displayAmount, getHeaders, register, + setVisibilityUtil, } from "../libs/endorserServer"; import * as libsUtil from "../libs/util"; import EntityIcon from "../components/EntityIcon.vue"; @@ -324,6 +325,7 @@ export default class DIDView extends Vue { apiServer = ""; claims: Array> = []; contactFromDid?: Contact; + contactYaml = ""; hitEnd = false; isLoading = false; @@ -722,18 +724,31 @@ export default class DIDView extends Vue { visibility: boolean, showSuccessAlert: boolean, ) { - // Update contact visibility using mixin method - await this.$updateContact(contact.did, { seesMe: visibility }); + const result = await setVisibilityUtil( + this.activeDid, + this.apiServer, + this.axios, + contact, + visibility, + ); - if (showSuccessAlert) { + if (result.success) { + if (showSuccessAlert) { + const message = + (contact.name || "That user") + + " can " + + (visibility ? "" : "not ") + + "see your activity."; + this.notify.success(message, TIMEOUTS.SHORT); + } + return true; + } else { + logger.error("Got strange result from setting visibility:", result); const message = - (contact.name || "That user") + - " can " + - (visibility ? "" : "not ") + - "see your activity."; - this.notify.success(message, TIMEOUTS.SHORT); + (result.error as string) || "Could not set visibility on the server."; + this.notify.error(message, TIMEOUTS.LONG); + return false; } - return true; } /**