use same code to add room to identity in migration as in device tracker

This commit is contained in:
Bruno Windels 2021-08-30 15:05:57 +02:00
parent a437332482
commit 0d6ae19d99

View File

@ -123,17 +123,9 @@ export class DeviceTracker {
async _writeMember(member, txn) {
const {userIdentities} = txn;
const identity = await userIdentities.get(member.userId);
if (!identity) {
userIdentities.set({
userId: member.userId,
roomIds: [member.roomId],
deviceTrackingStatus: TRACKING_STATUS_OUTDATED,
});
} else {
if (!identity.roomIds.includes(member.roomId)) {
identity.roomIds.push(member.roomId);
userIdentities.set(identity);
}
const updatedIdentity = addRoomToIdentity(identity, member.userId, member.roomId);
if (updatedIdentity) {
userIdentities.set(updatedIdentity);
}
}