feat: add "redirect after copy/move" user setting (#5662)

This commit is contained in:
Beckam White 2026-01-10 20:27:54 +11:00 committed by GitHub
parent 208535a8cc
commit fda8a99292
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
18 changed files with 119 additions and 80 deletions

View file

@ -109,7 +109,8 @@ export default {
return;
}
this.$router.push({ path: this.dest });
if (this.user.redirectAfterCopyMove)
this.$router.push({ path: this.dest });
})
.catch((e) => {
buttons.done("copy");

View file

@ -79,7 +79,7 @@ export default {
computed: {
...mapState(useFileStore, ["req", "selected"]),
...mapState(useAuthStore, ["user"]),
...mapWritableState(useFileStore, ["preselect"]),
...mapWritableState(useFileStore, ["reload", "preselect"]),
excludedFolders() {
return this.selected
.filter((idx) => this.req.items[idx].isDir)
@ -108,7 +108,9 @@ export default {
.then(() => {
buttons.success("move");
this.preselect = removePrefix(items[0].to);
this.$router.push({ path: this.dest });
if (this.user.redirectAfterCopyMove)
this.$router.push({ path: this.dest });
else this.reload = true;
})
.catch((e) => {
buttons.done("move");

View file

@ -232,6 +232,7 @@
"permissions": "Permissions",
"permissionsHelp": "You can set the user to be an administrator or choose the permissions individually. If you select \"Administrator\", all of the other options will be automatically checked. The management of users remains a privilege of an administrator.\n",
"profileSettings": "Profile Settings",
"redirectAfterCopyMove": "Redirect to destination after copy/move",
"ruleExample1": "prevents the access to any dotfile (such as .git, .gitignore) in every folder.\n",
"ruleExample2": "blocks the access to the file named Caddyfile on the root of the scope.",
"rules": "Rules",

View file

@ -18,6 +18,7 @@ interface SettingsDefaults {
locale: string;
viewMode: ViewModeType;
singleClick: boolean;
redirectAfterCopyMove: boolean;
sorting: Sorting;
perm: Permissions;
commands: any[];

View file

@ -10,6 +10,7 @@ interface IUser {
lockPassword: boolean;
hideDotfiles: boolean;
singleClick: boolean;
redirectAfterCopyMove: boolean;
dateFormat: boolean;
viewMode: ViewModeType;
sorting?: Sorting;
@ -30,6 +31,7 @@ interface IUserForm {
lockPassword?: boolean;
hideDotfiles?: boolean;
singleClick?: boolean;
redirectAfterCopyMove?: boolean;
dateFormat?: boolean;
}

View file

@ -15,6 +15,14 @@
<input type="checkbox" name="singleClick" v-model="singleClick" />
{{ t("settings.singleClick") }}
</p>
<p>
<input
type="checkbox"
name="redirectAfterCopyMove"
v-model="redirectAfterCopyMove"
/>
{{ t("settings.redirectAfterCopyMove") }}
</p>
<p>
<input type="checkbox" name="dateFormat" v-model="dateFormat" />
{{ t("settings.setDateFormat") }}
@ -116,6 +124,7 @@ const currentPassword = ref<string>("");
const isCurrentPasswordRequired = ref<boolean>(false);
const hideDotfiles = ref<boolean>(false);
const singleClick = ref<boolean>(false);
const redirectAfterCopyMove = ref<boolean>(false);
const dateFormat = ref<boolean>(false);
const locale = ref<string>("");
const aceEditorTheme = ref<string>("");
@ -140,6 +149,7 @@ onMounted(async () => {
locale.value = authStore.user.locale;
hideDotfiles.value = authStore.user.hideDotfiles;
singleClick.value = authStore.user.singleClick;
redirectAfterCopyMove.value = authStore.user.redirectAfterCopyMove;
dateFormat.value = authStore.user.dateFormat;
aceEditorTheme.value = authStore.user.aceEditorTheme;
layoutStore.loading = false;
@ -187,6 +197,7 @@ const updateSettings = async (event: Event) => {
locale: locale.value,
hideDotfiles: hideDotfiles.value,
singleClick: singleClick.value,
redirectAfterCopyMove: redirectAfterCopyMove.value,
dateFormat: dateFormat.value,
aceEditorTheme: aceEditorTheme.value,
};
@ -195,6 +206,7 @@ const updateSettings = async (event: Event) => {
"locale",
"hideDotfiles",
"singleClick",
"redirectAfterCopyMove",
"dateFormat",
"aceEditorTheme",
]);