forked from mystiq/hydrogen-web
use same code to add room to identity in migration as in device tracker
This commit is contained in:
parent
a437332482
commit
0d6ae19d99
1 changed files with 3 additions and 11 deletions
|
@ -123,17 +123,9 @@ export class DeviceTracker {
|
||||||
async _writeMember(member, txn) {
|
async _writeMember(member, txn) {
|
||||||
const {userIdentities} = txn;
|
const {userIdentities} = txn;
|
||||||
const identity = await userIdentities.get(member.userId);
|
const identity = await userIdentities.get(member.userId);
|
||||||
if (!identity) {
|
const updatedIdentity = addRoomToIdentity(identity, member.userId, member.roomId);
|
||||||
userIdentities.set({
|
if (updatedIdentity) {
|
||||||
userId: member.userId,
|
userIdentities.set(updatedIdentity);
|
||||||
roomIds: [member.roomId],
|
|
||||||
deviceTrackingStatus: TRACKING_STATUS_OUTDATED,
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
if (!identity.roomIds.includes(member.roomId)) {
|
|
||||||
identity.roomIds.push(member.roomId);
|
|
||||||
userIdentities.set(identity);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue