Skip to content

Commit 186b2dc

Browse files
committed
Providing fields argument to Drive.Comments.create and Drive.Replies.create
1 parent 9f60cb3 commit 186b2dc

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

src/backend/move/copyFileComments.ts

+6-2
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,16 @@ export function copyFileComments_(
3131
}
3232
const replies = comment.replies;
3333
comment.replies = [];
34-
const commentId = driveService.Comments.create(comment, destinationID).id;
34+
const commentId = driveService.Comments.create(comment, destinationID, {
35+
id: true,
36+
}).id;
3537
for (const reply of replies) {
3638
if (!reply.author.me) {
3739
reply.content = `*${reply.author.displayName}:*\n${reply.content}`;
3840
}
39-
driveService.Replies.create(reply, destinationID, commentId);
41+
driveService.Replies.create(reply, destinationID, commentId, {
42+
fields: "id",
43+
});
4044
}
4145
}
4246
}

src/backend/utils/SafeDriveService/SafeCommentsCollection.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,9 @@ export const SafeCommentsCollection_ = {
7777
fileId: string,
7878
fields: F,
7979
): DeepPick<SafeComment, F> => {
80-
const ret = Drive.Comments.create(resource, fileId);
80+
const ret = Drive.Comments.create(resource, fileId, {
81+
fields: stringifyFields_(fields),
82+
});
8183
if (!commentIsSafe_(ret, fields)) {
8284
throw new Error("Comments.create: Comment is not safe.");
8385
}

0 commit comments

Comments
 (0)