Skip to content

Commit

Permalink
revert: Remove cozyFromPouch guard
Browse files Browse the repository at this point in the history
This guard has been added to handle documents with no `meta.rev` but
since we added a check on `_rev` (in addition to `meta.rev`) to trigger
the persistence, then we don't need this guard anymore

This replies to #1486 (comment)

Related commit: b797eb3
Related commit: 62290ed
  • Loading branch information
Ldoppea committed Sep 24, 2024
1 parent 0169bcb commit 43be3e7
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 5 deletions.
2 changes: 1 addition & 1 deletion packages/cozy-client/src/CozyClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -1152,7 +1152,7 @@ client.query(Q('io.cozy.bills'))`)
* @returns {Promise<void>}
*/
async persistVirtualDocument(document, enforce) {
if (!document || document.cozyLocalOnly || document.cozyFromPouch) {
if (!document || document.cozyLocalOnly) {
return
}

Expand Down
1 change: 0 additions & 1 deletion packages/cozy-client/src/types.js
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,6 @@ import { QueryDefinition } from './queries/dsl'
* @property {CozyMetadata} [cozyMetadata] - Cozy Metadata
* @property {CozyClientDocumentMeta} [meta] - Pouch Metadata
* @property {boolean} [cozyLocalOnly] - When true the document should NOT be replicated to the remote database
* @property {boolean} [cozyFromPouch] - When true the document has been retrieved from a local PouchDB
*/

/**
Expand Down
1 change: 0 additions & 1 deletion packages/cozy-pouch-link/src/CozyPouchLink.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,6 @@ describe('CozyPouchLink', () => {
_id: '1',
_rev: '1-deadbeef',
_type: 'io.cozy.todos',
cozyFromPouch: true,
done: false,
id: '1',
label: 'Buy bread',
Expand Down
1 change: 0 additions & 1 deletion packages/cozy-pouch-link/src/jsonapi.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ export const normalizeDoc = (doc, doctype, client) => {
_id: id,
_rev,
_type: doctype,
cozyFromPouch: true,
relationships: {
...relationships,
referenced_by
Expand Down
1 change: 0 additions & 1 deletion packages/cozy-pouch-link/src/jsonapi.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ describe('doc normalization', () => {
id: 1234,
_rev: '4-cffee',
_type: 'io.cozy.contacts',
cozyFromPouch: true,
firstName: 'Bobba',
lastName: 'Fett',
relationships: {
Expand Down

0 comments on commit 43be3e7

Please sign in to comment.