Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 10 additions & 12 deletions packages/app/src/app/overmind/effects/vscode/ModelsHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,18 +154,16 @@ export class ModelsHandler {
}

public clearComments() {
if (this.sandbox.featureFlags.comments) {
Object.values(this.moduleModels).forEach(moduleModel => {
if (!moduleModel.model) {
return;
}
moduleModel.comments = [];
moduleModel.currentCommentDecorations = moduleModel.model.deltaDecorations(
moduleModel.currentCommentDecorations,
[]
);
});
}
Object.values(this.moduleModels).forEach(moduleModel => {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one didn't really need a feature flag check.

if (!moduleModel.model) {
return;
}
moduleModel.comments = [];
moduleModel.currentCommentDecorations = moduleModel.model.deltaDecorations(
moduleModel.currentCommentDecorations,
[]
);
});
}

public isModuleOpened(module: Module) {
Expand Down
7 changes: 6 additions & 1 deletion packages/app/src/app/overmind/effects/vscode/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import * as childProcess from 'node-services/lib/child_process';
import { TextOperation } from 'ot';
import { json } from 'overmind';
import io from 'socket.io-client';
import { hasPermission } from '@codesandbox/common/lib/utils/permission';

import { EXTENSIONS_LOCATION, VIM_EXTENSION_ID } from './constants';
import {
Expand Down Expand Up @@ -1202,7 +1203,11 @@ export class VSCodeEffect {

this.modelCursorPositionListener = activeEditor.onDidChangeCursorPosition(
cursor => {
if (sandbox?.featureFlags.comments) {
if (
sandbox &&
sandbox.featureFlags.comments &&
hasPermission(sandbox.authorization, 'comment')
) {
const model = activeEditor.getModel();

this.modelsHandler.updateLineCommentIndication(
Expand Down