From 3c5f0ddb168b4242a381a095308c4d63c12ae54d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20Pailharey?= <rpailharey@grandlyon.com>
Date: Fri, 28 Oct 2022 16:44:48 +0200
Subject: [PATCH] publish: tmp

generated from commit 987418e2eb880d4aa46c40f1270c16ac66adfaae
---
 index.js           | 7 ++++---
 onDeleteAccount.js | 7 ++++---
 2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/index.js b/index.js
index d22b4e1..dcdea71 100644
--- a/index.js
+++ b/index.js
@@ -228880,8 +228880,7 @@ async function saveAccountData(accountId, accountData) {
     })}`
   )
 
-  delete account._id
-  delete account.id
+  const id = account._id
   log(
     'info',
     `saveAccountData account after id: ${JSON.stringify({
@@ -228891,7 +228890,9 @@ async function saveAccountData(accountId, accountData) {
   )
   account = await updateOrCreate(
     [{ ...account, data: accountData }],
-    'io.cozy.accounts'
+    'io.cozy.accounts',
+    null,
+    { sourceAccount: id }
   )
   log('info', `saveAccountData account reply: ${JSON.stringify(account)}`)
   return account
diff --git a/onDeleteAccount.js b/onDeleteAccount.js
index 9e44f74..a18487d 100644
--- a/onDeleteAccount.js
+++ b/onDeleteAccount.js
@@ -227625,8 +227625,7 @@ async function saveAccountData(accountId, accountData) {
     })}`
   )
 
-  delete account._id
-  delete account.id
+  const id = account._id
   log(
     'info',
     `saveAccountData account after id: ${JSON.stringify({
@@ -227636,7 +227635,9 @@ async function saveAccountData(accountId, accountData) {
   )
   account = await updateOrCreate(
     [{ ...account, data: accountData }],
-    'io.cozy.accounts'
+    'io.cozy.accounts',
+    null,
+    { sourceAccount: id }
   )
   log('info', `saveAccountData account reply: ${JSON.stringify(account)}`)
   return account
-- 
GitLab