Skip to content

Commit 4c58ce9

Browse files
committed
fix: github uploadAsset
1 parent d5ef7b9 commit 4c58ce9

File tree

1 file changed

+8
-72
lines changed

1 file changed

+8
-72
lines changed

src/utils/github.ts

Lines changed: 8 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -10,79 +10,9 @@ interface GithubGraphqlCommentResult {
1010
addComment: {
1111
timelineEdge: {
1212
node: {
13-
__typename: string;
1413
id: string;
15-
databaseId: number;
16-
body: string;
17-
bodyHTML: string;
18-
bodyVersion: string;
19-
viewerCanUpdate: boolean;
20-
url: string;
21-
createdAt: string;
22-
authorAssociation: string;
23-
viewerCanDelete: boolean;
24-
viewerCanMinimize: boolean;
25-
viewerCanReport: boolean;
26-
viewerCanReportToMaintainer: boolean;
27-
viewerCanBlockFromOrg: boolean;
28-
viewerCanUnblockFromOrg: boolean;
29-
isHidden: boolean;
30-
minimizedReason: any;
31-
showSpammyBadge: boolean;
32-
createdViaEmail: boolean;
33-
viewerDidAuthor: boolean;
34-
authorToRepoOwnerSponsorship: any;
35-
author: {
36-
__typename: string;
37-
id: string;
38-
login: string;
39-
avatarUrl: string;
40-
};
41-
repository: {
42-
id: string;
43-
name: string;
44-
owner: {
45-
__typename: string;
46-
id: string;
47-
login: string;
48-
url: string;
49-
};
50-
isPrivate: boolean;
51-
slashCommandsEnabled: boolean;
52-
nameWithOwner: string;
53-
databaseId: number;
54-
};
55-
issue: {
56-
number: number;
57-
id: string;
58-
locked: boolean;
59-
databaseId: number;
60-
author: {
61-
__typename: string;
62-
login: string;
63-
id: string;
64-
};
65-
};
66-
__isComment: string;
67-
viewerCanReadUserContentEdits: boolean;
68-
lastEditedAt: any;
69-
lastUserContentEdit: any;
70-
__isReactable: string;
71-
reactionGroups: Array<{
72-
content: string;
73-
viewerHasReacted: boolean;
74-
reactors: {
75-
totalCount: number;
76-
nodes: Array<any>;
77-
};
78-
}>;
79-
__isNode: string;
8014
};
8115
};
82-
subject: {
83-
__typename: string;
84-
id: string;
85-
};
8616
};
8717
};
8818
}
@@ -129,7 +59,8 @@ export const uploadAsset = async (
12959
});
13060
// send file url text to github comment
13161
const commentResult = await graphqlFetch({
132-
query: '50e7774b5a519b88858e02e46e0348da',
62+
persistedQueryName: 'addCommentMutation',
63+
query: 'edafa18ab5734f05c9893cbc92d0dfb1',
13364
variables: {
13465
connections: [
13566
'client:I_kwDOJ3SWBc6viUWN:__Issue__backTimelineItems_connection(visibleEventsOnly:true)',
@@ -144,16 +75,21 @@ export const uploadAsset = async (
14475
await delay(1000);
14576
// unsubscribe the comment
14677
await graphqlFetch({
78+
persistedQueryName: 'updateIssueSubscriptionMutation',
14779
query: 'd0752b2e49295017f67c84f21bfe41a3',
14880
variables: {
14981
input: { state: 'UNSUBSCRIBED', subscribableId: 'I_kwDOJ3SWBc6viUWN' },
15082
},
15183
});
15284
// delete the comment
15385
await graphqlFetch({
86+
persistedQueryName: 'deleteIssueCommentMutation',
15487
query: 'b0f125991160e607a64d9407db9c01b3',
15588
variables: {
156-
connections: [],
89+
connections: [
90+
'client:I_kwDOJ3SWBc6viUWN:__Issue__frontTimelineItems_connection(visibleEventsOnly:true)',
91+
'client:I_kwDOJ3SWBc6viUWN:__Issue__backTimelineItems_connection(visibleEventsOnly:true)',
92+
],
15793
input: { id: commentResult.data.addComment.timelineEdge.node.id },
15894
},
15995
});

0 commit comments

Comments
 (0)