Skip to content

Commit

Permalink
Apply Following settings to Lists (#5313)
Browse files Browse the repository at this point in the history
* Apply Following settings to Lists

* Remove dead code
  • Loading branch information
gaearon authored Sep 13, 2024
1 parent 88813f5 commit ce3893d
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 28 deletions.
2 changes: 1 addition & 1 deletion src/components/StarterPack/Main/PostsList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ interface ProfilesListProps {

export const PostsList = React.forwardRef<SectionRef, ProfilesListProps>(
function PostsListImpl({listUri, headerHeight, scrollElRef}, ref) {
const feed: FeedDescriptor = `list|${listUri}|as_following`
const feed: FeedDescriptor = `list|${listUri}`
const {_} = useLingui()

const onScrollToTop = useCallback(() => {
Expand Down
26 changes: 1 addition & 25 deletions src/state/preferences/feed-tuners.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,31 +21,7 @@ export function useFeedTuners(feedDesc: FeedDescriptor) {
if (feedDesc.startsWith('feedgen')) {
return [FeedTuner.preferredLangOnly(langPrefs.contentLanguages)]
}
if (feedDesc.startsWith('list')) {
let feedTuners = []
if (feedDesc.endsWith('|as_following')) {
// Same as Following tuners below, copypaste for now.
feedTuners.push(FeedTuner.removeOrphans)
if (preferences?.feedViewPrefs.hideReposts) {
feedTuners.push(FeedTuner.removeReposts)
}
if (preferences?.feedViewPrefs.hideReplies) {
feedTuners.push(FeedTuner.removeReplies)
} else {
feedTuners.push(
FeedTuner.followedRepliesOnly({
userDid: currentAccount?.did || '',
}),
)
}
if (preferences?.feedViewPrefs.hideQuotePosts) {
feedTuners.push(FeedTuner.removeQuotePosts)
}
feedTuners.push(FeedTuner.dedupThreads)
}
return feedTuners
}
if (feedDesc === 'following') {
if (feedDesc === 'following' || feedDesc.startsWith('list')) {
const feedTuners = [FeedTuner.removeOrphans]

if (preferences?.feedViewPrefs.hideReposts) {
Expand Down
2 changes: 0 additions & 2 deletions src/state/queries/post-feed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,13 @@ type AuthorFilter =
| 'posts_with_media'
type FeedUri = string
type ListUri = string
type ListFilter = 'as_following' // Applies current Following settings. Currently client-side.

export type FeedDescriptor =
| 'following'
| `author|${ActorDid}|${AuthorFilter}`
| `feedgen|${FeedUri}`
| `likes|${ActorDid}`
| `list|${ListUri}`
| `list|${ListUri}|${ListFilter}`
export interface FeedParams {
mergeFeedEnabled?: boolean
mergeFeedSources?: string[]
Expand Down

0 comments on commit ce3893d

Please sign in to comment.