* Returns vanish state from users.is_vanished, or lazily hydrates a user row from events once * when no users row exists (single upsert; no duplicate inserts).
(pubkey: Pubkey, client: DatabaseClient = this.dbClient)
| 58 | * when no users row exists (single upsert; no duplicate inserts). |
| 59 | */ |
| 60 | public async isVanished(pubkey: Pubkey, client: DatabaseClient = this.dbClient): Promise<boolean> { |
| 61 | const existing = await this.findByPubkey(pubkey, client) |
| 62 | if (existing) { |
| 63 | return existing.isVanished |
| 64 | } |
| 65 | |
| 66 | const vanishedFromEvents = await this.eventRepository.hasActiveRequestToVanish(pubkey) |
| 67 | await this.upsertVanishState(pubkey, vanishedFromEvents, client) |
| 68 | return vanishedFromEvents |
| 69 | } |
| 70 | |
| 71 | public setVanished(pubkey: Pubkey, vanished: boolean, client: DatabaseClient = this.dbClient): Promise<number> { |
| 72 | return this.upsertVanishState(pubkey, vanished, client) |
nothing calls this directly
no test coverage detected