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

Library is marked as unsaved (*) after accepting changes from the file #11027

Closed
2 tasks done
ror3d opened this issue Mar 14, 2024 · 14 comments · Fixed by #11051
Closed
2 tasks done

Library is marked as unsaved (*) after accepting changes from the file #11027

ror3d opened this issue Mar 14, 2024 · 14 comments · Fixed by #11051
Assignees
Labels
FirstTimeCodeContribution Triggers GitHub Greeter Workflow

Comments

@ror3d
Copy link
Contributor

ror3d commented Mar 14, 2024

JabRef version

Latest development branch build (please note build date below)

Operating system

Windows

Details on version and operating system

Windows 11

Checked with the latest development build (copy version output from About dialog)

  • I made a backup of my libraries before testing the latest development version.
  • I have tested the latest development version and the problem persists

Steps to reproduce the behaviour

This is visible when someone edits the file with jabref while you have the same library open. I don't know of a good way to reproduce other than that, maybe by editing the file in a text editor, or having two instances of jabref open (I don't know if easily done).

  1. Open any library file with at least one entry
  2. Edit the bib file in a text editor, remove one entry (leave a single line between entries to match jabref output format) and save
  3. Notice that in the main instance, a notification about changes being made by another program appears.
  4. Select Review changes
  5. Accept the change
  6. Notice that the library appears as modified, even though it should match exactly the contents of the file saved to disk

Appendix

No response

@koppor
Copy link
Member

koppor commented Mar 14, 2024

Notice that the library appears as modified, even though it should match exactly the contents of the file saved to disk

Is it because of an asterisk or another library changed dialog? If the latter, which content?

@ror3d
Copy link
Contributor Author

ror3d commented Mar 14, 2024

It is because the asterisk appears on the library tab, and trying to close the tab or the program prompts you to save it.

@koppor koppor changed the title Library is detected as modified after accepting changes from the file Library is marked as unsaved (*) after accepting changes from the file Mar 14, 2024
@amrithdas
Copy link
Contributor

amrithdas commented Mar 19, 2024

@koppor can I work on this? I went through the code and I'm thinking of making it save the library when Accept button is clicked in review changes page.

@koppor
Copy link
Member

koppor commented Mar 19, 2024

Please remember to test manually and also think about UI tests.

@koppor koppor added the FirstTimeCodeContribution Triggers GitHub Greeter Workflow label Mar 19, 2024
Copy link
Contributor

As a general advice for newcomers: check out Contributing for a start. Also, guidelines for setting up a local workspace is worth having a look at.

Feel free to ask here at GitHub, if you have any issue related questions. If you have questions about how to setup your workspace use JabRef's Gitter chat. Try to open a (draft) pull-request early on, so that people can see you are working on the issue and so that they can see the direction the pull request is heading towards. This way, you will likely receive valuable feedback.

@ror3d
Copy link
Contributor Author

ror3d commented Mar 19, 2024

A note about making it save automatically:

  • If other changes have happened before accepting, saving automatically will commit them to file, which might not be what one wants
  • It will also update the "edited time" of the file, which I feel could potentially cause problems (for example, there was a bug, now fixed, on the user comments, that saving triggered a weird "File has been modified outside" popup for your own changes, and accepting them and autosaving would keep opening the same popup)

(Note that these points I'm raising might not be a problem after all, just trying to point out things I have found previously that could be problematic so maintainers can evaluate)

@koppor
Copy link
Member

koppor commented Mar 19, 2024

@ror3d Your initial question was about to remove the asterisk if all external changes were applied. Not to remove it, if there is a mix of accepted and rejected changes? Then, the asterisk should stay (if the user has autosave disabled)

@ror3d
Copy link
Contributor Author

ror3d commented Mar 19, 2024

Yes, precisely. I have autosave turned off (because we share the file in a shared drive among a couple of people) so as you say, if the issue was just saving after, that wouldn't be a problem.

@amrithdas
Copy link
Contributor

@koppor @ror3d I have modified the code to not show the asterisk and save changes pop up when external changes are accepted and to show both when denied. please review.

@koppor
Copy link
Member

koppor commented Mar 19, 2024

@amrithdas Thank you for the follow up. I commented at the PR.

Current JabRef behavior:

  1. Modify file externally

image

  1. Press "Review changes"

image

  1. Press "Deny"

Dialog closes and NO asterisk:

image

I think, the logic is just inversed in JabRef. One "just" needs to find the place.

@amrithdas
Copy link
Contributor

@koppor upon further inspection I found that when accepting external changes JabRef is creating a new entry to the database even though its inserting the same data in the disk hence the changedProperty gets set to True. thats why its appearing as unsaved. similarly when denying its just removes the selected change. the logic is inversed as you mentioned but I'm not sure whether this will be a small change. would it be better to try finding a new approach or continue to refine the logic which I already did?

@koppor
Copy link
Member

koppor commented Mar 20, 2024

@amrithdas I think, it is a completely new approach! Maybe, test cases can also be crafted.

@amrithdas
Copy link
Contributor

@koppor I have updated the PR, please review.

@koppor
Copy link
Member

koppor commented Mar 20, 2024

@koppor I have updated the PR, please review.

@amrithdas Updates on the PR have more todo with the PR than with the issue. Hard to navigate from the issue to the PR on mobile... If you insist on pinging, please do that on tbe PR...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
FirstTimeCodeContribution Triggers GitHub Greeter Workflow
Projects
None yet
3 participants