Skip to content
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

Workaround missing "Optional 2" display #11022

Merged
merged 24 commits into from
Mar 19, 2024
Merged

Workaround missing "Optional 2" display #11022

merged 24 commits into from
Mar 19, 2024

Conversation

koppor
Copy link
Member

@koppor koppor commented Mar 13, 2024

In biblatex mode, when resetting the preferences, JabRef displayed "Optional fields" and "Optional fields 2":

312461887-4dc364ff-7cd1-4b8f-94ac-1fe7ef0cc424

When opening the preferences, navigating to "customize entry types" and immediately saving, the "Optional fields 2" disappears and only "Optional fields" are displayed. Moreover, there is no choice between required fields (e.g., author or editor), JabRef now requires both.

This PR adds a work around: Customized entry types are only stored by JabRef if there was any change. If the fields required and optional are the same as in the respective standard type, there is no writing (and no handling). Thus "Optional fields 2" will stay for non-customized types.

Mandatory checks

  • Change in CHANGELOG.md described in a way that is understandable for the average user (if applicable)
  • Tests created for changes (if applicable)
  • Manually tested changed features in running JabRef (always required)
  • Screenshots added in PR description (for UI changes)
  • Checked developer's documentation: Is the information available and up to date? If not, I outlined it in this pull request.
  • Checked documentation: Is the information available and up to date? If not, I created an issue at https://github.com/JabRef/user-documentation/issues or, even better, I submitted a pull request to the documentation repository.

@@ -57,7 +57,7 @@ void setUp() {
}

private BibEntryType getStandardArticleType(BibDatabaseMode mode) {
return entryTypesManager.getEntryTypes(mode).standardTypes.stream().filter(t -> StandardEntryType.Article.equals(t.getType())).findAny().get();
return entryTypesManager.getEntryTypes(mode).standardTypes.stream().filter(t -> StandardEntryType.Article == t.getType()).findAny().get();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better use findFirst to get it ina reliable way

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is only one standard type? Thus, I thought, findAny could be faster?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does it matter in a test? have we ever had problems with reliability of these tests?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think, somewhere in the main code, I also had it. Chris might be afraid of "Heisenbugs" :)

# Conflicts:
#	src/main/java/org/jabref/model/entry/BibEntryTypesManager.java
@koppor koppor marked this pull request as draft March 14, 2024 19:42
@koppor
Copy link
Member Author

koppor commented Mar 14, 2024

I added a test to illustrate the issue - e497592 (#11022)

@koppor koppor added the status: ready-for-review Pull Requests that are ready to be reviewed by the maintainers label Mar 14, 2024
@koppor koppor marked this pull request as ready for review March 14, 2024 23:43
@Siedlerchr
Copy link
Member

I am now constantly getting library changed messages when entering texst:
otherkey.bib.zip

Copy link
Contributor

github-actions bot commented Mar 19, 2024

The build for this PR is no longer available. Please visit https://builds.jabref.org/main/ for the latest build.

@koppor
Copy link
Member Author

koppor commented Mar 19, 2024

Cannot reproduce on main. Happens in this branch.

Could reproduce once in this branch.

Restarted JabRef startet with the file again. Could not trigger the issue again. -- @Siedlerchr Do you remember what steps you did? :)

@koppor
Copy link
Member Author

koppor commented Mar 19, 2024

I could reproduce it when adding spaces to the citation key and then pressing "Dismiss Changes". Then saving. Then "Dismiss Changes".

@Siedlerchr Siedlerchr added this pull request to the merge queue Mar 19, 2024
Merged via the queue into main with commit 49eb6b2 Mar 19, 2024
21 checks passed
@Siedlerchr Siedlerchr deleted the fix-tab-optional2 branch March 19, 2024 19:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: ready-for-review Pull Requests that are ready to be reviewed by the maintainers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants