Nextcloud-notes: Note overwrites manually-set title when editing/exiting the note

Created on 6 Aug 2020  ·  6Comments  ·  Source: stefan-niedermann/nextcloud-notes


Please use GitHub reactions 👍 to show that you are affected by the same issue. Please don't comment if you have no relevant information to add!

Describe the bug

When editing either a new note or an existing note (created from the Android Notes app), the editor updates the title to whatever the first line of the file is, even after the title has been manually set (to something else).

To Reproduce
Steps to reproduce the behavior:

  1. Start a new note.
  2. Manually set the title to "Foo Bar"
  3. Put the following in the actual text area: "This is a note"
  4. Title becomes "This is a note", instead of "Foo Bar"
  5. Manually edit the title back to "Foo Bar"
  6. Exit the note
  7. Title changes back to "This is a note" on save.
  8. Fix the title in reading mode, back to "Foo Bar"
  9. Go into the document in edit mode (pretend you needed to change it to "This is a great note").
  10. Title resets itself to "This is a great note".
  11. Fixing the title requires exiting, going back into reading mode, and editing the title from there, otherwise the change will undo itself on exit (again).

This does not happen if I first create a note in the NextCloud web interface and sync it to the Android app, or if I create the note in Android then sync it and fix the name in the web interface and sync it back to the phone -- I can edit the note after fixing it on the server, and it stops resetting the title in the Android app.

Expected behavior

The Notes app should have the same behavior as the web interface -- the title can be set manually, independent of what the first line of the file is. A user should not have to first create a note outside of the Android app in order to get the desired title.

Smartphone (please complete the following information):

  • Nextcloud Notes-Version (android app):
  • F-Droid or Play Store: F-Droid
  • Android-Version: 6.0
  • Device: HTC M8

Server
I don't control the server this runs on, so I don't have access to the server information. Clicking on "About" in the web interface shows an empty popup, which leads me to believe that the information may have been removed by my server admins (if this is where I would find this information).

However, I'll answer this for the apps installed on my phone:

  • Nextcloud version (android app): 3.12.1
  • Nextcloud Notes version (android app): v2.16.7

Stacktrace
None.

Bug Good first issue

Most helpful comment

I was able to reproduce the problem again, while traveling on a train with limited connectivity during the trip (so wifi/data is not disabled via airplane mode, but there is no network connection).

Exiting out of the note and trying to re-edit, results in the title being reset every time the note is edited; but this behavior stops once the note is able to sync with the server.

All 6 comments

Hmm, seems to only happen to notes which are currently in the create process. But to make sure: Can you reproduce the issue when you create a note and leave it - then reopen it and start editing?

So as I mentioned in the "To Reproduce" section, exiting the note and trying to edit it again resulted in the same problem.

However, when I originally encountered the issue, I was also traveling and had limited connectivity, so my notes weren't syncing with the server. Now that I'm not traveling and on consistent wifi, I'm having trouble consistently reproducing the problem (although it still happens, just not every time).

Is it possible that connectivity/sync may be partially related to the bug?

I was able to reproduce the problem again, while traveling on a train with limited connectivity during the trip (so wifi/data is not disabled via airplane mode, but there is no network connection).

Exiting out of the note and trying to re-edit, results in the title being reset every time the note is edited; but this behavior stops once the note is able to sync with the server.

The issue can easily be reproduced:

  • switch off your network connection
  • create note
  • edit title
  • change content => title is changed ↯
  • close note
  • open note again
  • change content => title is changed ↯

@stefan-niedermann The problem is, that currently, auto-title depends on if a note was synced: oldNote.getRemoteId() == 0, see: https://github.com/stefan-niedermann/nextcloud-notes/blob/755ef6f83b01aea97cfbd40399ccdbbcadf5f8b9/app/src/main/java/it/niedermann/owncloud/notes/persistence/NotesDatabase.java#L549-L551

I think you will have to add a new database column autotitle (or similar) in the notes table that tracks if the title should be auto-generated. It will be true for new notes and must be set to false when the user changes the title manually and when a note is successfully synced.

This suggestion is definitely on track.

I was experiencing this bug because my notes stopped syncing with the server after I uninstalled NextCloud from _F-Droid_, and installed the _Google Play_ version. I guess the change in the installed NextCloud app was not detected by the notes app, and it was still thinking that everything was still the same.

During this time, I was able to 100% reproduce this bug by setting a title, and changing just the first line of my note. This resulted in the title changing to match that first line, and my notes did not sync with the server.

The problem resolved itself after I re-added the same account again in the notes app, and everything synced up nicely. Now the title is no longer changing itself when I make a change to the note itself.

We have a proper workaround / fix for this from @johahauf - thanks.

It will be distributed in v3.0.1.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

maenujem picture maenujem  ·  7Comments

pejakm picture pejakm  ·  9Comments

chorus12 picture chorus12  ·  8Comments

KopfKrieg picture KopfKrieg  ·  4Comments

edrohler picture edrohler  ·  4Comments