From 054be47fb7024cf1ac52e14b7e783bd37cb9db80 Mon Sep 17 00:00:00 2001 From: Ahmed Awan Date: Mon, 2 Oct 2023 14:56:08 -0500 Subject: [PATCH] Allow importing history with same name as original history --- client/src/components/History/Modals/CopyModal.vue | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/client/src/components/History/Modals/CopyModal.vue b/client/src/components/History/Modals/CopyModal.vue index 0d6e2c3e2ce9..a146bc03f6f7 100644 --- a/client/src/components/History/Modals/CopyModal.vue +++ b/client/src/components/History/Modals/CopyModal.vue @@ -61,7 +61,7 @@ export default { }; }, computed: { - ...mapState(useUserStore, ["isAnonymous"]), + ...mapState(useUserStore, ["currentUser", "isAnonymous"]), title() { return `Copying History: ${this.history.name}`; }, @@ -71,9 +71,12 @@ export default { saveVariant() { return this.loading ? "info" : this.formValid ? "primary" : "secondary"; }, + userOwnsHistory() { + return this.currentUser.id == this.history.user_id; + }, newNameValid() { - if (this.name == this.history.name) { - return null; + if (this.userOwnsHistory && this.name == this.history.name) { + return false; } return this.name.length > 0; },