fn compute_notification_gates( last_notification_read: Option<Option<u64>>, thread_last_reads: Option<&BTreeMap<OwnedEventId, u64>>, since: u64, in_window: impl Fn(u64) -> bool, ) -> NotificationGates<impl Fn(&UInt) -> bool>