mirror of
https://github.com/stashapp/stash.git
synced 2025-12-18 12:54:38 +03:00
Delete funscripts while deleting scene (#2265)
* Delete funscripts while deleting scene * Indicate that funscripts will be deleted Co-authored-by: WithoutPants <53250216+WithoutPants@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
0e514183a7
commit
10bb9a6abc
@@ -67,11 +67,29 @@ export const DeleteScenesDialog: React.FC<IDeleteSceneDialogProps> = (
|
||||
props.onClose(true);
|
||||
}
|
||||
|
||||
function funscriptPath(scenePath: string) {
|
||||
const extIndex = scenePath.lastIndexOf(".");
|
||||
if (extIndex !== -1) {
|
||||
return scenePath.substring(0, extIndex + 1) + "funscript";
|
||||
}
|
||||
|
||||
return scenePath;
|
||||
}
|
||||
|
||||
function maybeRenderDeleteFileAlert() {
|
||||
if (!deleteFile) {
|
||||
return;
|
||||
}
|
||||
|
||||
const deletedFiles: string[] = [];
|
||||
|
||||
props.selected.forEach((s) => {
|
||||
deletedFiles.push(s.path);
|
||||
if (s.interactive) {
|
||||
deletedFiles.push(funscriptPath(s.path));
|
||||
}
|
||||
});
|
||||
|
||||
return (
|
||||
<div className="delete-dialog alert alert-danger text-break">
|
||||
<p className="font-weight-bold">
|
||||
@@ -85,13 +103,13 @@ export const DeleteScenesDialog: React.FC<IDeleteSceneDialogProps> = (
|
||||
/>
|
||||
</p>
|
||||
<ul>
|
||||
{props.selected.slice(0, 5).map((s) => (
|
||||
<li key={s.path}>{s.path}</li>
|
||||
{deletedFiles.slice(0, 5).map((s) => (
|
||||
<li key={s}>{s}</li>
|
||||
))}
|
||||
{props.selected.length > 5 && (
|
||||
{deletedFiles.length > 5 && (
|
||||
<FormattedMessage
|
||||
values={{
|
||||
count: props.selected.length - 5,
|
||||
count: deletedFiles.length - 5,
|
||||
singularEntity: intl.formatMessage({ id: "file" }),
|
||||
pluralEntity: intl.formatMessage({ id: "files" }),
|
||||
}}
|
||||
@@ -126,7 +144,9 @@ export const DeleteScenesDialog: React.FC<IDeleteSceneDialogProps> = (
|
||||
<Form.Check
|
||||
id="delete-file"
|
||||
checked={deleteFile}
|
||||
label={intl.formatMessage({ id: "actions.delete_file" })}
|
||||
label={intl.formatMessage({
|
||||
id: "actions.delete_file_and_funscript",
|
||||
})}
|
||||
onChange={() => setDeleteFile(!deleteFile)}
|
||||
/>
|
||||
<Form.Check
|
||||
|
||||
Reference in New Issue
Block a user