Skip to content

Commit

Permalink
Allow importing history with same name as original history
Browse files Browse the repository at this point in the history
This only applies if the history is an external one, for current
user's histories, we still disallow the same name.

By default, the pre-filled value is still "Copy of Original Name"
Can change it so by default, the name is just the original name?
  • Loading branch information
ahmedhamidawan committed Sep 26, 2023
1 parent f10e470 commit d523214
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions client/src/components/History/Modals/CopyModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export default {
};
},
computed: {
...mapState(useUserStore, ["isAnonymous"]),
...mapState(useUserStore, ["currentUser", "isAnonymous"]),
title() {
return `Copying History: ${this.history.name}`;
},
Expand All @@ -72,8 +72,11 @@ 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) {
if (this.userOwnsHistory && this.name == this.history.name) {
return null;
}
return this.name.length > 0;
Expand Down

0 comments on commit d523214

Please sign in to comment.