Merge pull request #2568 from paulkaplan/master-only-track-green-flag-once

[Master] Only track green flag once
This commit is contained in:
Ray Schamp 2019-01-03 11:24:11 -05:00 committed by GitHub
commit 8711542efa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -117,7 +117,8 @@ class Preview extends React.Component {
showUsernameBlockAlert: false, showUsernameBlockAlert: false,
projectId: parts[1] === 'editor' ? '0' : parts[1], projectId: parts[1] === 'editor' ? '0' : parts[1],
reportOpen: false, reportOpen: false,
singleCommentId: singleCommentId singleCommentId: singleCommentId,
greenFlagRecorded: false
}; };
/* In the beginning, if user is on mobile and landscape, go to fullscreen */ /* In the beginning, if user is on mobile and landscape, go to fullscreen */
this.setScreenFromOrientation(); this.setScreenFromOrientation();
@ -357,11 +358,14 @@ class Preview extends React.Component {
this.props.reportProject(this.state.projectId, formData, this.props.user.token); this.props.reportProject(this.state.projectId, formData, this.props.user.token);
} }
handleGreenFlag () { handleGreenFlag () {
if (!this.state.greenFlagRecorded) {
this.props.logProjectView(this.props.projectInfo.id, this.props.authorUsername, this.props.user.token);
}
this.setState({ this.setState({
showUsernameBlockAlert: false, showUsernameBlockAlert: false,
showCloudDataAlert: false showCloudDataAlert: false,
greenFlagRecorded: true
}); });
this.props.logProjectView(this.props.projectInfo.id, this.props.authorUsername, this.props.user.token);
} }
handlePopState () { handlePopState () {
const path = window.location.pathname.toLowerCase(); const path = window.location.pathname.toLowerCase();