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:
Claude
2026-07-05 18:02:40 +00:00
parent 9f5d5a539b
commit 73d5703be1
4 changed files with 17 additions and 34 deletions
-1
View File
@@ -12,7 +12,6 @@ export enum Features {
GroupChatsDisable = 'group_chats:disable', GroupChatsDisable = 'group_chats:disable',
ComposerLanguageDetectionEnable = 'composer:language_detection:enable', ComposerLanguageDetectionEnable = 'composer:language_detection:enable',
ComposerImageLayoutToggleEnable = 'composer:image_layout_toggle:enable', ComposerImageLayoutToggleEnable = 'composer:image_layout_toggle:enable',
PostGalleryEmbedEnable = 'post_gallery_embed:enable',
NotificationsExpandedProfileCardEnable = 'notifications:expanded_profile_card:enable', NotificationsExpandedProfileCardEnable = 'notifications:expanded_profile_card:enable',
SearchV2Enable = 'search_v2:enable', SearchV2Enable = 'search_v2:enable',
AdvancedSearchV2Enable = 'advanced_search_v2:enable', AdvancedSearchV2Enable = 'advanced_search_v2:enable',
+10 -12
View File
@@ -37,19 +37,17 @@ export function ImageEmbed({
})) }))
: embed.view.images : embed.view.images
/* /*
* The gallery embed type implies the carousel layout: >4 images always * The embed type decides the layout: gallery embeds render as the
* publishes as a gallery, and the composer's layout toggle experiment * carousel (>4 images always publishes as a gallery, and the composer's
* publishes 2-4 images as a gallery when the user opts into the carousel. * layout toggle experiment lets 2-4 images opt in), legacy `images`
* Legacy `images` embeds keep the grid unless the viewer-side gate flips * embeds render as the grid.
* them to the carousel.
*/ */
const useExpandedLayout =
embed.type === 'gallery'
? true
: ax.features.enabled(ax.features.PostGalleryEmbedEnable)
const layout: 'single' | 'grid' | 'carousel' = 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 const postContext = rest.post
? { ? {
@@ -153,7 +151,7 @@ export function ImageEmbed({
) )
} }
if (useExpandedLayout) { if (layout === 'carousel') {
return ( return (
<View style={[a.mt_sm, rest.style]}> <View style={[a.mt_sm, rest.style]}>
<Gallery <Gallery
@@ -10,7 +10,6 @@ import {
import {unique} from '#/lib/moderation' import {unique} from '#/lib/moderation'
import {type AppModerationCause} from '#/components/Pills' import {type AppModerationCause} from '#/components/Pills'
import {Features, features} from '#/analytics/features'
import * as bsky from '#/types/bsky' import * as bsky from '#/types/bsky'
export const POST_META_NO_CONTENT_OFFSET = {paddingTop: 10} export const POST_META_NO_CONTENT_OFFSET = {paddingTop: 10}
@@ -37,13 +36,6 @@ export function maybeApplyGalleryOffsetStyles(
return 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 * First check if we even have images
*/ */
@@ -68,10 +60,8 @@ export function maybeApplyGalleryOffsetStyles(
) )
let hasImages = false let hasImages = false
if (isImageEmbed) { if (isImageEmbed) {
if (!isPostGalleryEmbedEnabled) return // legacy image embeds render as the grid, which needs no offset
// one image, not a gallery return
if (embed.images.length === 1) return
hasImages = true
} }
if (isGalleryEmbed) { if (isGalleryEmbed) {
// single (or empty) gallery - no offset needed // single (or empty) gallery - no offset needed
@@ -85,9 +75,8 @@ export function maybeApplyGalleryOffsetStyles(
AppBskyEmbedImages.isMain, AppBskyEmbedImages.isMain,
) )
) { ) {
if (!isPostGalleryEmbedEnabled) return // legacy image embeds render as the grid, which needs no offset
// one image, not a gallery return
if (embed.media.images.length === 1) return
} }
if ( if (
bsky.dangerousIsType<AppBskyEmbedGallery.Main>( bsky.dangerousIsType<AppBskyEmbedGallery.Main>(
+3 -6
View File
@@ -968,16 +968,13 @@ let PostFeed = ({
: post.embed.images.length : post.embed.images.length
/* /*
* Keep in sync with the layout decision in ImageEmbed: gallery * Keep in sync with the layout decision in ImageEmbed: gallery
* embeds always render as the carousel, legacy `images` embeds * embeds render as the carousel, legacy `images` embeds as the
* depend on the viewer-side gate. * grid.
*/ */
const useExpandedLayout = AppBskyEmbedGallery.isView(post.embed)
? true
: ax.features.enabled(ax.features.PostGalleryEmbedEnable)
const layout = const layout =
totalImages === 1 totalImages === 1
? 'single' ? 'single'
: useExpandedLayout : AppBskyEmbedGallery.isView(post.embed)
? 'carousel' ? 'carousel'
: 'grid' : 'grid'