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([
|
return this._storage.readWriteTxn([
|
||||||
storeNames.session,
|
storeNames.session,
|
||||||
storeNames.roomSummary,
|
storeNames.roomSummary,
|
||||||
|
storeNames.archivedRoomSummary,
|
||||||
storeNames.invites,
|
storeNames.invites,
|
||||||
storeNames.roomState,
|
storeNames.roomState,
|
||||||
storeNames.roomMembers,
|
storeNames.roomMembers,
|
||||||
|
|
|
@ -18,6 +18,7 @@ export const STORE_NAMES = Object.freeze([
|
||||||
"session",
|
"session",
|
||||||
"roomState",
|
"roomState",
|
||||||
"roomSummary",
|
"roomSummary",
|
||||||
|
"archivedRoomSummary",
|
||||||
"invites",
|
"invites",
|
||||||
"roomMembers",
|
"roomMembers",
|
||||||
"timelineEvents",
|
"timelineEvents",
|
||||||
|
|
|
@ -65,6 +65,10 @@ export class Transaction {
|
||||||
return this._store("roomSummary", idbStore => new RoomSummaryStore(idbStore));
|
return this._store("roomSummary", idbStore => new RoomSummaryStore(idbStore));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get archivedRoomSummary() {
|
||||||
|
return this._store("archivedRoomSummary", idbStore => new RoomSummaryStore(idbStore));
|
||||||
|
}
|
||||||
|
|
||||||
get invites() {
|
get invites() {
|
||||||
return this._store("invites", idbStore => new InviteStore(idbStore));
|
return this._store("invites", idbStore => new InviteStore(idbStore));
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,8 @@ export const schema = [
|
||||||
createE2EEStores,
|
createE2EEStores,
|
||||||
migrateEncryptionFlag,
|
migrateEncryptionFlag,
|
||||||
createAccountDataStore,
|
createAccountDataStore,
|
||||||
createInviteStore
|
createInviteStore,
|
||||||
|
createArchivedRoomSummaryStore,
|
||||||
];
|
];
|
||||||
// TODO: how to deal with git merge conflicts of this array?
|
// TODO: how to deal with git merge conflicts of this array?
|
||||||
|
|
||||||
|
@ -109,3 +110,8 @@ function createAccountDataStore(db) {
|
||||||
function createInviteStore(db) {
|
function createInviteStore(db) {
|
||||||
db.createObjectStore("invites", {keyPath: "roomId"});
|
db.createObjectStore("invites", {keyPath: "roomId"});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// v8
|
||||||
|
function createArchivedRoomSummaryStore(db) {
|
||||||
|
db.createObjectStore("archivedRoomSummary", {keyPath: "roomId"});
|
||||||
|
}
|
|
@ -27,6 +27,8 @@ store contains:
|
||||||
inviteCount
|
inviteCount
|
||||||
joinCount
|
joinCount
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/** Used for both roomSummary and archivedRoomSummary stores */
|
||||||
export class RoomSummaryStore {
|
export class RoomSummaryStore {
|
||||||
constructor(summaryStore) {
|
constructor(summaryStore) {
|
||||||
this._summaryStore = summaryStore;
|
this._summaryStore = summaryStore;
|
||||||
|
@ -39,4 +41,8 @@ export class RoomSummaryStore {
|
||||||
set(summary) {
|
set(summary) {
|
||||||
return this._summaryStore.put(summary);
|
return this._summaryStore.put(summary);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
remove(roomId) {
|
||||||
|
return this._summaryStore.delete(roomId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue