mirror of
https://github.com/tulir/gomuks.git
synced 2025-04-20 10:33:41 -05:00
web/statestore: clear unread counts when clearing state
This commit is contained in:
parent
c3899d0b50
commit
021236592f
2 changed files with 5 additions and 0 deletions
|
@ -537,6 +537,7 @@ export class StateStore {
|
||||||
this.rooms.clear()
|
this.rooms.clear()
|
||||||
this.inviteRooms.clear()
|
this.inviteRooms.clear()
|
||||||
this.spaceEdges.clear()
|
this.spaceEdges.clear()
|
||||||
|
this.pseudoSpaces.forEach(space => space.clearUnreads())
|
||||||
this.roomList.emit([])
|
this.roomList.emit([])
|
||||||
this.topLevelSpaces.emit([])
|
this.topLevelSpaces.emit([])
|
||||||
this.accountData.clear()
|
this.accountData.clear()
|
||||||
|
|
|
@ -40,6 +40,10 @@ export abstract class Space implements RoomListFilter {
|
||||||
abstract id: string
|
abstract id: string
|
||||||
abstract include(room: RoomListEntry): boolean
|
abstract include(room: RoomListEntry): boolean
|
||||||
|
|
||||||
|
clearUnreads() {
|
||||||
|
this.counts.emit(emptyUnreadCounts)
|
||||||
|
}
|
||||||
|
|
||||||
applyUnreads(newCounts?: SpaceUnreadCounts | null, oldCounts?: SpaceUnreadCounts | null) {
|
applyUnreads(newCounts?: SpaceUnreadCounts | null, oldCounts?: SpaceUnreadCounts | null) {
|
||||||
const mergedCounts: SpaceUnreadCounts = {
|
const mergedCounts: SpaceUnreadCounts = {
|
||||||
unread_messages: this.counts.current.unread_messages
|
unread_messages: this.counts.current.unread_messages
|
||||||
|
|
Loading…
Add table
Reference in a new issue