fix: avoid sending the same name in the file/folder rename modal (#5806)
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
|
||||
<div class="card-content">
|
||||
<p>
|
||||
{{ $t("prompts.renameMessage") }} <code>{{ oldName() }}</code
|
||||
{{ $t("prompts.renameMessage") }} <code>{{ oldName }}</code
|
||||
>:
|
||||
</p>
|
||||
<input
|
||||
@@ -33,6 +33,7 @@
|
||||
type="submit"
|
||||
:aria-label="$t('buttons.rename')"
|
||||
:title="$t('buttons.rename')"
|
||||
:disabled="name === '' || name === oldName"
|
||||
>
|
||||
{{ $t("buttons.rename") }}
|
||||
</button>
|
||||
@@ -56,7 +57,7 @@ export default {
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.name = this.oldName();
|
||||
this.name = this.oldName;
|
||||
},
|
||||
inject: ["$showError"],
|
||||
computed: {
|
||||
@@ -67,25 +68,28 @@ export default {
|
||||
"isListing",
|
||||
]),
|
||||
...mapWritableState(useFileStore, ["reload", "preselect"]),
|
||||
},
|
||||
methods: {
|
||||
...mapActions(useLayoutStore, ["closeHovers"]),
|
||||
cancel: function () {
|
||||
this.closeHovers();
|
||||
},
|
||||
oldName: function () {
|
||||
oldName() {
|
||||
if (!this.isListing) {
|
||||
return this.req.name;
|
||||
}
|
||||
|
||||
if (this.selectedCount === 0 || this.selectedCount > 1) {
|
||||
// This shouldn't happen.
|
||||
return;
|
||||
return "";
|
||||
}
|
||||
|
||||
return this.req.items[this.selected[0]].name;
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
...mapActions(useLayoutStore, ["closeHovers"]),
|
||||
cancel: function () {
|
||||
this.closeHovers();
|
||||
},
|
||||
submit: async function () {
|
||||
if (this.name === "" || this.name === this.oldName) {
|
||||
return;
|
||||
}
|
||||
let oldLink = "";
|
||||
let newLink = "";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user