Cover lock not working in metadata picker and editor

This commit is contained in:
aditya.chandel
2025-08-14 11:41:22 -06:00
committed by Aditya Chandel
parent 6d7235731b
commit 77e02ac7f9
3 changed files with 28 additions and 9 deletions
@@ -3,6 +3,7 @@ package com.adityachandel.booklore.util;
import com.adityachandel.booklore.model.MetadataClearFlags;
import com.adityachandel.booklore.model.dto.BookMetadata;
import com.adityachandel.booklore.model.entity.BookMetadataEntity;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -10,10 +11,9 @@ import java.util.*;
import java.util.function.Supplier;
import java.util.stream.Collectors;
@Slf4j
public class MetadataChangeDetector {
private static final Logger log = LoggerFactory.getLogger(MetadataChangeDetector.class);
public static boolean isDifferent(BookMetadata newMeta, BookMetadataEntity existingMeta, MetadataClearFlags clear) {
if (clear == null) return true;
@@ -46,6 +46,12 @@ public class MetadataChangeDetector {
compare(changes, "authors", clear.isAuthors(), newMeta.getAuthors(), toNameSet(existingMeta.getAuthors()), () -> !isTrue(existingMeta.getAuthorsLocked()), newMeta.getAuthorsLocked(), existingMeta.getAuthorsLocked());
compare(changes, "categories", clear.isCategories(), newMeta.getCategories(), toNameSet(existingMeta.getCategories()), () -> !isTrue(existingMeta.getCategoriesLocked()), newMeta.getCategoriesLocked(), existingMeta.getCategoriesLocked());
Boolean coverLockedNew = newMeta.getCoverLocked();
Boolean coverLockedExisting = existingMeta.getCoverLocked();
if (differsLock(coverLockedNew, coverLockedExisting)) {
changes.add("cover lock: [" + isTrue(coverLockedExisting) + "] → [" + isTrue(coverLockedNew) + "]");
}
if (!changes.isEmpty()) {
/*changes.forEach(change -> log.info("Metadata change: {}", change));*/
return true;