diff --git a/src/chrome/RatingButton.tsx b/src/chrome/RatingButton.tsx index d9210febf..4811f2bde 100644 --- a/src/chrome/RatingButton.tsx +++ b/src/chrome/RatingButton.tsx @@ -20,6 +20,8 @@ import GK from '../fb-stubs/GK'; import * as UserFeedback from '../fb-stubs/UserFeedback'; import {FeedbackPrompt} from '../fb-stubs/UserFeedback'; +const useEligibilityCheck = GK.get('flipper_use_itsr_eligibility_check'); + type Props = { onRatingChanged: (rating: number) => void; }; @@ -254,7 +256,7 @@ export default class RatingButton extends Component { state = { promptData: null, isShown: false, - userIsEligible: !GK.get('flipper_use_itsr_eligibility_check'), + userIsEligible: !useEligibilityCheck, }; constructor(props: Props) { @@ -265,7 +267,11 @@ export default class RatingButton extends Component { } onClick() { - this.setState({isShown: !this.state.isShown}); + const willBeShown = !this.state.isShown; + this.setState({isShown: willBeShown}); + if (!willBeShown && useEligibilityCheck) { + UserFeedback.dismiss(); + } } submitRating(rating: number) { diff --git a/src/fb-stubs/UserFeedback.tsx b/src/fb-stubs/UserFeedback.tsx index ee254810b..1d3a1e07f 100644 --- a/src/fb-stubs/UserFeedback.tsx +++ b/src/fb-stubs/UserFeedback.tsx @@ -27,6 +27,9 @@ export async function submitComment( ): Promise { throw new Error('Method not implemented.'); } +export async function dismiss(): Promise { + throw new Error('Method not implemented.'); +} export async function getPrompt(): Promise { throw new Error('Method not implemented.'); }