Skip to content

Commit 8463b03

Browse files
committed
Don't show comment indication if you don't have permission
1 parent d0904ee commit 8463b03

File tree

2 files changed

+16
-13
lines changed

2 files changed

+16
-13
lines changed

packages/app/src/app/overmind/effects/vscode/ModelsHandler.ts

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -154,18 +154,16 @@ export class ModelsHandler {
154154
}
155155

156156
public clearComments() {
157-
if (this.sandbox.featureFlags.comments) {
158-
Object.values(this.moduleModels).forEach(moduleModel => {
159-
if (!moduleModel.model) {
160-
return;
161-
}
162-
moduleModel.comments = [];
163-
moduleModel.currentCommentDecorations = moduleModel.model.deltaDecorations(
164-
moduleModel.currentCommentDecorations,
165-
[]
166-
);
167-
});
168-
}
157+
Object.values(this.moduleModels).forEach(moduleModel => {
158+
if (!moduleModel.model) {
159+
return;
160+
}
161+
moduleModel.comments = [];
162+
moduleModel.currentCommentDecorations = moduleModel.model.deltaDecorations(
163+
moduleModel.currentCommentDecorations,
164+
[]
165+
);
166+
});
169167
}
170168

171169
public isModuleOpened(module: Module) {

packages/app/src/app/overmind/effects/vscode/index.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import * as childProcess from 'node-services/lib/child_process';
2929
import { TextOperation } from 'ot';
3030
import { json } from 'overmind';
3131
import io from 'socket.io-client';
32+
import { hasPermission } from '@codesandbox/common/lib/utils/permission';
3233

3334
import { EXTENSIONS_LOCATION, VIM_EXTENSION_ID } from './constants';
3435
import {
@@ -1202,7 +1203,11 @@ export class VSCodeEffect {
12021203

12031204
this.modelCursorPositionListener = activeEditor.onDidChangeCursorPosition(
12041205
cursor => {
1205-
if (sandbox?.featureFlags.comments) {
1206+
if (
1207+
sandbox &&
1208+
sandbox.featureFlags.comments &&
1209+
hasPermission(sandbox.authorization, 'comment')
1210+
) {
12061211
const model = activeEditor.getModel();
12071212

12081213
this.modelsHandler.updateLineCommentIndication(

0 commit comments

Comments
 (0)