diff --git a/apps/frontend/src/components/launches/providers/x/x.provider.tsx b/apps/frontend/src/components/launches/providers/x/x.provider.tsx index d7f0d641..ad50e033 100644 --- a/apps/frontend/src/components/launches/providers/x/x.provider.tsx +++ b/apps/frontend/src/components/launches/providers/x/x.provider.tsx @@ -1,8 +1,56 @@ import { withProvider } from '@gitroom/frontend/components/launches/providers/high.order.provider'; import { ThreadFinisher } from '@gitroom/frontend/components/launches/finisher/thread.finisher'; +import { Select } from '@gitroom/react/form/select'; +import { useT } from '@gitroom/react/translation/get.transation.service.client'; +import { useSettings } from '@gitroom/frontend/components/launches/helpers/use.values'; + +const whoCanReply = [ + { + label: 'Everyone', + value: 'everyone', + }, + { + label: 'Accounts you follow', + value: 'following', + }, + { + label: 'Mentioned accounts', + value: 'mentionedUsers', + }, + { + label: 'Subscribers', + value: 'subscribers', + }, + { + label: 'verified accounts', + value: 'verified', + } +] const SettingsComponent = () => { - return ; + const t = useT(); + const { register, watch, setValue } = useSettings(); + + return ( + <> + + + + + ); }; export default withProvider( diff --git a/libraries/nestjs-libraries/src/integrations/social/x.provider.ts b/libraries/nestjs-libraries/src/integrations/social/x.provider.ts index de4192b3..67891ab5 100644 --- a/libraries/nestjs-libraries/src/integrations/social/x.provider.ts +++ b/libraries/nestjs-libraries/src/integrations/social/x.provider.ts @@ -241,6 +241,12 @@ export class XProvider extends SocialAbstract implements SocialProvider { postDetails: PostDetails<{ active_thread_finisher: boolean; thread_finisher: string; + who_can_reply_post: + | 'everyone' + | 'following' + | 'mentionedUsers' + | 'subscribers' + | 'verified'; }>[] ): Promise { const [accessTokenSplit, accessSecretSplit] = accessToken.split(':'); @@ -299,6 +305,12 @@ export class XProvider extends SocialAbstract implements SocialProvider { // @ts-ignore const { data }: { data: { id: string } } = await client.v2.tweet({ + ...(!postDetails?.[0]?.settings?.who_can_reply_post || + postDetails?.[0]?.settings?.who_can_reply_post === 'everyone' + ? {} + : { + reply_settings: postDetails?.[0]?.settings?.who_can_reply_post, + }), text: post.message, ...(media_ids.length ? { media: { media_ids } } : {}), ...(ids.length diff --git a/libraries/react-shared-libraries/src/translation/locales/en/translation.json b/libraries/react-shared-libraries/src/translation/locales/en/translation.json index 33da524e..f52fad35 100644 --- a/libraries/react-shared-libraries/src/translation/locales/en/translation.json +++ b/libraries/react-shared-libraries/src/translation/locales/en/translation.json @@ -485,5 +485,6 @@ "that_a_wrap": "That's a wrap!\n\nIf you enjoyed this thread:\n\n1. Follow me @{{username}} for more of these\n2. RT the tweet below to share this thread with your audience\n", "post_as_images_carousel": "Post as images carousel", "save_set": "Save Set", - "separate_post": "Separate post to multiple posts" + "separate_post": "Separate post to multiple posts", + "label_who_can_reply_to_this_post": "Who can reply to this post?" }