fix temp garbage now lexicons are updated
This commit is contained in:
@@ -55,11 +55,6 @@ export const config: app.bsky.ageassurance.defs.Config = {
|
||||
}),
|
||||
],
|
||||
},
|
||||
/*
|
||||
* `platforms` is not in the generated `ConfigRegion` yet (the server sends
|
||||
* it and `getAgeAssuranceRegionConfigForGeolocation` reads it), so this
|
||||
* fixture asserts the shape until the lexicon carries the field.
|
||||
*/
|
||||
{
|
||||
// On-device verification region, native-only (web users in TX are not
|
||||
// age assured). KWS is included as a fallback for when the device
|
||||
@@ -78,7 +73,7 @@ export const config: app.bsky.ageassurance.defs.Config = {
|
||||
access: 'none',
|
||||
}),
|
||||
],
|
||||
} as app.bsky.ageassurance.defs.ConfigRegion,
|
||||
},
|
||||
{
|
||||
countryCode: 'GB',
|
||||
minAccessAge: 13,
|
||||
|
||||
@@ -12,15 +12,14 @@ describe('getAgeAssuranceRegionConfigForGeolocation', () => {
|
||||
const region = (
|
||||
countryCode: string,
|
||||
regionCode?: string,
|
||||
platforms?: string[],
|
||||
) =>
|
||||
({
|
||||
countryCode,
|
||||
regionCode,
|
||||
platforms,
|
||||
minAccessAge: 13,
|
||||
rules: [],
|
||||
}) as app.bsky.ageassurance.defs.ConfigRegion
|
||||
platforms?: app.bsky.ageassurance.defs.ConfigRegion['platforms'],
|
||||
): app.bsky.ageassurance.defs.ConfigRegion => ({
|
||||
countryCode,
|
||||
regionCode,
|
||||
platforms,
|
||||
minAccessAge: 13,
|
||||
rules: [],
|
||||
})
|
||||
|
||||
it('skips regions for other platforms and continues matching', () => {
|
||||
const web = region('US', undefined, ['web'])
|
||||
|
||||
@@ -46,18 +46,23 @@ export function getAgeAssuranceRegionConfigForGeolocation(
|
||||
geolocation: Geolocation,
|
||||
): app.bsky.ageassurance.defs.ConfigRegion | undefined {
|
||||
/*
|
||||
* The SDK's region matcher takes no `platform` filter (and the generated
|
||||
* `ConfigRegion` carries no `platforms` field yet), so platform scoping is
|
||||
* applied here: regions restricted to other platforms are dropped before
|
||||
* matching, which is what passing `platform` to the old api helper did.
|
||||
* Fold this back into the SDK call once it accepts a platform.
|
||||
* The SDK's region matcher takes no `platform` filter, so platform scoping
|
||||
* is applied here: regions restricted to other platforms are dropped before
|
||||
* matching. Once the SDK accepts a platform, this whole function body
|
||||
* collapses to:
|
||||
*
|
||||
* return getAgeAssuranceRegionConfig(config, {
|
||||
* countryCode: geolocation.countryCode ?? '',
|
||||
* regionCode: geolocation.regionCode,
|
||||
* platform: AGE_ASSURANCE_PLATFORM,
|
||||
* })
|
||||
*/
|
||||
const scoped: app.bsky.ageassurance.defs.Config = {
|
||||
...config,
|
||||
regions: config.regions.filter(region => {
|
||||
const platforms = (region as {platforms?: string[]}).platforms
|
||||
return !platforms || platforms.includes(AGE_ASSURANCE_PLATFORM)
|
||||
}),
|
||||
regions: config.regions.filter(
|
||||
region =>
|
||||
!region.platforms || region.platforms.includes(AGE_ASSURANCE_PLATFORM),
|
||||
),
|
||||
}
|
||||
return getAgeAssuranceRegionConfig(scoped, {
|
||||
countryCode: geolocation.countryCode ?? '',
|
||||
|
||||
@@ -1,15 +1,6 @@
|
||||
import {type app} from '#/lexicons'
|
||||
|
||||
/**
|
||||
* A `listNotifications` notification, widened with the `starterPack` the server
|
||||
* attaches to a `follow` notification sourced from a starter pack. The pinned
|
||||
* lexicon does not declare the field yet, so it is added here rather than read
|
||||
* off an `unknown`. Drop this alias once the generated type carries it.
|
||||
*/
|
||||
export type Notification =
|
||||
app.bsky.notification.listNotifications.Notification & {
|
||||
starterPack?: app.bsky.graph.defs.StarterPackViewBasic
|
||||
}
|
||||
export type Notification = app.bsky.notification.listNotifications.Notification
|
||||
|
||||
export type NotificationType =
|
||||
| StarterPackNotificationType
|
||||
|
||||
Reference in New Issue
Block a user