Skip to content
Snippets Groups Projects
Commit 2e82f5da authored by Hugo Trentesaux's avatar Hugo Trentesaux
Browse files

fix migrate identity to non-existing account

and identity name on creation
parent 5f7d6010
No related branches found
No related tags found
No related merge requests found
......@@ -348,6 +348,7 @@ async function createIdentities(ctx: ProcessorContext<StoreWithCache>, newData:
let newI = new Identity({
id: String(i.index),
index: i.index,
name: i.id, // identities created but not confirmed have no name, we use the id of the creation event
account,
});
data.identities.set(i.index, newI);
......@@ -365,7 +366,7 @@ async function confirmIdentities(ctx: ProcessorContext<StoreWithCache>, newData:
async function changeIdtyOwnerKey(ctx: ProcessorContext<StoreWithCache>, newData: NewData, data: PreparedData) {
for (let icok of newData.idtyChangedOwnerKey) {
let idty = await ctx.store.getOrFail(Identity, String(icok.index));
let account = await ctx.store.getOrFail(Account, icok.account);
let account = data.accounts.get(icok.account) ?? (await ctx.store.getOrFail(Account, icok.account));
idty.account = account;
data.identities.set(idty.index, idty);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment