mirror of
https://github.com/nextcloud/notes-android.git
synced 2024-11-26 23:27:55 +03:00
Use null for not-existing remoteId
This commit is contained in:
parent
8e878de184
commit
4a4d4f81fd
2 changed files with 3 additions and 5 deletions
|
@ -371,7 +371,7 @@ public class NoteServerSyncHelper {
|
|||
switch (note.getStatus()) {
|
||||
case LOCAL_EDITED:
|
||||
Log.v(TAG, " ...create/edit");
|
||||
if (note.getRemoteId() != null && note.getRemoteId() > 0) {
|
||||
if (note.getRemoteId() != null) {
|
||||
Log.v(TAG, " ...Note has remoteId → try to edit");
|
||||
try {
|
||||
remoteNote = notesClient.editNote(ssoAccount, note).getNote();
|
||||
|
|
|
@ -191,9 +191,7 @@ public abstract class NotesDatabase extends RoomDatabase {
|
|||
entity.setAccountId(accountId);
|
||||
entity.setExcerpt(generateNoteExcerpt(note.getContent(), note.getTitle()));
|
||||
}
|
||||
if (note.getRemoteId() != null && note.getRemoteId() > 0) {
|
||||
entity.setRemoteId(note.getRemoteId());
|
||||
}
|
||||
entity.setRemoteId(note.getRemoteId());
|
||||
entity.setTitle(note.getTitle());
|
||||
entity.setModified(note.getModified());
|
||||
entity.setContent(note.getContent());
|
||||
|
@ -267,7 +265,7 @@ public abstract class NotesDatabase extends RoomDatabase {
|
|||
if (newTitle != null) {
|
||||
title = newTitle;
|
||||
} else {
|
||||
if (oldNote.getRemoteId() == null || oldNote.getRemoteId() == 0 || localAccount.getPreferredApiVersion() == null || localAccount.getPreferredApiVersion().compareTo(new ApiVersion("1.0", 0, 0)) < 0) {
|
||||
if (oldNote.getRemoteId() == null || localAccount.getPreferredApiVersion() == null || localAccount.getPreferredApiVersion().compareTo(new ApiVersion("1.0", 0, 0)) < 0) {
|
||||
title = NoteUtil.generateNonEmptyNoteTitle(newContent, context);
|
||||
} else {
|
||||
title = oldNote.getTitle();
|
||||
|
|
Loading…
Reference in a new issue