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

Move generate key option to citation key preference tab #12436

Merged
merged 4 commits into from
Feb 6, 2025

Conversation

priyanshu16095
Copy link
Contributor

@priyanshu16095 priyanshu16095 commented Jan 31, 2025

Fixes #10849

This PR moves the "Generate new keys on import" option from the WebSearch tab to the CitationKey Preferences tab.

Mandatory checks

  • I own the copyright of the code submitted and I licence it under the MIT license
  • Change in CHANGELOG.md described in a way that is understandable for the average user (if change is visible to the user)
  • 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.

Screenshot (28)

@priyanshu16095
Copy link
Contributor Author

Recording.2025-01-31.mp4

It's working fine.
Please review.

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

JUnit tests are failing. In the area "Some checks were not successful", locate "Tests / Unit tests (pull_request)" and click on "Details". This brings you to the test output.

You can then run these tests in IntelliJ to reproduce the failing tests locally. We offer a quick test running howto in the section Final build system checks in our setup guide.

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

JUnit tests are failing. In the area "Some checks were not successful", locate "Tests / Unit tests (pull_request)" and click on "Details". This brings you to the test output.

You can then run these tests in IntelliJ to reproduce the failing tests locally. We offer a quick test running howto in the section Final build system checks in our setup guide.

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

JUnit tests are failing. In the area "Some checks were not successful", locate "Tests / Unit tests (pull_request)" and click on "Details". This brings you to the test output.

You can then run these tests in IntelliJ to reproduce the failing tests locally. We offer a quick test running howto in the section Final build system checks in our setup guide.

@subhramit subhramit requested a review from calixtus January 31, 2025 13:07
@Siedlerchr
Copy link
Member

Good thing, this also refers to this user's post https://discourse.jabref.org/t/jabref-v5-15-is-not-using-the-merged-entry-random-changes-to-bibfile/5403/3?u=siedlerchr

@subhramit
Copy link
Member

subhramit commented Jan 31, 2025

@priyanshu16095 you can keep my requested changes on hold. @calixtus may have some opinions on whether we want to shift or keep the preference in the ImporterPreferences.

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

JUnit tests are failing. In the area "Some checks were not successful", locate "Tests / Unit tests (pull_request)" and click on "Details". This brings you to the test output.

You can then run these tests in IntelliJ to reproduce the failing tests locally. We offer a quick test running howto in the section Final build system checks in our setup guide.

@calixtus
Copy link
Member

calixtus commented Feb 1, 2025

Yes, my concern was that putting that pref option into keyGeneratorPreferences, this would breach the level of abstraction or hierarchy, because the pref option about if to use the keygenerator on import is different of how it is configured. Yet in the UI there is no place where this option would go otherwise. So my suggestion would be to leave the pref option codewise in the importerPreferences and put the ui option into the key generator tab.

@priyanshu16095
Copy link
Contributor Author

Done! I have moved the option in the UI while keeping the preference in Importer Preferences.

Copy link
Member

@subhramit subhramit left a comment

Choose a reason for hiding this comment

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

Quick comments. Also, @priyanshu16095, please no force-pushes!

@priyanshu16095
Copy link
Contributor Author

Got it! I’ll avoid force-pushing.

this.keyPatternPreferences = keyPatternPreferences;

// Defines key generation preference during import.
Copy link
Member

@subhramit subhramit Feb 2, 2025

Choose a reason for hiding this comment

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

A javadoc comment at field level is preferable - javadoc is often used in relaying ambiguities/abnormalities/edge cases to the developer. Remove this, and put the lines:

  • The preference for whether to use the keygenerator on import is different from how it is configured.
  • For the UI, there is no better place to put the option than the Citation key generator tab, but shifting the preference to CitationKeypreferences would break the abstraction or hierarchy.
  • Hence, we keep the preference in ImporterPrefernces, but in the UI, we initialize it here.

above line 40 (where the field is declared).
Take a look at how @link is used to link classes in javadoc.

Copy link
Contributor Author

@priyanshu16095 priyanshu16095 Feb 2, 2025

Choose a reason for hiding this comment

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

Thank you, I was not aware of this.

Copy link
Member

@subhramit subhramit left a comment

Choose a reason for hiding this comment

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

I pushed a minor commit (b3d42f1) correcting the class name in the javadoc - IntelliJ will give you a hint whether the class is linked correctly or not by highlighting it in red.
I also shifted the keyPatternPreferences declaration above in order, as those are the primary preference options exposed via this view. The edge case comes after that.

Rest lgtm from my side code-wise. Await a second review.

@priyanshu16095
Copy link
Contributor Author

Thank you, @subhramit , for your help at every step.

@subhramit
Copy link
Member

@Siedlerchr @calixtus one of you can take a second look, i think we are near completion here

@Siedlerchr Siedlerchr added this pull request to the merge queue Feb 6, 2025
@calixtus
Copy link
Member

calixtus commented Feb 6, 2025

Thanks for your work!

Merged via the queue into JabRef:main with commit 4c9c821 Feb 6, 2025
22 of 23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants