mirror of
https://github.com/scratchfoundation/scratch-www.git
synced 2024-11-27 01:25:52 -05:00
Merge pull request #2568 from paulkaplan/master-only-track-green-flag-once
[Master] Only track green flag once
This commit is contained in:
commit
8711542efa
1 changed files with 7 additions and 3 deletions
|
@ -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();
|
||||||
|
|
Loading…
Reference in a new issue