Fixed Grobid Preference Dialog Logic, Removed Checkbox#12034
Conversation
…D usage preference. "Do not ask" checkbox replaced with "Save Preference", and GROBID_OPTOUT replaced with GROBID_PREFERENCE to reduce ambiguity.
…only be asked about Grobid permissions once, with the preference being stored for the future. Updated CHANGELOG.md
| Localization.lang("Allow sending PDF files and raw citation strings to a JabRef online service (Grobid) to determine Metadata. This produces better results."), | ||
| Localization.lang("Do not ask again"), | ||
| optOut -> preferences.setGrobidOptOut(optOut)); | ||
| Localization.lang("Yes"), |
There was a problem hiding this comment.
Yes no only dialogs should be avoided, as the buttons are not self explanatory, better wording:
- Send to Grobid
- Do not send
There was a problem hiding this comment.
We have this requirement at https://devdocs.jabref.org/code-howtos/ui-recommendations.html#name-your-buttons-for-the-actions, but need more text for explanation.
„yes“ is not an action.
|
Note this removes the possibility to ask everytime. #9291 (comment) – This is OK for me now! |
I like diagrams. Thank you! I do not get what „enabled“ means. The diagram does not show what happens after restart of JabRef. The dialog should only appear lf user did Not decide yet. |
…ix-for-koppor-issue-566
| public static boolean showAndWaitIfUserIsUndecided(DialogService dialogService, GrobidPreferences preferences) { | ||
| if (preferences.isGrobidEnabled()) { | ||
| return true; | ||
| if (preferences.isGrobidPreference()) { |
There was a problem hiding this comment.
We should use another word. This is NOT a JabRef setting (AKA preference), but a kind of "to prefer something". Moreover, this is asked at the first time only. Thus, I would rename it to isGrobidUseAsked. This is to strengthen that this is a one-time thing (in contrast to being asked at every run).
There was a problem hiding this comment.
Thank you for the observation, this would certainly make the logic more clear. I have made the changes as required.
I have updated the dialog as per this suggestion, improving clarity.
Enabled is referring to the grobidEnabled variable. To confirm, the dialog only appears if the user has not decided. This is due to the groidPreference variable being updated and stored after the user has made their decision for the first time. |
…ity. Renamed GrobidPreferenceDialogHelper.java to GrobidUseDialogHelper.java.
|
@arshchawla21 I review using https://github.com/JabRef/jabref/pull/12034/files. Maybe, you should open this, too. - You will see that Christoph made a suggestion to the CHANGELOG.md |
|
I resolved the merge conflicts in CHANGELOG.md to have the CI working. |
Co-authored-by: Christoph <siedlerkiller@gmail.com>
|
I added it to the merge queue. Should be in |
|
Thank you so much for your guidance @koppor, is there anything else I need to do? The unit test check appears to be failing. |
Fortunately, we have the merge queue doing the final checks properly. Please check and fix: |
…d" and "Do not send".
Head branch was pushed to by a user without write access
|
Hi @koppor, I've made the required changes to "JabRef_en.properties", and the checks appear to be passing. I believe this PR is ready to merge whenever you are ready! |
| return false; | ||
| } | ||
| boolean grobidEnabled = dialogService.showConfirmationDialogWithOptOutAndWait( | ||
| boolean grobidEnabled = dialogService.showConfirmationDialogAndWait( |
There was a problem hiding this comment.
The dialog should not be displayed if preferences are enabled without it. Here's an example:
- Reset preferences.
- Restart.
- Open preferences, then go to Web Search and allow Grobid.
- Import a file.
- The dialog will prompt to enable Grobid, even though it is already enabled.
There was a problem hiding this comment.
Hey @LoayGhreeb, thanks for the suggestion. I have made changes such that if a user has manually enabled Grobid, they will not be prompted in any case (even if they manually disable Grobid in the future) as required.
…le Grobid on first use, if Grobid has already been manually enabled.
Co-authored-by: Loay Ghreeb <loayahmed655@gmail.com>
|
@arshchawla21 If I may ask, what app did you use to make those diagrams? |
Of course, I used draw.io (available at https://app.diagrams.net/) to make the diagrams! |


This issue revolves around the Grobid preference dialog logic. More specifically, it was found the "Do not ask again" button would not function as expected in certain cases, when asking the user for permission to use Grobid when uploading a PDF. Below demonstrates a logic diagram for the previous (broken) functionality. For context, the previous implentation (in GrobidPreferences.java), contained two boolean key variables, grobidEnabled and grobidOptOut.
From the diagram it is clear that in certain cases (highlighted red), the logic does not work as expected. A potential fix revolves around removing the checkbox altogether, only displaying the dialog once, and saving the users' preference for the future. This approach has been suggested by the following comments: #9801 (comment) and #9802 (comment). The new logic would operate as per the following diagram:
My implementation follows the above logic, with grobidOptOut being redefined to grobidPreference. Below is the dialog a user will receive if they have not used Grobid before:
While this will work as expected for new users, one potential flaw is that some users (who have used Grobid in the past) will be also receive this dialog. Specifically users who had Grobid enabled and users who had Grobid disabled, but did not specifically opt-out (did not press "Do not ask again").
I believe the implementation is robust, but I'm always open to suggestions and would greatly appreciate any feedback on potential improvements!
Fixes JabRef#566.
Mandatory checks
CHANGELOG.mddescribed in a way that is understandable for the average user (if applicable)