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

update gui instead of sync when file missing #724

Merged
merged 3 commits into from
Jan 30, 2020
Merged

Conversation

sssoleileraaa
Copy link
Contributor

@sssoleileraaa sssoleileraaa commented Jan 22, 2020

Description

Closes #670

Test Plan

  1. Download a file
  2. Delete it from the filesystem
  3. Try to open it and see that the gui is updated to show that the file needs to be downloaded

Repeat steps 1-3 for export and print

Known issue

Currently refreshing the file object in the session clears the error status message so I removed the error message for now, see: #723

logger.debug('Cannot find {} in the data directory. File does not exist.'.format(
file.original_filename))
storage.update_missing_files(self.data_dir, self.session)
self.session.refresh(file)
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think this updates the UI until the conversation view is redrawn for other reasons, i.e. if we click off this source and back onto the source corresponding to the missing file or if a sync happens to finish (btw to quickly see what parts of the UI are updating naturally even without network I've been commenting out this adding of the metadata sync job).

I think we want to make sure that the state of the UI is representing the state of the locally stored data even without frequent network syncs, since it's expected that even in the best conditions there will be multi-second delay, let me know what you think

Copy link
Contributor Author

Choose a reason for hiding this comment

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

so i removed the refresh line since it is unnecessary.

also, just an explanation of what i'm trying to do in this pr: instead of relying on sync_api, we now call update_missing_files directly when we learn that the file does not exist. this made it so we could remove 3 unnecessary sync_api calls and you can see that it still works:

missing-file

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oops that gif was with the self.session.refresh(file) line of code, which i removed. here's a gif without self.session.refresh(file):

without-refresh

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ah, there was a call to sync_api from the GUI... that explains why this was working. since we don't want calls to sync_api, i updated the GUI to receive a file_missing signal from the Controller instead

@sssoleileraaa
Copy link
Contributor Author

looks like this needs a rebase now that we have the ci fix from earlier this week

@sssoleileraaa
Copy link
Contributor Author

@rmol thanks for the offline feedback, this is ready for review

redshiftzero
redshiftzero previously approved these changes Jan 30, 2020
Copy link
Contributor

@redshiftzero redshiftzero left a comment

Choose a reason for hiding this comment

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

looks great! my comments are addressed

@rmol gonna let you check this one out too

securedrop_client/gui/widgets.py Outdated Show resolved Hide resolved
Copy link
Contributor

@rmol rmol left a comment

Choose a reason for hiding this comment

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

👍

@rmol rmol merged commit da3b732 into master Jan 30, 2020
@rmol rmol deleted the no-sync-on-missing-files branch January 30, 2020 23:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

No longer trigger sync when files are missing
3 participants