Bluesky app fork with some witchin' additions 💫
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

allow nested quotes in DMs (#4345)

authored by

Samuel Newman and committed by
GitHub
2ffb98e2 d918f8dc

+27 -29
+1 -1
src/components/dms/MessageItemEmbed.tsx
··· 14 14 15 15 return ( 16 16 <View style={[a.my_xs, t.atoms.bg, native({flexBasis: 0})]}> 17 - <PostEmbeds embed={embed} /> 17 + <PostEmbeds embed={embed} allowNestedQuotes /> 18 18 </View> 19 19 ) 20 20 }
+22 -19
src/view/com/util/post-embeds/QuoteEmbed.tsx
··· 2 2 import { 3 3 StyleProp, 4 4 StyleSheet, 5 - TextStyle, 6 5 TouchableOpacity, 7 6 View, 8 7 ViewStyle, ··· 32 31 import {makeProfileLink} from 'lib/routes/links' 33 32 import {precacheProfile} from 'state/queries/profile' 34 33 import {ComposerOptsQuote} from 'state/shell/composer' 35 - import {atoms as a, flatten} from '#/alf' 34 + import {atoms as a} from '#/alf' 36 35 import {RichText} from '#/components/RichText' 37 36 import {ContentHider} from '../../../../components/moderation/ContentHider' 38 37 import {PostAlerts} from '../../../../components/moderation/PostAlerts' ··· 46 45 embed, 47 46 onOpen, 48 47 style, 49 - textStyle, 48 + allowNestedQuotes, 50 49 }: { 51 50 embed: AppBskyEmbedRecord.View 52 51 onOpen?: () => void 53 52 style?: StyleProp<ViewStyle> 54 - textStyle?: StyleProp<TextStyle> 53 + allowNestedQuotes?: boolean 55 54 }) { 56 55 const pal = usePalette('default') 57 56 if ( ··· 65 64 postRecord={embed.record.value} 66 65 onOpen={onOpen} 67 66 style={style} 68 - textStyle={textStyle} 67 + allowNestedQuotes={allowNestedQuotes} 69 68 /> 70 69 ) 71 70 } else if (AppBskyEmbedRecord.isViewBlocked(embed.record)) { ··· 95 94 postRecord, 96 95 onOpen, 97 96 style, 98 - textStyle, 97 + allowNestedQuotes, 99 98 }: { 100 99 viewRecord: AppBskyEmbedRecord.ViewRecord 101 100 postRecord: AppBskyFeedPost.Record 102 101 onOpen?: () => void 103 102 style?: StyleProp<ViewStyle> 104 - textStyle?: StyleProp<TextStyle> 103 + allowNestedQuotes?: boolean 105 104 }) { 106 105 const moderationOpts = useModerationOpts() 107 106 const moderation = React.useMemo(() => { ··· 126 125 moderation={moderation} 127 126 onOpen={onOpen} 128 127 style={style} 129 - textStyle={textStyle} 128 + allowNestedQuotes={allowNestedQuotes} 130 129 /> 131 130 ) 132 131 } ··· 136 135 moderation, 137 136 onOpen, 138 137 style, 139 - textStyle, 138 + allowNestedQuotes, 140 139 }: { 141 140 quote: ComposerOptsQuote 142 141 moderation?: ModerationDecision 143 142 onOpen?: () => void 144 143 style?: StyleProp<ViewStyle> 145 - textStyle?: StyleProp<TextStyle> 144 + allowNestedQuotes?: boolean 146 145 }) { 147 146 const queryClient = useQueryClient() 148 147 const pal = usePalette('default') ··· 161 160 const embed = React.useMemo(() => { 162 161 const e = quote.embeds?.[0] 163 162 164 - if (AppBskyEmbedImages.isView(e) || AppBskyEmbedExternal.isView(e)) { 163 + if (allowNestedQuotes) { 165 164 return e 166 - } else if ( 167 - AppBskyEmbedRecordWithMedia.isView(e) && 168 - (AppBskyEmbedImages.isView(e.media) || 169 - AppBskyEmbedExternal.isView(e.media)) 170 - ) { 171 - return e.media 165 + } else { 166 + if (AppBskyEmbedImages.isView(e) || AppBskyEmbedExternal.isView(e)) { 167 + return e 168 + } else if ( 169 + AppBskyEmbedRecordWithMedia.isView(e) && 170 + (AppBskyEmbedImages.isView(e.media) || 171 + AppBskyEmbedExternal.isView(e.media)) 172 + ) { 173 + return e.media 174 + } 172 175 } 173 - }, [quote.embeds]) 176 + }, [quote.embeds, allowNestedQuotes]) 174 177 175 178 const onBeforePress = React.useCallback(() => { 176 179 precacheProfile(queryClient, quote.author) ··· 201 204 {richText ? ( 202 205 <RichText 203 206 value={richText} 204 - style={[a.text_md, flatten(textStyle)]} 207 + style={a.text_md} 205 208 numberOfLines={20} 206 209 disableLinks 207 210 />
+4 -9
src/view/com/util/post-embeds/index.tsx
··· 4 4 StyleProp, 5 5 StyleSheet, 6 6 Text, 7 - TextStyle, 8 7 View, 9 8 ViewStyle, 10 9 } from 'react-native' ··· 42 41 moderation, 43 42 onOpen, 44 43 style, 45 - quoteTextStyle, 44 + allowNestedQuotes, 46 45 }: { 47 46 embed?: Embed 48 47 moderation?: ModerationDecision 49 48 onOpen?: () => void 50 49 style?: StyleProp<ViewStyle> 51 - quoteTextStyle?: StyleProp<TextStyle> 50 + allowNestedQuotes?: boolean 52 51 }) { 53 52 const pal = usePalette('default') 54 53 const {openLightbox} = useLightboxControls() ··· 63 62 moderation={moderation} 64 63 onOpen={onOpen} 65 64 /> 66 - <MaybeQuoteEmbed 67 - embed={embed.record} 68 - onOpen={onOpen} 69 - textStyle={quoteTextStyle} 70 - /> 65 + <MaybeQuoteEmbed embed={embed.record} onOpen={onOpen} /> 71 66 </View> 72 67 ) 73 68 } ··· 98 93 <MaybeQuoteEmbed 99 94 embed={embed} 100 95 style={style} 101 - textStyle={quoteTextStyle} 102 96 onOpen={onOpen} 97 + allowNestedQuotes={allowNestedQuotes} 103 98 /> 104 99 ) 105 100 }