Thread muting [APP-29] (#500)
* Implement thread muting * Apply filtering on background fetched notifs * Implement thread-muting tests
This commit is contained in:
parent
3e78c71018
commit
22884b53ad
16 changed files with 470 additions and 108 deletions
29
src/state/models/muted-threads.ts
Normal file
29
src/state/models/muted-threads.ts
Normal file
|
@ -0,0 +1,29 @@
|
|||
/**
|
||||
* This is a temporary client-side system for storing muted threads
|
||||
* When the system lands on prod we should switch to that
|
||||
*/
|
||||
|
||||
import {makeAutoObservable} from 'mobx'
|
||||
import {isObj, hasProp, isStrArray} from 'lib/type-guards'
|
||||
|
||||
export class MutedThreads {
|
||||
uris: Set<string> = new Set()
|
||||
|
||||
constructor() {
|
||||
makeAutoObservable(
|
||||
this,
|
||||
{serialize: false, hydrate: false},
|
||||
{autoBind: true},
|
||||
)
|
||||
}
|
||||
|
||||
serialize() {
|
||||
return {uris: Array.from(this.uris)}
|
||||
}
|
||||
|
||||
hydrate(v: unknown) {
|
||||
if (isObj(v) && hasProp(v, 'uris') && isStrArray(v.uris)) {
|
||||
this.uris = new Set(v.uris)
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue