[GH-ISSUE #166] Question: How does auto-save currently works? #133

Closed
opened 2026-02-25 21:34:15 +03:00 by kerem · 5 comments
Owner

Originally created by @dumblob on GitHub (Feb 15, 2017).
Original GitHub issue: https://github.com/cypht-org/cypht/issues/166

Originally assigned to: @jasonmunro on GitHub.

There was some planned work on auto save of composed messages, but I could not extract how does it work currently. Does it support only Gmail? Or is it implemented for any account? Does it use Drafts or Templates folders? How frequently is the email saved (I would prefer every 2 seconds)? How does it cope with encryption?

Thank you.

Originally created by @dumblob on GitHub (Feb 15, 2017). Original GitHub issue: https://github.com/cypht-org/cypht/issues/166 Originally assigned to: @jasonmunro on GitHub. There was some planned work on auto save of composed messages, but I could not extract how does it work currently. Does it support only Gmail? Or is it implemented for any account? Does it use Drafts or Templates folders? How frequently is the email saved (I would prefer every 2 seconds)? How does it cope with encryption? Thank you.
kerem 2026-02-25 21:34:15 +03:00
  • closed this issue
  • added the
    smtp
    label
Author
Owner

@jasonmunro commented on GitHub (Feb 26, 2017):

Drafts are saved in the session every 30 seconds (or when you use the "save" button). When the session expires (logout, browser close) drafts are destroyed. Session data is encrypted with a unique key generated at login and stored in a cookie. Once a draft has been saved, you can access it after revisting the compose page with the document icon in the upper right of the page. Drafts are not tied directly to a particular mail provider. I have recently built support in the imap_folders module to set a draft folder, but it is not used by the draft system yet.

<!-- gh-comment-id:282581457 --> @jasonmunro commented on GitHub (Feb 26, 2017): Drafts are saved in the session every 30 seconds (or when you use the "save" button). When the session expires (logout, browser close) drafts are destroyed. Session data is encrypted with a unique key generated at login and stored in a cookie. Once a draft has been saved, you can access it after revisting the compose page with the document icon in the upper right of the page. Drafts are not tied directly to a particular mail provider. I have recently built support in the imap_folders module to set a draft folder, but it is not used by the draft system yet.
Author
Owner

@dumblob commented on GitHub (Feb 27, 2017):

Thank you @jasonmunro for explanation. For my needs, I would like to change the interval of autosaving to a much shorter value (e.g. 2 seconds). Autosave should trigger only if any change to the draft appeared (to save bandwidth). Could this autosave interval be configurable (either system-wide or even user-specific)? Or is it too low level and I should maintain my own fork?

<!-- gh-comment-id:282685154 --> @dumblob commented on GitHub (Feb 27, 2017): Thank you @jasonmunro for explanation. For my needs, I would like to change the interval of autosaving to a much shorter value (e.g. 2 seconds). Autosave should trigger only if any change to the draft appeared (to save bandwidth). Could this autosave interval be configurable (either system-wide or even user-specific)? Or is it too low level and I should maintain my own fork?
Author
Owner

@jasonmunro commented on GitHub (Mar 1, 2017):

I'm not too keen on exposing this as a user option, I'm considering a site level ini file setting. In the meantime however, I don't want unneeded forking :) So, I'm leveraging the module system and the "site" module to make this possible without having to fork:

https://github.com/jasonmunro/cypht/blob/master/modules/site/site.js

All you have to do is enable that module, edit the site.js file above to your liking, and run your config gen script and you should be good to go. The point of the site module set is to override default Cypht behavior without making code changes, so this seems like a good place to put this for now.

I don't think the draft saving code is smart enough to not fire on each interval when nothing has changed in the draft, I'm looking into that now.

<!-- gh-comment-id:283465579 --> @jasonmunro commented on GitHub (Mar 1, 2017): I'm not too keen on exposing this as a user option, I'm considering a site level ini file setting. In the meantime however, I don't want unneeded forking :) So, I'm leveraging the module system and the "site" module to make this possible without having to fork: https://github.com/jasonmunro/cypht/blob/master/modules/site/site.js All you have to do is enable that module, edit the site.js file above to your liking, and run your config gen script and you should be good to go. The point of the site module set is to override default Cypht behavior without making code changes, so this seems like a good place to put this for now. I don't think the draft saving code is smart enough to not fire on each interval when nothing has changed in the draft, I'm looking into that now.
Author
Owner

@jasonmunro commented on GitHub (Mar 1, 2017):

Draft logic updated in github.com/jasonmunro/cypht@012cc310a1 to only re-save if the draft has changed since the last save.

<!-- gh-comment-id:283469137 --> @jasonmunro commented on GitHub (Mar 1, 2017): Draft logic updated in https://github.com/jasonmunro/cypht/commit/012cc310a115140619d61f44127054fa1a107042 to only re-save if the draft has changed since the last save.
Author
Owner

@dumblob commented on GitHub (Mar 1, 2017):

Thanks a lot @jasonmunro! I'm closing this as solved.

<!-- gh-comment-id:283471997 --> @dumblob commented on GitHub (Mar 1, 2017): Thanks a lot @jasonmunro! I'm closing this as solved.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/cypht#133
No description provided.