Skip to content
This repository was archived by the owner on Nov 15, 2024. It is now read-only.

Commit 3b8311b

Browse files
author
Brian Canzanella
committed
Updated protocol handling
1 parent a45e4d5 commit 3b8311b

19 files changed

+1064
-911
lines changed

api_server/.vscode/launch.json

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
{
2-
// Use IntelliSense to learn about possible attributes.
3-
// Hover to view descriptions of existing attributes.
4-
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
52
"version": "0.2.0",
63
"configurations": [
74
{
@@ -18,6 +15,25 @@
1815
"name": "Node: Debugger (Remote)",
1916
"protocol": "inspector",
2017
"port": 9230
21-
}
18+
},
19+
{
20+
"type": "node",
21+
"request": "launch",
22+
"runtimeExecutable": "${workspaceFolder}/../node/bin/node",
23+
"name": "Mocha Current File",
24+
"program": "${workspaceFolder}/node_modules/mocha/bin/_mocha",
25+
"args": [
26+
"--timeout",
27+
"999999",
28+
"--colors",
29+
"${file}"
30+
],
31+
"env": {
32+
"CS_API_TOP": "${workspaceFolder}/"
33+
},
34+
"cwd": "${workspaceFolder}/",
35+
"console": "integratedTerminal",
36+
"internalConsoleOptions": "neverOpen"
37+
}
2238
]
2339
}

api_server/modules/msteams_conversations/post_msteams_conversation_request.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ class PostMSTeamsConversationRequest extends PostRequest {
9393
for (const marker of markers) {
9494
let buttons = [];
9595
if (codemark.get('permalink')) {
96-
const url = `${codemark.get('permalink')}?ide=default&markerId=${marker.id}`;
96+
const url = `${codemark.get('permalink')}?ide=default&markerId=${marker.id}&src=Microsoft+Teams`;
9797
buttons.push({
9898
type: ActionTypes.OpenUrl,
9999
title: 'Open in IDE',

api_server/modules/providers/provider_action_request.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -248,11 +248,8 @@ class ProviderActionRequest extends RestfulRequest {
248248
return {
249249
event: 'Opened on Web'
250250
};
251-
} else if (actionPayload.linkType === 'ide') {
252-
return {
253-
event: 'Opened in IDE'
254-
};
255-
} else if (actionPayload.linkType === 'reply') {
251+
}
252+
else if (actionPayload.linkType === 'reply') {
256253
return {
257254
event: 'View Discussion & Reply',
258255
data: {

api_server/modules/web/config.js

Lines changed: 57 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -14,33 +14,26 @@ const tagMap = {
1414
// used to open codemarks/reviews/foos with a selected IDE of choice
1515
const ides = [
1616
{
17-
ideName: 'Atom',
18-
protocol: 'atom://codestream/',
19-
moniker: 'atom',
20-
downloadUrl: 'https://atom.io/packages/codestream'
21-
},
22-
{},
23-
{
24-
ideName: 'Visual Studio',
25-
protocol: 'codestream-vs://codestream/',
26-
moniker: 'vs',
27-
downloadUrl:
28-
'https://marketplace.visualstudio.com/items?itemName=CodeStream.codestream-vs'
29-
},
30-
{
31-
ideName: 'Visual Studio Code',
17+
ideName: 'VS Code',
3218
protocol: 'vscode://codestream.codestream/',
3319
moniker: 'vsc',
3420
downloadUrl:
3521
'https://marketplace.visualstudio.com/items?itemName=CodeStream.codestream'
3622
},
3723
{
38-
ideName: 'Visual Studio Code Insiders',
24+
ideName: 'VS Code Insiders',
3925
protocol: 'vscode-insiders://codestream.codestream/',
4026
moniker: 'vsc-insiders',
4127
downloadUrl:
4228
'https://marketplace.visualstudio.com/items?itemName=CodeStream.codestream'
4329
},
30+
{
31+
ideName: 'Visual Studio',
32+
protocol: 'codestream-vs://codestream/',
33+
moniker: 'vs',
34+
downloadUrl:
35+
'https://marketplace.visualstudio.com/items?itemName=CodeStream.codestream-vs'
36+
},
4437
{},
4538
{
4639
ideName: 'Android Studio',
@@ -49,27 +42,21 @@ const ides = [
4942
downloadUrl: 'https://plugins.jetbrains.com/plugin/12206-codestream'
5043
},
5144
{
52-
ideName: 'CLion',
53-
protocol: 'jetbrains://clion/codestream/',
54-
moniker: 'jb-clion',
55-
downloadUrl: 'https://plugins.jetbrains.com/plugin/12206-codestream'
56-
},
57-
{
58-
ideName: 'DataGrip',
59-
protocol: 'jetbrains://datagrip/codestream/',
60-
moniker: 'jb-datagrip',
45+
ideName: 'IntelliJ IDEA',
46+
protocol: 'jetbrains://idea/codestream/',
47+
moniker: 'jb-idea',
6148
downloadUrl: 'https://plugins.jetbrains.com/plugin/12206-codestream'
6249
},
6350
{
64-
ideName: 'GoLand',
65-
protocol: 'jetbrains://goland/codestream/',
66-
moniker: 'jb-goland',
51+
ideName: 'PyCharm',
52+
protocol: 'jetbrains://pycharm/codestream/',
53+
moniker: 'jb-pycharm',
6754
downloadUrl: 'https://plugins.jetbrains.com/plugin/12206-codestream'
6855
},
6956
{
70-
ideName: 'IntelliJ IDEA',
71-
protocol: 'jetbrains://idea/codestream/',
72-
moniker: 'jb-idea',
57+
ideName: 'WebStorm',
58+
protocol: 'jetbrains://web-storm/codestream/',
59+
moniker: 'jb-web-storm',
7360
downloadUrl: 'https://plugins.jetbrains.com/plugin/12206-codestream'
7461
},
7562
{
@@ -79,9 +66,9 @@ const ides = [
7966
downloadUrl: 'https://plugins.jetbrains.com/plugin/12206-codestream'
8067
},
8168
{
82-
ideName: 'PyCharm',
83-
protocol: 'jetbrains://pycharm/codestream/',
84-
moniker: 'jb-pycharm',
69+
ideName: 'RubyMine',
70+
protocol: 'jetbrains://rubymine/codestream/',
71+
moniker: 'jb-rubymine',
8572
downloadUrl: 'https://plugins.jetbrains.com/plugin/12206-codestream'
8673
},
8774
{
@@ -91,20 +78,48 @@ const ides = [
9178
downloadUrl: 'https://plugins.jetbrains.com/plugin/12206-codestream'
9279
},
9380
{
94-
ideName: 'RubyMine',
95-
protocol: 'jetbrains://rubymine/codestream/',
96-
moniker: 'jb-rubymine',
81+
ideName: 'CLion',
82+
protocol: 'jetbrains://clion/codestream/',
83+
moniker: 'jb-clion',
9784
downloadUrl: 'https://plugins.jetbrains.com/plugin/12206-codestream'
9885
},
9986
{
100-
ideName: 'WebStorm',
101-
protocol: 'jetbrains://web-storm/codestream/',
102-
moniker: 'jb-web-storm',
87+
ideName: 'GoLand',
88+
protocol: 'jetbrains://goland/codestream/',
89+
moniker: 'jb-goland',
90+
downloadUrl: 'https://plugins.jetbrains.com/plugin/12206-codestream'
91+
},
92+
{
93+
ideName: 'DataGrip',
94+
protocol: 'jetbrains://datagrip/codestream/',
95+
moniker: 'jb-datagrip',
96+
downloadUrl: 'https://plugins.jetbrains.com/plugin/12206-codestream'
97+
},
98+
{
99+
ideName: 'AppCode',
100+
protocol: 'jetbrains://appcode/codestream/',
101+
moniker: 'jb-appcode',
103102
downloadUrl: 'https://plugins.jetbrains.com/plugin/12206-codestream'
103+
},
104+
{},
105+
{
106+
ideName: 'Atom',
107+
protocol: 'atom://codestream/',
108+
moniker: 'atom',
109+
downloadUrl: 'https://atom.io/packages/codestream'
104110
}
105-
];
111+
];
112+
113+
const lastOriginToIdeMonikers = {
114+
'Atom': 'atom',
115+
'VS Code': 'vsc',
116+
'JetBrains': undefined,
117+
'VS': 'vs'
118+
};
106119

107120
module.exports = {
108121
ides: ides,
109-
tagMap: tagMap
122+
tagMap: tagMap,
123+
lastOriginToIdeMonikers: lastOriginToIdeMonikers,
124+
defaultCookieName: 'cs__ide-mru'
110125
};

api_server/modules/web/link_codemark_request.js

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
// handle the "GET /c" request to show a codemark
2+
3+
/*eslint complexity: ["error", 666]*/
4+
15
'use strict';
26

37
const CodemarkLinkIndexes = require(process.env.CS_API_TOP +
@@ -414,14 +418,28 @@ class LinkCodemarkRequest extends WebRequestBase {
414418

415419
const selectedMarker = this.request.query.marker;
416420
const debug = this.request.query.debug === 'true';
421+
const markers = await this.getMarkersInfo({ selectedMarker, showComment, debug });
422+
let uniqueRepoId;
423+
let uniqueFileName;
424+
if (markers && markers.length) {
425+
// see if there's 1 unique repo
426+
const repoIds = [...new Set(markers.map(_ => _.repoId))];
427+
if (repoIds && repoIds.length === 1) {
428+
uniqueRepoId = repoIds[0];
429+
}
430+
const fileNames = [...new Set(markers.map(_ => _.rawFileName))];
431+
if (fileNames && fileNames.length === 1) {
432+
uniqueFileName = fileNames[0];
433+
}
434+
}
417435
const templateProps = {
418436
codemarkId: this.codemark.get('id'),
419437
teamName: this.team.get('name'),
420438
launchIde:
421439
this.request.query.ide === ''
422440
? 'default'
423441
: this.request.query.ide,
424-
markers: await this.getMarkersInfo({ selectedMarker, showComment, debug }),
442+
markers: markers,
425443
queryString: {
426444
marker: selectedMarker,
427445
ide:
@@ -438,12 +456,15 @@ class LinkCodemarkRequest extends WebRequestBase {
438456
codemarkType: codemarkType === 'link' ? 'Permalink' : 'Codemark',
439457
relatedCodemarks: await this.createRelatedCodemarks(),
440458
tags: tags,
459+
uniqueRepoId: uniqueRepoId,
460+
uniqueFileName: encodeURI(uniqueFileName),
441461
hasTagsOrAssignees:
442462
(assignees && assignees.length) || (tags && tags.length),
443463
externalProviderIcon:
444464
icon && icon.path ? this.createIcon(icon) : undefined,
445465
externalProvider,
446466
externalProviderUrl,
467+
partial_launcher_model: this.createLauncherModel(uniqueRepoId),
447468
partial_title_model: {
448469
v2: codemarkType === 'issue',
449470
showComment: showComment,

api_server/modules/web/link_ext_navigate_request.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ class ExtensionNavigateRequest extends WebRequestBase {
2525
ide: 'default',
2626
debug: this.request.query.debug === 'true'
2727
},
28-
segmentKey: this.api.config.segment.webToken
28+
segmentKey: this.api.config.segment.webToken,
29+
partial_launcher_model: this.createLauncherModel(undefined),
2930
};
3031
await super.render('ext_navigate', templateProps);
3132
}

api_server/modules/web/link_review_request.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,12 @@ class LinkReviewRequest extends WebRequestBase {
296296
const status = this.review.get('status');
297297
const changes = await this.getChangeSetInfo();
298298

299+
let uniqueRepoId;
300+
const repoIds = changes && changes.repos ? [...new Set(changes.repos.map(_ => _.id))] : undefined;
301+
if (repoIds && repoIds.length === 1) {
302+
uniqueRepoId = repoIds[0];
303+
}
304+
299305
const templateProps = {
300306
reviewId: this.review.get('id'),
301307
status: status ? status[0].toUpperCase() + status.slice(1) : '',
@@ -305,6 +311,7 @@ class LinkReviewRequest extends WebRequestBase {
305311
? 'default'
306312
: this.request.query.ide,
307313
repos: changes.repos,
314+
uniqueRepoId: uniqueRepoId,
308315
changes: changes.files,
309316
queryString: {
310317
ide:
@@ -320,6 +327,7 @@ class LinkReviewRequest extends WebRequestBase {
320327
tags: tags,
321328
hasTagsOrReviewers:
322329
(reviewers && reviewers.length) || (tags && tags.length),
330+
partial_launcher_model: this.createLauncherModel(uniqueRepoId),
323331
partial_title_model: {
324332
v2: true,
325333
isReview: true,

0 commit comments

Comments
 (0)