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) {
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue