Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
rm moderatePost_wrapped
Browse files Browse the repository at this point in the history
mozzius committed Dec 19, 2024
1 parent a3031de commit d2a7dd0
Showing 11 changed files with 14 additions and 57 deletions.
13 changes: 0 additions & 13 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -80,19 +80,6 @@ module.exports = {
],
'simple-import-sort/exports': 'error',
'react-compiler/react-compiler': 'warn',
'no-restricted-imports': [
'error',
{
paths: [
{
name: '@atproto/api',
importNames: ['moderatePost'],
message:
'Please use `moderatePost_wrapped` from `#/lib/moderatePost_wrapped` instead.',
},
],
},
],
},
ignorePatterns: [
'**/__mocks__/*.ts',
31 changes: 0 additions & 31 deletions src/lib/moderatePost_wrapped.ts

This file was deleted.

2 changes: 1 addition & 1 deletion src/screens/Messages/components/MessageInputEmbed.tsx
Original file line number Diff line number Diff line change
@@ -4,13 +4,13 @@ import {
AppBskyFeedPost,
AppBskyRichtextFacet,
AtUri,
moderatePost,
RichText as RichTextAPI,
} from '@atproto/api'
import {msg} from '@lingui/macro'
import {useLingui} from '@lingui/react'
import {RouteProp, useNavigation, useRoute} from '@react-navigation/native'

import {moderatePost_wrapped as moderatePost} from '#/lib/moderatePost_wrapped'
import {makeProfileLink} from '#/lib/routes/links'
import {CommonNavigatorParams, NavigationProp} from '#/lib/routes/types'
import {
2 changes: 1 addition & 1 deletion src/state/queries/notifications/feed.ts
Original file line number Diff line number Diff line change
@@ -22,6 +22,7 @@ import {
AppBskyFeedDefs,
AppBskyFeedPost,
AtUri,
moderatePost,
} from '@atproto/api'
import {
InfiniteData,
@@ -31,7 +32,6 @@ import {
useQueryClient,
} from '@tanstack/react-query'

import {moderatePost_wrapped as moderatePost} from '#/lib/moderatePost_wrapped'
import {useAgent} from '#/state/session'
import {useThreadgateHiddenReplyUris} from '#/state/threadgate-hidden-replies'
import {useModerationOpts} from '../../preferences/moderation-opts'
2 changes: 1 addition & 1 deletion src/state/queries/post-feed.ts
Original file line number Diff line number Diff line change
@@ -6,6 +6,7 @@ import {
AppBskyFeedPost,
AtUri,
BskyAgent,
moderatePost,
ModerationDecision,
} from '@atproto/api'
import {
@@ -27,7 +28,6 @@ import {aggregateUserInterests} from '#/lib/api/feed/utils'
import {FeedTuner, FeedTunerFn} from '#/lib/api/feed-manip'
import {DISCOVER_FEED_URI} from '#/lib/constants'
import {BSKY_FEED_OWNER_DIDS} from '#/lib/constants'
import {moderatePost_wrapped as moderatePost} from '#/lib/moderatePost_wrapped'
import {logger} from '#/logger'
import {STALE} from '#/state/queries'
import {DEFAULT_LOGGED_OUT_PREFERENCES} from '#/state/queries/preferences/const'
2 changes: 1 addition & 1 deletion src/state/queries/post-thread.ts
Original file line number Diff line number Diff line change
@@ -5,12 +5,12 @@ import {
AppBskyFeedGetPostThread,
AppBskyFeedPost,
AtUri,
moderatePost,
ModerationDecision,
ModerationOpts,
} from '@atproto/api'
import {QueryClient, useQuery, useQueryClient} from '@tanstack/react-query'

import {moderatePost_wrapped as moderatePost} from '#/lib/moderatePost_wrapped'
import {findAllPostsInQueryData as findAllPostsInQuoteQueryData} from '#/state/queries/post-quotes'
import {UsePreferencesQueryResponse} from '#/state/queries/preferences/types'
import {
2 changes: 1 addition & 1 deletion src/state/queries/search-posts.ts
Original file line number Diff line number Diff line change
@@ -4,6 +4,7 @@ import {
AppBskyFeedDefs,
AppBskyFeedSearchPosts,
AtUri,
moderatePost,
} from '@atproto/api'
import {
InfiniteData,
@@ -12,7 +13,6 @@ import {
useInfiniteQuery,
} from '@tanstack/react-query'

import {moderatePost_wrapped as moderatePost} from '#/lib/moderatePost_wrapped'
import {useModerationOpts} from '#/state/preferences/moderation-opts'
import {useAgent} from '#/state/session'
import {
2 changes: 1 addition & 1 deletion src/view/com/post-thread/PostQuotes.tsx
Original file line number Diff line number Diff line change
@@ -2,13 +2,13 @@ import {useCallback, useState} from 'react'
import {
AppBskyFeedDefs,
AppBskyFeedPost,
moderatePost,
ModerationDecision,
} from '@atproto/api'
import {msg} from '@lingui/macro'
import {useLingui} from '@lingui/react'

import {useInitialNumToRender} from '#/lib/hooks/useInitialNumToRender'
import {moderatePost_wrapped as moderatePost} from '#/lib/moderatePost_wrapped'
import {cleanError} from '#/lib/strings/errors'
import {logger} from '#/logger'
import {useModerationOpts} from '#/state/preferences/moderation-opts'
7 changes: 5 additions & 2 deletions src/view/com/post-thread/PostThread.tsx
Original file line number Diff line number Diff line change
@@ -3,7 +3,11 @@ import {StyleSheet, useWindowDimensions, View} from 'react-native'
import {runOnJS} from 'react-native-reanimated'
import Animated from 'react-native-reanimated'
import {useSafeAreaInsets} from 'react-native-safe-area-context'
import {AppBskyFeedDefs, AppBskyFeedThreadgate} from '@atproto/api'
import {
AppBskyFeedDefs,
AppBskyFeedThreadgate,
moderatePost,
} from '@atproto/api'
import {msg, Trans} from '@lingui/macro'
import {useLingui} from '@lingui/react'

@@ -12,7 +16,6 @@ import {useInitialNumToRender} from '#/lib/hooks/useInitialNumToRender'
import {useMinimalShellFabTransform} from '#/lib/hooks/useMinimalShellTransform'
import {useSetTitle} from '#/lib/hooks/useSetTitle'
import {useWebMediaQueries} from '#/lib/hooks/useWebMediaQueries'
import {moderatePost_wrapped as moderatePost} from '#/lib/moderatePost_wrapped'
import {clamp} from '#/lib/numbers'
import {ScrollProvider} from '#/lib/ScrollContext'
import {sanitizeDisplayName} from '#/lib/strings/display-names'
2 changes: 1 addition & 1 deletion src/view/com/post/Post.tsx
Original file line number Diff line number Diff line change
@@ -4,6 +4,7 @@ import {
AppBskyFeedDefs,
AppBskyFeedPost,
AtUri,
moderatePost,
ModerationDecision,
RichText as RichTextAPI,
} from '@atproto/api'
@@ -14,7 +15,6 @@ import {useQueryClient} from '@tanstack/react-query'

import {MAX_POST_LINES} from '#/lib/constants'
import {usePalette} from '#/lib/hooks/usePalette'
import {moderatePost_wrapped as moderatePost} from '#/lib/moderatePost_wrapped'
import {makeProfileLink} from '#/lib/routes/links'
import {countLines} from '#/lib/strings/helpers'
import {colors, s} from '#/lib/styles'
6 changes: 2 additions & 4 deletions src/view/com/util/post-embeds/QuoteEmbed.tsx
Original file line number Diff line number Diff line change
@@ -14,6 +14,7 @@ import {
AppBskyEmbedVideo,
AppBskyFeedDefs,
AppBskyFeedPost,
moderatePost,
ModerationDecision,
RichText as RichTextAPI,
} from '@atproto/api'
@@ -26,7 +27,6 @@ import {useQueryClient} from '@tanstack/react-query'
import {HITSLOP_20} from '#/lib/constants'
import {usePalette} from '#/lib/hooks/usePalette'
import {InfoCircleIcon} from '#/lib/icons'
import {moderatePost_wrapped} from '#/lib/moderatePost_wrapped'
import {makeProfileLink} from '#/lib/routes/links'
import {s} from '#/lib/styles'
import {useModerationOpts} from '#/state/preferences/moderation-opts'
@@ -134,9 +134,7 @@ function QuoteEmbedModerated({
[viewRecord],
)
const moderation = React.useMemo(() => {
return moderationOpts
? moderatePost_wrapped(postView, moderationOpts)
: undefined
return moderationOpts ? moderatePost(postView, moderationOpts) : undefined
}, [postView, moderationOpts])

return (

0 comments on commit d2a7dd0

Please sign in to comment.