Skip to content
This repository has been archived by the owner on Mar 28, 2023. It is now read-only.

Purge button #592

Merged
merged 8 commits into from
Aug 1, 2017
Merged

Purge button #592

merged 8 commits into from
Aug 1, 2017

Conversation

jjeffryes
Copy link
Contributor

This adds a purge button to settings/advanced that will remove all shared files from your server. This addresses concerns of users in areas that prohibit distribution of some content, if those users inadvertently view prohibited content they can clear their cache so it's not shared with other users over IPFS.

});
}


Copy link
Contributor

Choose a reason for hiding this comment

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

Don't forget the super.render().

At some point, I think I'll try and write a test that would check all views and ensure that if they are using getCachedEl, that they are calling super.render(). It's really easy to forget.

Copy link
Contributor

Choose a reason for hiding this comment

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

It might not be a bad idea to pass isPurging: this.purge && this.purge.state() === 'pending' into the template and then use that in the template to decide whether the processing class should be applied to the button.

Otherwise, if you re-render during a purge (e.g. user clicks Save), then the spinner state is lost and the user might just kick off another purge.

"purgeBtn": "Purge Files",
"purgeToolTip": "OpenBazaar shares content you have viewed with other users. If you have viewed text or images you don't want to share this button will delete them. This will not affect any files that belong to you.",
"purgeError": "There was an error, your cached files may not have been deleted.",
"purgeComplete": "Your cached files have been deleted."
Copy link
Contributor

Choose a reason for hiding this comment

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

You may want to check with @cpacia to know if 'ob/purgecache' returns after the purge is complete or if it just kicks off a purge, returns immediately, and the purge finished at some time. That's how the publish api works. If the purge API works the same way, I think we'd want to tweak the messaging since Your cached files have been deleted. wouldn't be completely accurate.

- added a purging state so the purging button maintains state on a re-render.
- added a complete state so the complete message is maintained on a re-render.
- added a saving state so the saving button is maintained on a re-render.
- adjusted the text.
@jjeffryes
Copy link
Contributor Author

@rmisio this is updated. I also updated the save button with a saving state, so it will maintain it's state the same way the purging button will, and updated the save button to use getCachedEl.

Chris confirmed the purge api returns after it has completed. It usually only takes 40-50ms, but in theory could be longer.

return this._$btnSave ||
(this._$btnSave = this.$('.js-save'));
}

render() {
loadTemplate('modals/settings/advanced.html', (t) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Don't forget the super.render() if using getCachedEl.

@rmisio rmisio merged commit b0827af into master Aug 1, 2017
@rmisio rmisio deleted the purgeButton branch August 1, 2017 16:03
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants