Skip to content

Commit 47a76f8

Browse files
CompuIvesDanny Ruchtiejyash97posva
authored
Don't show comment indication if you don't have permissions (#4266)
* Added p5js icon * Remove unnecessary fill property * fix: setting undefined in URL (#4244) * Remove pkg.json check (#4248) * Remove pkg.json check * Remove unused imports * Add support for dynamic webpack loaders (#4245) * Fix typo * Undo the requires change * Fix eslint (#4259) * Resolve ESModules by default (#4191) * Default to esmodules * New packager * Fix edge case with handling exports * Test #1 * Test #2 * Test #2 * New try * Patch resolve in babel * Fix plugin * Logging * Remove esmodule check * Change fallback * Put check back * Remove isEsModule check code * Put convert esmodule code back in * Optimize for speed * Set a better default config * Simplify boolean * Set default babel configs * Fix links * Don't allow the sidebar to render if currentSandbox is not available (#4261) * fix: check for vue router v4 (#4203) * Fix esm var changes (#4262) * Fix esm var changes * Fix object initiliazers * Add comment * fix: typo in method isInsideVue (#4263) * Fix transforming properties like toString * Add comments data * Use unique id * Fix typo in reference * Don't show comment indication if you don't have permission Co-authored-by: Danny Ruchtie <[email protected]> Co-authored-by: Yash Joshi <[email protected]> Co-authored-by: Eduardo San Martin Morote <[email protected]>
1 parent 4f49a70 commit 47a76f8

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)