Skip to content

Commit c52185a

Browse files
committed
updated get projects api call to include collaborators projects
1 parent 07ed66f commit c52185a

File tree

5 files changed

+295
-117
lines changed

5 files changed

+295
-117
lines changed

images/icon.png

1.12 KB
Loading

package-lock.json

Lines changed: 184 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 82 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -1,85 +1,84 @@
11
{
2-
"name": "commit-extension",
3-
"publisher": "Commit",
4-
"repository": {
5-
"type": "git",
6-
"url": "https://github.com/commitdev/vscode-extension"
7-
},
8-
"author": {
9-
"name": "Daman Dhillon"
10-
},
11-
"displayName": "Commit Extension",
12-
"description": "Allow developers to log work on Commit Projects as Latest Updates",
13-
"version": "0.0.4",
14-
"engines": {
15-
"vscode": "^1.73.0"
16-
},
17-
"categories": [
18-
"Other"
19-
],
20-
"activationEvents": [
21-
"onStartupFinished"
22-
],
23-
"main": "./dist/extension.js",
24-
"contributes": {
25-
"commands": [
26-
{
27-
"command": "commit-extension.viewProjects",
28-
"title": "Commit: View Projects"
29-
},
30-
{
31-
"command": "commit-extension.setDefaultProject",
32-
"title": "Commit: Set default project for workspace"
33-
},
34-
{
35-
"command": "commit-extension.shareProject",
36-
"title": "Commit: Share a Project"
37-
},
38-
{
39-
"command": "commit-extension.shareProjectUpdate",
40-
"title": "Commit: Share Project Updates"
41-
}
42-
]
43-
},
44-
"scripts": {
45-
"vscode:prepublish": "npm run package",
46-
"compile": "webpack",
47-
"watch": "webpack --watch",
48-
"package": "webpack --mode production --devtool hidden-source-map",
49-
"compile-tests": "tsc -p . --outDir out",
50-
"watch-tests": "tsc -p . -w --outDir out",
51-
"pretest": "npm run compile-tests && npm run compile && npm run lint",
52-
"lint": "eslint src --ext ts",
53-
"test": "node ./out/test/runTest.js"
54-
},
55-
"devDependencies": {
56-
"@types/glob": "^8.0.0",
57-
"@types/mocha": "^10.0.0",
58-
"@types/node": "16.x",
59-
"@types/uuid": "^8.3.4",
60-
"@types/vscode": "^1.73.0",
61-
"@types/ws": "^8.5.3",
62-
"@typescript-eslint/eslint-plugin": "^5.42.0",
63-
"@typescript-eslint/parser": "^5.42.0",
64-
"@vscode/test-electron": "^2.2.0",
65-
"eslint": "^8.26.0",
66-
"glob": "^8.0.3",
67-
"html-loader": "^4.2.0",
68-
"mocha": "^10.1.0",
69-
"ts-loader": "^9.4.1",
70-
"typescript": "^4.8.4",
71-
"webpack": "^5.74.0",
72-
"webpack-cli": "^4.10.0"
73-
},
74-
"dependencies": {
75-
"@apollo/client": "^3.7.1",
76-
"axios": "^1.1.3",
77-
"cross-fetch": "^3.1.5",
78-
"graphql": "^16.6.0",
79-
"graphql-ws": "^5.11.2",
80-
"jwt-decode": "^3.1.2",
81-
"node-fetch": "^3.2.10",
82-
"uuid": "^9.0.0",
83-
"ws": "^8.11.0"
84-
}
2+
"name": "commit-extension",
3+
"publisher": "Commit",
4+
"repository": {
5+
"type": "git",
6+
"url": "https://github.com/commitdev/vscode-extension"
7+
},
8+
"author": {
9+
"name": "Daman Dhillon"
10+
},
11+
"displayName": "Commit Extension",
12+
"description": "Allow developers to log work on Commit Projects as Latest Updates",
13+
"version": "0.0.4",
14+
"icon": "images/icon.png",
15+
"engines": {
16+
"vscode": "^1.73.0"
17+
},
18+
"categories": [
19+
"Other"
20+
],
21+
"activationEvents": [
22+
"onStartupFinished"
23+
],
24+
"main": "./dist/extension.js",
25+
"contributes": {
26+
"commands": [
27+
{
28+
"command": "commit-extension.viewProjects",
29+
"title": "Commit: View Projects"
30+
},
31+
{
32+
"command": "commit-extension.setDefaultProject",
33+
"title": "Commit: Set default project for workspace"
34+
},
35+
{
36+
"command": "commit-extension.shareProject",
37+
"title": "Commit: Share a Project"
38+
},
39+
{
40+
"command": "commit-extension.shareProjectUpdate",
41+
"title": "Commit: Share Project Updates"
42+
}
43+
]
44+
},
45+
"scripts": {
46+
"vscode:prepublish": "npm run package",
47+
"compile": "webpack",
48+
"watch": "webpack --watch",
49+
"package": "webpack --mode production --devtool hidden-source-map",
50+
"compile-tests": "tsc -p . --outDir out",
51+
"watch-tests": "tsc -p . -w --outDir out",
52+
"pretest": "npm run compile-tests && npm run compile && npm run lint",
53+
"lint": "eslint src --ext ts",
54+
"test": "node ./out/test/runTest.js"
55+
},
56+
"devDependencies": {
57+
"@types/glob": "^8.0.0",
58+
"@types/mocha": "^10.0.0",
59+
"@types/node": "16.x",
60+
"@types/uuid": "^8.3.4",
61+
"@types/vscode": "^1.73.0",
62+
"@typescript-eslint/eslint-plugin": "^5.42.0",
63+
"@typescript-eslint/parser": "^5.42.0",
64+
"@vscode/test-electron": "^2.2.0",
65+
"eslint": "^8.26.0",
66+
"glob": "^8.0.3",
67+
"html-loader": "^4.2.0",
68+
"mocha": "^10.1.0",
69+
"ts-loader": "^9.4.1",
70+
"typescript": "^4.8.4",
71+
"webpack": "^5.74.0",
72+
"webpack-cli": "^4.10.0"
73+
},
74+
"dependencies": {
75+
"@apollo/client": "^3.7.1",
76+
"axios": "^1.1.3",
77+
"cross-fetch": "^3.1.5",
78+
"graphql": "^16.6.0",
79+
"graphql-ws": "^5.11.2",
80+
"jwt-decode": "^3.1.2",
81+
"node-fetch": "^3.2.10",
82+
"uuid": "^9.0.0"
83+
}
8584
}

src/commitAPI.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,11 @@ export class CommitAPI {
9191
throw new Error("You need to login to commit");
9292
}
9393
try {
94+
const userId = this.userCommitSession.account.id;
9495
const { data } = await this.apolloClient.query({
9596
query: gql`
9697
query {
97-
projects (creatorUserId: "${this.userCommitSession.account.id}") {
98+
projects (userIsCollaborator: "${userId}") {
9899
items {
99100
id,
100101
title,
@@ -147,7 +148,7 @@ export class CommitAPI {
147148
};
148149
}) as [Project];
149150
} catch (error: any) {
150-
// console.log(error.message);
151+
console.log(error);
151152
throw new Error("Error getting projects");
152153
}
153154
}

0 commit comments

Comments
 (0)