Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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 @@ -56,6 +56,7 @@ Note that this project **does not** adhere to [Semantic Versioning](https://semv

### Fixed

- We fixed an issue where the generate citation keys toolbar button stopped working after canceling an overwrite. [#17748](https://github.com/JabRef/jabref/issues/17748)
- We fixed an issue where the DocBook export wrote invalid XML for emoji and some math symbols. [#17747](https://github.com/JabRef/jabref/issues/17747)
- We fixed an issue where clicking "Generate" in the AUX file import dialog before parsing caused an exception.
- We fixed an issue where it was hard to distinguish between enabled/disabled status of search buttons in dark mode and added tooltips. [#11569](https://github.com/JabRef/jabref/issues/11569)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ public GenerateCitationKeyAction(Supplier<LibraryTab> tabSupplier,

@Override
public void execute() {
isCanceled = false;
Comment thread
SachinyadavAug20 marked this conversation as resolved.
Resolved
entries = new ArrayList<>(stateManager.getSelectedEntries());
stateManager.getActiveDatabase().ifPresent(this::generateKeysIn);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,4 +105,30 @@ void regeneratingAfterCollidingEntryIsRemovedKeepsKeyWhenOverwriteIsAvoided() {
verify(dialogService, never()).showConfirmationDialogWithOptOutAndWait(anyString(), anyString(), anyString(), anyString(), anyString(), any());
assertEquals(Optional.of("Wang2020a"), remainingWang.getCitationKey());
}

@Test
void executeGeneratesKeyAfterPreviousExecutionWasCanceled() {
Comment thread
SachinyadavAug20 marked this conversation as resolved.
Resolved
useKeyPreferences(false);
when(dialogService.showConfirmationDialogWithOptOutAndWait(anyString(), anyString(), anyString(), anyString(), anyString(), any()))
.thenReturn(false);

GenerateCitationKeyAction action = new GenerateCitationKeyAction(
() -> null, dialogService, stateManager, new CurrentThreadTaskExecutor(), preferences);

JavaFxExtension.invokeAndWait(action::execute);
JavaFxExtension.awaitEvents();

assertEquals(Optional.of("Wang2020a"), remainingWang.getCitationKey());

BibEntry entryWithoutKey = new BibEntry()
.withField(StandardField.AUTHOR, "Smith, Jane")
.withField(StandardField.YEAR, "2026");
stateManager.getActiveDatabase().get().getDatabase().insertEntry(entryWithoutKey);
when(stateManager.getSelectedEntries()).thenReturn(FXCollections.observableArrayList(entryWithoutKey));

JavaFxExtension.invokeAndWait(action::execute);
JavaFxExtension.awaitEvents();

assertEquals(Optional.of("Smith2026"), entryWithoutKey.getCitationKey());
}
}
Loading