android-classic icon indicating copy to clipboard operation
android-classic copied to clipboard

Dont save empty notes

Open thepill opened this issue 8 years ago • 8 comments

The notes get saved even if there is no content and title given. I think they shouldnt be saved. Should play together with issue #58

Steps to reproduce:

  1. Open a new note
  2. Enter a title
  3. Remove the whole title
  4. A bland note will be saved

Expected: A empty note should not be saved.

thepill avatar Mar 19 '17 18:03 thepill

I'm not sure I understnad, if you enter no text then a new note shouldn't be created. Are you saying it is? Could you put steps to reproduce please?

deftelf avatar Mar 19 '17 22:03 deftelf

@deftelf I updated the issue description

thepill avatar Mar 20 '17 07:03 thepill

Hm... This is actually tricky. By then the note has been saved, as it saves every few millis after each edit. So we would have to delete it from the server if a note has all its content removed, which is a bit unusual.

deftelf avatar Mar 20 '17 18:03 deftelf

i didnt look at the code in detail, but could you not just save if title.length > 0?

thepill avatar Mar 20 '17 18:03 thepill

You can still have a proper note even without a title though. Perhaps check contents as well. If they're both empty, don't save. On Mon, Mar 20, 2017 at 11:28 AM Benjamin Pill [email protected] wrote:

i didnt look at the code i detail, but could you not just save if title.length != null?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/standardnotes/android/issues/79#issuecomment-287854153, or mute the thread https://github.com/notifications/unsubscribe-auth/ADzi1ViMhhXTseh9qTTUa2csQGRHedbTks5rnsUwgaJpZM4Mh080 .

noelbautista91 avatar Mar 20 '17 18:03 noelbautista91

We save automatically when you enter text, so if you enter then delete the text, while there was text it's already saved and synced to server

deftelf avatar Mar 20 '17 19:03 deftelf

imho seems not the best solution. There will be additonal problems if you have bad or no connection to the backend. Also it seems to be to much to sync every keystroke

thepill avatar Mar 20 '17 19:03 thepill

Don't assume there's a problem unless you can demonstrate the problem. A failed sync has no effect, it just remains unsynced on disk. Too much syncing is what #58 is for.

deftelf avatar Mar 20 '17 19:03 deftelf