forked from mystiq/hydrogen-web
Indicate if no member found
Signed-off-by: RMidhunSuresh <rmidhunsuresh@gmail.com>
This commit is contained in:
parent
05f05bb577
commit
3aeb0c4d98
2 changed files with 4 additions and 1 deletions
|
@ -226,6 +226,9 @@ export class BaseRoom extends EventEmitter {
|
|||
}
|
||||
// Miss, load from storage and set in map
|
||||
const member = await loadMember({roomId: this._roomId, userId, storage: this._storage});
|
||||
if (!member) {
|
||||
return false;
|
||||
}
|
||||
const observableMember = new RetainedObservableValue(member, () => this._observedMembers.delete(userId));
|
||||
this._observedMembers.set(userId, observableMember);
|
||||
return observableMember;
|
||||
|
|
|
@ -94,5 +94,5 @@ export async function fetchOrLoadMembers(options, logger) {
|
|||
export async function loadMember({roomId, userId, storage}) {
|
||||
const txn = await storage.readTxn([storage.storeNames.roomMembers,]);
|
||||
const member = await txn.roomMembers.get(roomId, userId);
|
||||
return new RoomMember(member);
|
||||
return member? new RoomMember(member) : undefined;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue