mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-12-23 03:25:12 +01:00
stored summary is no longer passed in ctor but loaded in load method
This commit is contained in:
parent
f58af883b8
commit
5703a034ca
@ -1,9 +1,9 @@
|
|||||||
class Room {
|
class Room {
|
||||||
|
|
||||||
constructor(roomId, storage, storedSummary) {
|
constructor(roomId, storage) {
|
||||||
this._roomId = roomId;
|
this._roomId = roomId;
|
||||||
this._storage = storage;
|
this._storage = storage;
|
||||||
this._summary = new RoomSummary(this._roomId, this._storage, storedSummary);
|
this._summary = new RoomSummary(this._roomId, this._storage);
|
||||||
}
|
}
|
||||||
|
|
||||||
async applyInitialSync(roomResponse, membership) {
|
async applyInitialSync(roomResponse, membership) {
|
||||||
@ -14,7 +14,7 @@ class Room {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async loadFromStorage() {
|
async load() {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -4,9 +4,10 @@ function disambiguateMember(name, userId) {
|
|||||||
return `${name} (${userId})`;
|
return `${name} (${userId})`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// could even split name calculation in a separate class
|
||||||
|
// as the summary will grow more
|
||||||
export class RoomSummary {
|
export class RoomSummary {
|
||||||
constructor(roomId, storage) {
|
constructor(roomId) {
|
||||||
this._storage = storage;
|
|
||||||
this._members = new SummaryMembers();
|
this._members = new SummaryMembers();
|
||||||
this._roomId = roomId;
|
this._roomId = roomId;
|
||||||
this._inviteCount = 0;
|
this._inviteCount = 0;
|
||||||
@ -40,7 +41,7 @@ export class RoomSummary {
|
|||||||
return changed;
|
return changed;
|
||||||
}
|
}
|
||||||
|
|
||||||
async loadFromStorage() {
|
async load() {
|
||||||
const summary = await storage.getSummary(this._roomId);
|
const summary = await storage.getSummary(this._roomId);
|
||||||
this._roomId = summary.roomId;
|
this._roomId = summary.roomId;
|
||||||
this._inviteCount = summary.inviteCount;
|
this._inviteCount = summary.inviteCount;
|
||||||
|
Loading…
Reference in New Issue
Block a user