fix: exclude to-be-moved folder from move dialog (#5235)

This commit is contained in:
Foxy Hunter 2025-06-29 11:23:06 +02:00 committed by GitHub
parent 10684e5390
commit 7354eb6cf9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 13 additions and 0 deletions

View File

@ -35,6 +35,12 @@ import { StatusError } from "@/api/utils.js";
export default {
name: "file-list",
props: {
exclude: {
type: Array,
default: () => [],
},
},
data: function () {
return {
items: [],
@ -90,6 +96,7 @@ export default {
// move options.
for (const item of req.items) {
if (!item.isDir) continue;
if (this.exclude?.includes(item.url)) continue;
this.items.push({
name: item.name,

View File

@ -8,6 +8,7 @@
<file-list
ref="fileList"
@update:selected="(val) => (dest = val)"
:exclude="excludedFolders"
tabindex="1"
/>
</div>
@ -76,6 +77,11 @@ export default {
computed: {
...mapState(useFileStore, ["req", "selected"]),
...mapState(useAuthStore, ["user"]),
excludedFolders() {
return this.selected
.filter((idx) => this.req.items[idx].isDir)
.map((idx) => this.req.items[idx].url);
},
},
methods: {
...mapActions(useLayoutStore, ["showHover", "closeHovers"]),