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