Skip to content

Fix group #596

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ Note that this project **does not** adhere to [Semantic Versioning](http://semve

- The [HtmlToLaTeXFormatter](https://docs.jabref.org/finding-sorting-and-cleaning-entries/saveactions#html-to-latex) keeps single `<` characters.
- We fixed a performance regression when opening large libraries [#9041](https://github.com/JabRef/jabref/issues/9041)
- Saving after adding a subgroup and removing it do not cause a change notification anymore. [#9064](https://github.com/JabRef/jabref/issues/9064)
- We fixed a bug where spaces are trimmed when highlighting differences in the Entries merge dialog. [koppor#371](https://github.com/koppor/jabref/issues/371)

### Removed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,20 @@ public static Optional<GroupDiff> compare(MetaData originalMetaData, MetaData ne
final Optional<GroupTreeNode> originalGroups = originalMetaData.getGroups();
final Optional<GroupTreeNode> newGroups = newMetaData.getGroups();

if (!originalGroups.equals(newGroups)) {
// special case: the data model may contain the single "All Entries" group without any children
boolean bothGroupsAreEmpty = groupsAreEmpty(originalGroups) && groupsAreEmpty(newGroups);

if (!originalGroups.equals(newGroups) && !bothGroupsAreEmpty) {
return Optional.of(new GroupDiff(originalGroups.orElse(null), newGroups.orElse(null)));
} else {
return Optional.empty();
}
}

private static boolean groupsAreEmpty(Optional<GroupTreeNode> groups) {
return groups.map(g -> g.getChildren().isEmpty()).orElse(true);
}

public GroupTreeNode getOriginalGroupRoot() {
return originalGroupRoot;
}
Expand Down