diff --git a/src/app/hydrus-api.service.ts b/src/app/hydrus-api.service.ts index 190e2cf..8a930aa 100644 --- a/src/app/hydrus-api.service.ts +++ b/src/app/hydrus-api.service.ts @@ -411,7 +411,9 @@ export class HydrusApiService { service_names_to_tags?: ServiceNamesOrKeysToTags, service_keys_to_tags?: ServiceNamesOrKeysToTags, service_names_to_actions_to_tags?: ServiceNamesOrKeysToActionsToTags, - service_keys_to_actions_to_tags?: ServiceNamesOrKeysToActionsToTags + service_keys_to_actions_to_tags?: ServiceNamesOrKeysToActionsToTags, + override_previously_deleted_mappings?: boolean, // added in hydrus v580 + create_new_deleted_mappings?: boolean // added in hydrus v580 } & HydrusRequestFiles) { return this.apiPost('add_tags/add_tags', data); } diff --git a/src/app/hydrus-tags.service.ts b/src/app/hydrus-tags.service.ts index 5cff0b4..9993886 100644 --- a/src/app/hydrus-tags.service.ts +++ b/src/app/hydrus-tags.service.ts @@ -67,7 +67,7 @@ export class HydrusTagsService { ) } - deleteTagsFromLocalServiceFileIDs(file_ids: number[], tags: string[], serviceKey: string) { + deleteTagsFromLocalServiceFileIDs(file_ids: number[], tags: string[], serviceKey: string, create_new_deleted_mappings = false) { return this.api.addTags( { file_ids, @@ -75,7 +75,8 @@ export class HydrusTagsService { [serviceKey]: { "1": tags } - } + }, + create_new_deleted_mappings } ) } diff --git a/src/app/image-list-loader/image-list-loader.component.ts b/src/app/image-list-loader/image-list-loader.component.ts index 41bd2ad..07535f6 100644 --- a/src/app/image-list-loader/image-list-loader.component.ts +++ b/src/app/image-list-loader/image-list-loader.component.ts @@ -12,6 +12,7 @@ import { getLocalTagServices } from '../hydrus-services'; import { TagInputDialogComponent } from '../tag-input-dialog/tag-input-dialog.component'; import { HydrusTagsService } from '../hydrus-tags.service'; import { union } from 'set-utilities'; +import { HydrusVersionService } from '../hydrus-version.service'; @Component({ selector: 'app-image-list-loader', @@ -48,7 +49,8 @@ export class ImageListLoaderComponent implements OnInit, OnChanges { private snackbar: MatSnackBar, private dialog: MatDialog, private errorService: ErrorService, - private tagsService: HydrusTagsService + private tagsService: HydrusTagsService, + private versionService: HydrusVersionService ) { } @@ -242,7 +244,8 @@ export class ImageListLoaderComponent implements OnInit, OnChanges { }) const dialogResult = await firstValueFrom(tagsDialog.afterClosed()); if (dialogResult) { - if (!await ConfirmDialogComponent.confirmPromise(this.dialog, { + // the ability to disable creating new deleted mappings for tags that weren't on the file to begin with was added in hydrus v580 + if (!await firstValueFrom(this.versionService.isAtLeastVersion(580)) && !await ConfirmDialogComponent.confirmPromise(this.dialog, { title: 'Delete tags from selected files?', description: `This will attempt to delete the selected tags from ${this.numSelected()} files. A deletion record will be created for the tags on all selected files, including those that do not currently have the tags.`, })) return;