Change origin format in put()

This commit is contained in:
Eric van der Vlist 2023-03-06 21:38:50 +01:00
parent df3039a04b
commit e620db5c7b
1 changed files with 2 additions and 1 deletions

View File

@ -1,6 +1,7 @@
import { cloneDeep } from 'lodash'; import { cloneDeep } from 'lodash';
import { state } from '../db-admin/health-legacy'; import { state } from '../db-admin/health-legacy';
import { getParentId } from '../lib/docuri'; import { getParentId } from '../lib/docuri';
import { dbUrlToUserId } from '../lib/user-id';
declare global { declare global {
var localDb: any; var localDb: any;
@ -35,7 +36,7 @@ export const put = async (
_rev: current._rev, _rev: current._rev,
type, type,
to: current.to, to: current.to,
origin: current.origin ?? state().remoteUrl, origin: current.origin ?? dbUrlToUserId(state().remoteUrl),
doc: update(current.doc), doc: update(current.doc),
}; };
await targetDb.put(putDoc); await targetDb.put(putDoc);