forked from mystiq/hydrogen-web
add archivedRoomSummary store
This commit is contained in:
parent
c2716a061b
commit
d4d7adc7fc
5 changed files with 19 additions and 1 deletions
|
@ -316,6 +316,7 @@ export class Sync {
|
|||
return this._storage.readWriteTxn([
|
||||
storeNames.session,
|
||||
storeNames.roomSummary,
|
||||
storeNames.archivedRoomSummary,
|
||||
storeNames.invites,
|
||||
storeNames.roomState,
|
||||
storeNames.roomMembers,
|
||||
|
|
|
@ -18,6 +18,7 @@ export const STORE_NAMES = Object.freeze([
|
|||
"session",
|
||||
"roomState",
|
||||
"roomSummary",
|
||||
"archivedRoomSummary",
|
||||
"invites",
|
||||
"roomMembers",
|
||||
"timelineEvents",
|
||||
|
|
|
@ -64,6 +64,10 @@ export class Transaction {
|
|||
get roomSummary() {
|
||||
return this._store("roomSummary", idbStore => new RoomSummaryStore(idbStore));
|
||||
}
|
||||
|
||||
get archivedRoomSummary() {
|
||||
return this._store("archivedRoomSummary", idbStore => new RoomSummaryStore(idbStore));
|
||||
}
|
||||
|
||||
get invites() {
|
||||
return this._store("invites", idbStore => new InviteStore(idbStore));
|
||||
|
|
|
@ -12,7 +12,8 @@ export const schema = [
|
|||
createE2EEStores,
|
||||
migrateEncryptionFlag,
|
||||
createAccountDataStore,
|
||||
createInviteStore
|
||||
createInviteStore,
|
||||
createArchivedRoomSummaryStore,
|
||||
];
|
||||
// TODO: how to deal with git merge conflicts of this array?
|
||||
|
||||
|
@ -109,3 +110,8 @@ function createAccountDataStore(db) {
|
|||
function createInviteStore(db) {
|
||||
db.createObjectStore("invites", {keyPath: "roomId"});
|
||||
}
|
||||
|
||||
// v8
|
||||
function createArchivedRoomSummaryStore(db) {
|
||||
db.createObjectStore("archivedRoomSummary", {keyPath: "roomId"});
|
||||
}
|
|
@ -27,6 +27,8 @@ store contains:
|
|||
inviteCount
|
||||
joinCount
|
||||
*/
|
||||
|
||||
/** Used for both roomSummary and archivedRoomSummary stores */
|
||||
export class RoomSummaryStore {
|
||||
constructor(summaryStore) {
|
||||
this._summaryStore = summaryStore;
|
||||
|
@ -39,4 +41,8 @@ export class RoomSummaryStore {
|
|||
set(summary) {
|
||||
return this._summaryStore.put(summary);
|
||||
}
|
||||
|
||||
remove(roomId) {
|
||||
return this._summaryStore.delete(roomId);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue