Skip to content

Commit 682254e

Browse files
committed
a bunch of crit bug fixes
1 parent 15137d8 commit 682254e

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

src/lib/storage.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,8 @@ class Storage extends ScratchStorage {
9494

9595
this.projectToken = creds.token;
9696
this.username = creds.username;
97+
// eslint-disable-next-line require-atomic-updates
98+
window.CollaborationUsername = creds.username;
9799
return creds;
98100
}
99101
async getProjectToken () {

src/lib/tw-project-meta-fetcher-hoc.jsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,6 @@ const TWProjectMetaFetcherHOC = function (WrappedComponent) {
108108
this.state = {
109109
canSave: false,
110110
canRemix: false,
111-
canUseCloud: false,
112111
canEditTitle: false
113112
};
114113
}
@@ -168,7 +167,6 @@ const TWProjectMetaFetcherHOC = function (WrappedComponent) {
168167
storage.setCloudOTT(data?.cloudDataOTT);
169168
storage.setCustomAchievements(data?.customAchievements);
170169
window.CollaborationRoom = data?.collaboratorRoom;
171-
window.CollaborationUsername = data?.username;
172170
window.collaborationOTT = data?.collaborationOTT;
173171
}
174172
setIndexable(true);
@@ -199,7 +197,6 @@ const TWProjectMetaFetcherHOC = function (WrappedComponent) {
199197
{...props}
200198
canSave={this.state.canSave}
201199
canRemix={this.state.canRemix}
202-
canUseCloud={this.state.canUseCloud}
203200
canEditTitle={this.state.canEditTitle}
204201
/>
205202
);

src/lib/vm-manager-hoc.jsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ const vmManagerHOC = function (WrappedComponent) {
3838
class VMManager extends React.Component {
3939
constructor (props) {
4040
super(props);
41+
this.state = {
42+
canUseCloud: false
43+
};
4144
bindAll(this, [
4245
'loadProject'
4346
]);
@@ -92,6 +95,10 @@ const vmManagerHOC = function (WrappedComponent) {
9295
const username = storage.username || '';
9396
this.props.onSetUsername(username);
9497

98+
if (username !== ''){
99+
this.setState({canUseCloud: true});
100+
}
101+
95102
this.props.vm.loadProject(this.props.projectData, additionalData)
96103
.then(() => {
97104
this.props.onLoadedProject(this.props.loadingState, this.props.canSave);
@@ -139,6 +146,7 @@ const vmManagerHOC = function (WrappedComponent) {
139146
<WrappedComponent
140147
isLoading={isLoadingWithIdProp}
141148
vm={vm}
149+
canUseCloud={this.state.canUseCloud}
142150
{...componentProps}
143151
/>
144152
);

0 commit comments

Comments
 (0)