-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Fixed Grobid Preference Dialog Logic, Removed Checkbox #12034
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("Remote services"), | ||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
* | ||
* @param dialogService the DialogService to use | ||
* @return if the user enabled Grobid, either in the past or after being asked by the dialog. | ||
*/ | ||
public static boolean showAndWaitIfUserIsUndecided(DialogService dialogService, GrobidPreferences preferences) { | ||
if (preferences.isGrobidEnabled()) { | ||
return true; | ||
if (preferences.isGrobidPreference()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 <[email protected]>
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
src/main/java/org/jabref/gui/importer/GrobidUseDialogHelper.java
Outdated
Show resolved
Hide resolved
Co-authored-by: Loay Ghreeb <[email protected]>
@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.md
described in a way that is understandable for the average user (if applicable)