Skip to content

Commit

Permalink
feat: add pinned post feature
Browse files Browse the repository at this point in the history
  • Loading branch information
teodorus-nathaniel committed Jan 31, 2024
1 parent 256af8d commit 42b9f9d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/components/posts/loadSuggestedPostIdsFromEnv.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { SubsocialApi } from '@subsocial/api'
import config from 'src/config'
import { PINNED_POST_IDS } from 'src/config/constants'
import { getPostIdsBySpaces } from 'src/graphql/apis'
import { GqlClient } from 'src/graphql/ApolloProvider'
import { AnySpaceId, PostId } from 'src/types'
Expand Down Expand Up @@ -28,7 +29,8 @@ export const loadSuggestedPostIds = async ({
suggestedPostIds = suggestedPostIdsArray.flat()
return descSort(suggestedPostIds)
} else if (client) {
return getPostIdsBySpaces(client, { spaceIds: recommendedIds })
const postIds = await getPostIdsBySpaces(client, { spaceIds: recommendedIds })
return Array.from(new Set([...PINNED_POST_IDS, ...postIds]))
}
return []
}
Expand Down
2 changes: 2 additions & 0 deletions src/config/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ export const CREATORS_CONSTANTS = {
},
}

export const PINNED_POST_IDS = ['49731']

const WHITELISTED_FOR_NEW_FEATURES = [
'3tJYxJN55FtVeZgX4WdwieZXDp4HF62TRVj11tY2aXHdrYus',
'3rzZpUCan9uAA9VSH12zX552Y6rfemGR3hWeeLmhNT1EGosL',
Expand Down

0 comments on commit 42b9f9d

Please sign in to comment.