diff --git a/src/room/room.js b/src/room/room.js index 2e355b1f..d94c029b 100644 --- a/src/room/room.js +++ b/src/room/room.js @@ -1,9 +1,9 @@ class Room { - constructor(roomId, storage, storedSummary) { + constructor(roomId, storage) { this._roomId = roomId; this._storage = storage; - this._summary = new RoomSummary(this._roomId, this._storage, storedSummary); + this._summary = new RoomSummary(this._roomId, this._storage); } async applyInitialSync(roomResponse, membership) { @@ -14,7 +14,7 @@ class Room { } - async loadFromStorage() { + async load() { } } \ No newline at end of file diff --git a/src/room/summary.js b/src/room/summary.js index a38b6bc1..bcf9e5e4 100644 --- a/src/room/summary.js +++ b/src/room/summary.js @@ -4,9 +4,10 @@ function disambiguateMember(name, userId) { return `${name} (${userId})`; } +// could even split name calculation in a separate class +// as the summary will grow more export class RoomSummary { - constructor(roomId, storage) { - this._storage = storage; + constructor(roomId) { this._members = new SummaryMembers(); this._roomId = roomId; this._inviteCount = 0; @@ -40,7 +41,7 @@ export class RoomSummary { return changed; } - async loadFromStorage() { + async load() { const summary = await storage.getSummary(this._roomId); this._roomId = summary.roomId; this._inviteCount = summary.inviteCount;