1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-08-09 10:22:46 +03:00

Check for a deserialize() function

This commit is contained in:
Kegan Dougal
2017-02-01 09:48:56 +00:00
parent dfd8c56838
commit 0317830b12

View File

@@ -122,9 +122,13 @@ IndexedDBStoreBackend.prototype = {
const txn = this.db.transaction(["users"], "readonly");
const store = txn.objectStore("users");
return selectQuery(store, undefined, (cursor) => {
if (typeof User.deserialize === "function") {
return User.deserialize(cursor.value);
} else {
const user = new User(cursor.value.userId);
Object.assign(user, cursor.value);
return user;
}
});
});
},