Remove post_gallery_embed:enable feature gate
The embed type now decides the image layout everywhere: gallery embeds render as the carousel, legacy `app.bsky.embed.images` embeds render as the grid. This also means legacy image embeds never need the gallery offset styles. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SvDXhHEBCjAfokEFK8pHt8
This commit is contained in:
@@ -12,7 +12,6 @@ export enum Features {
|
||||
GroupChatsDisable = 'group_chats:disable',
|
||||
ComposerLanguageDetectionEnable = 'composer:language_detection:enable',
|
||||
ComposerImageLayoutToggleEnable = 'composer:image_layout_toggle:enable',
|
||||
PostGalleryEmbedEnable = 'post_gallery_embed:enable',
|
||||
NotificationsExpandedProfileCardEnable = 'notifications:expanded_profile_card:enable',
|
||||
SearchV2Enable = 'search_v2:enable',
|
||||
AdvancedSearchV2Enable = 'advanced_search_v2:enable',
|
||||
|
||||
@@ -37,19 +37,17 @@ export function ImageEmbed({
|
||||
}))
|
||||
: embed.view.images
|
||||
/*
|
||||
* The gallery embed type implies the carousel layout: >4 images always
|
||||
* publishes as a gallery, and the composer's layout toggle experiment
|
||||
* publishes 2-4 images as a gallery when the user opts into the carousel.
|
||||
* Legacy `images` embeds keep the grid unless the viewer-side gate flips
|
||||
* them to the carousel.
|
||||
* The embed type decides the layout: gallery embeds render as the
|
||||
* carousel (>4 images always publishes as a gallery, and the composer's
|
||||
* layout toggle experiment lets 2-4 images opt in), legacy `images`
|
||||
* embeds render as the grid.
|
||||
*/
|
||||
const useExpandedLayout =
|
||||
embed.type === 'gallery'
|
||||
? true
|
||||
: ax.features.enabled(ax.features.PostGalleryEmbedEnable)
|
||||
|
||||
const layout: 'single' | 'grid' | 'carousel' =
|
||||
images.length === 1 ? 'single' : useExpandedLayout ? 'carousel' : 'grid'
|
||||
images.length === 1
|
||||
? 'single'
|
||||
: embed.type === 'gallery'
|
||||
? 'carousel'
|
||||
: 'grid'
|
||||
|
||||
const postContext = rest.post
|
||||
? {
|
||||
@@ -153,7 +151,7 @@ export function ImageEmbed({
|
||||
)
|
||||
}
|
||||
|
||||
if (useExpandedLayout) {
|
||||
if (layout === 'carousel') {
|
||||
return (
|
||||
<View style={[a.mt_sm, rest.style]}>
|
||||
<Gallery
|
||||
|
||||
@@ -10,7 +10,6 @@ import {
|
||||
|
||||
import {unique} from '#/lib/moderation'
|
||||
import {type AppModerationCause} from '#/components/Pills'
|
||||
import {Features, features} from '#/analytics/features'
|
||||
import * as bsky from '#/types/bsky'
|
||||
|
||||
export const POST_META_NO_CONTENT_OFFSET = {paddingTop: 10}
|
||||
@@ -37,13 +36,6 @@ export function maybeApplyGalleryOffsetStyles(
|
||||
return
|
||||
}
|
||||
|
||||
// The gate only controls whether legacy image embeds opt into the new
|
||||
// expanded gallery layout. Gallery embeds always render expanded by item
|
||||
// count, so their offset must apply regardless of the gate.
|
||||
const isPostGalleryEmbedEnabled = features.isOn(
|
||||
Features.PostGalleryEmbedEnable,
|
||||
)
|
||||
|
||||
/*
|
||||
* First check if we even have images
|
||||
*/
|
||||
@@ -68,10 +60,8 @@ export function maybeApplyGalleryOffsetStyles(
|
||||
)
|
||||
let hasImages = false
|
||||
if (isImageEmbed) {
|
||||
if (!isPostGalleryEmbedEnabled) return
|
||||
// one image, not a gallery
|
||||
if (embed.images.length === 1) return
|
||||
hasImages = true
|
||||
// legacy image embeds render as the grid, which needs no offset
|
||||
return
|
||||
}
|
||||
if (isGalleryEmbed) {
|
||||
// single (or empty) gallery - no offset needed
|
||||
@@ -85,9 +75,8 @@ export function maybeApplyGalleryOffsetStyles(
|
||||
AppBskyEmbedImages.isMain,
|
||||
)
|
||||
) {
|
||||
if (!isPostGalleryEmbedEnabled) return
|
||||
// one image, not a gallery
|
||||
if (embed.media.images.length === 1) return
|
||||
// legacy image embeds render as the grid, which needs no offset
|
||||
return
|
||||
}
|
||||
if (
|
||||
bsky.dangerousIsType<AppBskyEmbedGallery.Main>(
|
||||
|
||||
@@ -968,16 +968,13 @@ let PostFeed = ({
|
||||
: post.embed.images.length
|
||||
/*
|
||||
* Keep in sync with the layout decision in ImageEmbed: gallery
|
||||
* embeds always render as the carousel, legacy `images` embeds
|
||||
* depend on the viewer-side gate.
|
||||
* embeds render as the carousel, legacy `images` embeds as the
|
||||
* grid.
|
||||
*/
|
||||
const useExpandedLayout = AppBskyEmbedGallery.isView(post.embed)
|
||||
? true
|
||||
: ax.features.enabled(ax.features.PostGalleryEmbedEnable)
|
||||
const layout =
|
||||
totalImages === 1
|
||||
? 'single'
|
||||
: useExpandedLayout
|
||||
: AppBskyEmbedGallery.isView(post.embed)
|
||||
? 'carousel'
|
||||
: 'grid'
|
||||
|
||||
|
||||
Reference in New Issue
Block a user