Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3f72a4a9 authored by Stefan Niedermann's avatar Stefan Niedermann
Browse files

Ensure we have the up to date eTag

parent 941e5439
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -32,8 +32,8 @@ import it.niedermann.owncloud.notes.branding.BrandingUtil;
import it.niedermann.owncloud.notes.main.navigation.NavigationAdapter;
import it.niedermann.owncloud.notes.main.navigation.NavigationItem;
import it.niedermann.owncloud.notes.persistence.CapabilitiesClient;
import it.niedermann.owncloud.notes.persistence.NotesServerSyncHelper;
import it.niedermann.owncloud.notes.persistence.NotesDatabase;
import it.niedermann.owncloud.notes.persistence.NotesServerSyncHelper;
import it.niedermann.owncloud.notes.persistence.entity.Account;
import it.niedermann.owncloud.notes.persistence.entity.CategoryWithNotesCount;
import it.niedermann.owncloud.notes.persistence.entity.Note;
+2 −1
Original line number Diff line number Diff line
@@ -166,7 +166,8 @@ abstract class NotesServerSyncTask extends Thread {
            final Map<Long, Long> idMap = db.getIdMap(localAccount.getId());
            final Calendar modified = localAccount.getModified();
            final long modifiedForServer = modified == null ? 0 : modified.getTimeInMillis() / 1_000;
            final ServerResponse.NotesResponse response = notesClient.getNotes(ssoAccount, modifiedForServer, localAccount.getETag());
            // FIXME re-reading the localAccount is only a workaround for a not-up-to-date eTag in localAccount.
            final ServerResponse.NotesResponse response = notesClient.getNotes(ssoAccount, modifiedForServer, db.getAccountDao().getAccountById(localAccount.getId()).getETag());
            List<Note> remoteNotes = response.getNotes();
            Set<Long> remoteIDs = new HashSet<>();
            // pull remote changes: update or create each remote note