Remove ungroup_follow_backs gate (#4893)
parent
4b71950d99
commit
f3a9f874d9
|
@ -10,6 +10,5 @@ export type Gate =
|
||||||
| 'show_avi_follow_button'
|
| 'show_avi_follow_button'
|
||||||
| 'show_follow_back_label_v2'
|
| 'show_follow_back_label_v2'
|
||||||
| 'suggested_feeds_interstitial'
|
| 'suggested_feeds_interstitial'
|
||||||
| 'ungroup_follow_backs'
|
|
||||||
| 'video_debug'
|
| 'video_debug'
|
||||||
| 'videos'
|
| 'videos'
|
||||||
|
|
|
@ -26,7 +26,6 @@ import {
|
||||||
useQueryClient,
|
useQueryClient,
|
||||||
} from '@tanstack/react-query'
|
} from '@tanstack/react-query'
|
||||||
|
|
||||||
import {useGate} from '#/lib/statsig/statsig'
|
|
||||||
import {useAgent} from '#/state/session'
|
import {useAgent} from '#/state/session'
|
||||||
import {useModerationOpts} from '../../preferences/moderation-opts'
|
import {useModerationOpts} from '../../preferences/moderation-opts'
|
||||||
import {STALE} from '..'
|
import {STALE} from '..'
|
||||||
|
@ -59,7 +58,6 @@ export function useNotificationFeedQuery(opts?: {
|
||||||
const moderationOpts = useModerationOpts()
|
const moderationOpts = useModerationOpts()
|
||||||
const unreads = useUnreadNotificationsApi()
|
const unreads = useUnreadNotificationsApi()
|
||||||
const enabled = opts?.enabled !== false
|
const enabled = opts?.enabled !== false
|
||||||
const gate = useGate()
|
|
||||||
|
|
||||||
// false: force showing all notifications
|
// false: force showing all notifications
|
||||||
// undefined: let the server decide
|
// undefined: let the server decide
|
||||||
|
@ -88,7 +86,6 @@ export function useNotificationFeedQuery(opts?: {
|
||||||
queryClient,
|
queryClient,
|
||||||
moderationOpts,
|
moderationOpts,
|
||||||
fetchAdditionalData: true,
|
fetchAdditionalData: true,
|
||||||
shouldUngroupFollowBacks: () => gate('ungroup_follow_backs'),
|
|
||||||
priority,
|
priority,
|
||||||
})
|
})
|
||||||
page = fetchedPage
|
page = fetchedPage
|
||||||
|
|
|
@ -8,7 +8,6 @@ import {useQueryClient} from '@tanstack/react-query'
|
||||||
import EventEmitter from 'eventemitter3'
|
import EventEmitter from 'eventemitter3'
|
||||||
|
|
||||||
import BroadcastChannel from '#/lib/broadcast'
|
import BroadcastChannel from '#/lib/broadcast'
|
||||||
import {useGate} from '#/lib/statsig/statsig'
|
|
||||||
import {logger} from '#/logger'
|
import {logger} from '#/logger'
|
||||||
import {useAgent, useSession} from '#/state/session'
|
import {useAgent, useSession} from '#/state/session'
|
||||||
import {resetBadgeCount} from 'lib/notifications/notifications'
|
import {resetBadgeCount} from 'lib/notifications/notifications'
|
||||||
|
@ -48,7 +47,6 @@ export function Provider({children}: React.PropsWithChildren<{}>) {
|
||||||
const agent = useAgent()
|
const agent = useAgent()
|
||||||
const queryClient = useQueryClient()
|
const queryClient = useQueryClient()
|
||||||
const moderationOpts = useModerationOpts()
|
const moderationOpts = useModerationOpts()
|
||||||
const gate = useGate()
|
|
||||||
|
|
||||||
const [numUnread, setNumUnread] = React.useState('')
|
const [numUnread, setNumUnread] = React.useState('')
|
||||||
|
|
||||||
|
@ -151,7 +149,6 @@ export function Provider({children}: React.PropsWithChildren<{}>) {
|
||||||
// only fetch subjects when the page is going to be used
|
// only fetch subjects when the page is going to be used
|
||||||
// in the notifications query, otherwise skip it
|
// in the notifications query, otherwise skip it
|
||||||
fetchAdditionalData: !!invalidate,
|
fetchAdditionalData: !!invalidate,
|
||||||
shouldUngroupFollowBacks: () => gate('ungroup_follow_backs'),
|
|
||||||
})
|
})
|
||||||
const unreadCount = countUnread(page)
|
const unreadCount = countUnread(page)
|
||||||
const unreadCountStr =
|
const unreadCountStr =
|
||||||
|
@ -192,7 +189,7 @@ export function Provider({children}: React.PropsWithChildren<{}>) {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}, [setNumUnread, queryClient, moderationOpts, agent, gate])
|
}, [setNumUnread, queryClient, moderationOpts, agent])
|
||||||
checkUnreadRef.current = api.checkUnread
|
checkUnreadRef.current = api.checkUnread
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
|
@ -30,7 +30,6 @@ export async function fetchPage({
|
||||||
queryClient,
|
queryClient,
|
||||||
moderationOpts,
|
moderationOpts,
|
||||||
fetchAdditionalData,
|
fetchAdditionalData,
|
||||||
shouldUngroupFollowBacks,
|
|
||||||
}: {
|
}: {
|
||||||
agent: BskyAgent
|
agent: BskyAgent
|
||||||
cursor: string | undefined
|
cursor: string | undefined
|
||||||
|
@ -38,7 +37,6 @@ export async function fetchPage({
|
||||||
queryClient: QueryClient
|
queryClient: QueryClient
|
||||||
moderationOpts: ModerationOpts | undefined
|
moderationOpts: ModerationOpts | undefined
|
||||||
fetchAdditionalData: boolean
|
fetchAdditionalData: boolean
|
||||||
shouldUngroupFollowBacks?: () => boolean
|
|
||||||
priority?: boolean
|
priority?: boolean
|
||||||
}): Promise<{
|
}): Promise<{
|
||||||
page: FeedPage
|
page: FeedPage
|
||||||
|
@ -58,7 +56,7 @@ export async function fetchPage({
|
||||||
)
|
)
|
||||||
|
|
||||||
// group notifications which are essentially similar (follows, likes on a post)
|
// group notifications which are essentially similar (follows, likes on a post)
|
||||||
let notifsGrouped = groupNotifications(notifs, {shouldUngroupFollowBacks})
|
let notifsGrouped = groupNotifications(notifs)
|
||||||
|
|
||||||
// we fetch subjects of notifications (usually posts) now instead of lazily
|
// we fetch subjects of notifications (usually posts) now instead of lazily
|
||||||
// in the UI to avoid relayouts
|
// in the UI to avoid relayouts
|
||||||
|
@ -117,7 +115,6 @@ export function shouldFilterNotif(
|
||||||
|
|
||||||
export function groupNotifications(
|
export function groupNotifications(
|
||||||
notifs: AppBskyNotificationListNotifications.Notification[],
|
notifs: AppBskyNotificationListNotifications.Notification[],
|
||||||
options?: {shouldUngroupFollowBacks?: () => boolean},
|
|
||||||
): FeedNotification[] {
|
): FeedNotification[] {
|
||||||
const groupedNotifs: FeedNotification[] = []
|
const groupedNotifs: FeedNotification[] = []
|
||||||
for (const notif of notifs) {
|
for (const notif of notifs) {
|
||||||
|
@ -137,9 +134,7 @@ export function groupNotifications(
|
||||||
const prevIsFollowBack =
|
const prevIsFollowBack =
|
||||||
groupedNotif.notification.reason === 'follow' &&
|
groupedNotif.notification.reason === 'follow' &&
|
||||||
groupedNotif.notification.author.viewer?.following
|
groupedNotif.notification.author.viewer?.following
|
||||||
const shouldUngroup =
|
const shouldUngroup = nextIsFollowBack || prevIsFollowBack
|
||||||
(nextIsFollowBack || prevIsFollowBack) &&
|
|
||||||
options?.shouldUngroupFollowBacks?.()
|
|
||||||
if (!shouldUngroup) {
|
if (!shouldUngroup) {
|
||||||
groupedNotif.additional = groupedNotif.additional || []
|
groupedNotif.additional = groupedNotif.additional || []
|
||||||
groupedNotif.additional.push(notif)
|
groupedNotif.additional.push(notif)
|
||||||
|
|
|
@ -25,7 +25,6 @@ import {useLingui} from '@lingui/react'
|
||||||
import {useNavigation} from '@react-navigation/native'
|
import {useNavigation} from '@react-navigation/native'
|
||||||
import {useQueryClient} from '@tanstack/react-query'
|
import {useQueryClient} from '@tanstack/react-query'
|
||||||
|
|
||||||
import {useGate} from '#/lib/statsig/statsig'
|
|
||||||
import {parseTenorGif} from '#/lib/strings/embed-player'
|
import {parseTenorGif} from '#/lib/strings/embed-player'
|
||||||
import {logger} from '#/logger'
|
import {logger} from '#/logger'
|
||||||
import {FeedNotification} from '#/state/queries/notifications/feed'
|
import {FeedNotification} from '#/state/queries/notifications/feed'
|
||||||
|
@ -87,7 +86,6 @@ let FeedItem = ({
|
||||||
const pal = usePalette('default')
|
const pal = usePalette('default')
|
||||||
const {_} = useLingui()
|
const {_} = useLingui()
|
||||||
const t = useTheme()
|
const t = useTheme()
|
||||||
const gate = useGate()
|
|
||||||
const [isAuthorsExpanded, setAuthorsExpanded] = useState<boolean>(false)
|
const [isAuthorsExpanded, setAuthorsExpanded] = useState<boolean>(false)
|
||||||
const itemHref = useMemo(() => {
|
const itemHref = useMemo(() => {
|
||||||
if (item.type === 'post-like' || item.type === 'repost') {
|
if (item.type === 'post-like' || item.type === 'repost') {
|
||||||
|
@ -207,7 +205,7 @@ let FeedItem = ({
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isFollowBack && gate('ungroup_follow_backs')) {
|
if (isFollowBack) {
|
||||||
action = _(msg`followed you back`)
|
action = _(msg`followed you back`)
|
||||||
} else {
|
} else {
|
||||||
action = _(msg`followed you`)
|
action = _(msg`followed you`)
|
||||||
|
|
Loading…
Reference in New Issue